[mapguide-commits] r5026 - in trunk/Tools/Maestro/Maestro/ResourceValidators: . Strings

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jul 12 02:56:18 EDT 2010


Author: jng
Date: 2010-07-12 06:56:18 +0000 (Mon, 12 Jul 2010)
New Revision: 5026

Modified:
   trunk/Tools/Maestro/Maestro/ResourceValidators/FeatureSourceValidator.cs
   trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.Designer.cs
   trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.resx
Log:
Fix #1401: The problem is simply the server-side will *never* return an empty array for the GETIDENTITYPROPERTIES call. It will throw a MgClassNotFoundException for classes without identity properties, which I believe is incorrect. Nevertheless, I've updated the Feature Source validation to handle this scenario.


Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/FeatureSourceValidator.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/FeatureSourceValidator.cs	2010-07-12 02:23:54 UTC (rev 5025)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/FeatureSourceValidator.cs	2010-07-12 06:56:18 UTC (rev 5026)
@@ -83,13 +83,24 @@
                 try
                 {
                     string[] ids = feature.GetIdentityProperties(cl);
+                    //According to my tests, this code path never gets reached because the 
+                    //MG server will incorrectly throw MgClassNotFoundException when querying
+                    //a class with no identity properties. Nevertheless we'll leave this in, if/when
+                    //this logic is fixed server-side.
                     if (ids == null || ids.Length == 0)
                         issues.Add(new ValidationIssue(feature, ValidationStatus.Information, string.Format(Strings.FeatureSourceValidator.PrimaryKeyMissingInformation, cl)));
                 }
                 catch (Exception ex)
                 {
                     string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
-                    issues.Add(new ValidationIssue(feature, ValidationStatus.Error, string.Format(Strings.FeatureSourceValidator.PrimaryKeyReadError, msg)));
+                    if (msg.IndexOf("MgClassNotFoundException") >= 0)
+                    {
+                        issues.Add(new ValidationIssue(feature, ValidationStatus.Warning, string.Format(Strings.FeatureSourceValidator.NoPrimaryKeyOrView, cl)));
+                    }
+                    else
+                    {
+                        issues.Add(new ValidationIssue(feature, ValidationStatus.Error, string.Format(Strings.FeatureSourceValidator.PrimaryKeyReadError, msg)));
+                    }
                 }
             }
 

Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.Designer.cs	2010-07-12 02:23:54 UTC (rev 5025)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.Designer.cs	2010-07-12 06:56:18 UTC (rev 5026)
@@ -79,6 +79,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Could not obtain identity properties for {0}. This class either has no identity properties and/or is derived from a view with no uniquely identifiable columns. Attempting to create feature joins from this class may produce unexpected results..
+        /// </summary>
+        internal static string NoPrimaryKeyOrView {
+            get {
+                return ResourceManager.GetString("NoPrimaryKeyOrView", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to No spatial contexts found.
         /// </summary>
         internal static string NoSpatialContextWarning {

Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.resx
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.resx	2010-07-12 02:23:54 UTC (rev 5025)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/FeatureSourceValidator.resx	2010-07-12 06:56:18 UTC (rev 5026)
@@ -125,6 +125,10 @@
     <value>Empty spatial context extent detected</value>
     <comment>A warning message that is displayed when the spatial context is empty</comment>
   </data>
+  <data name="NoPrimaryKeyOrView" xml:space="preserve">
+    <value>Could not obtain identity properties for {0}. This class either has no identity properties and/or is derived from a view with no uniquely identifiable columns. Attempting to create feature joins from this class may produce unexpected results.</value>
+    <comment>A warning message that is displayed when we can't obtain identity properties from a class because it is a view</comment>
+  </data>
   <data name="NoSpatialContextWarning" xml:space="preserve">
     <value>No spatial contexts found</value>
     <comment>A warning message that is displayed when the featuresource fails to report its spatial context</comment>



More information about the mapguide-commits mailing list