[mapguide-commits] r6678 - in trunk/Tools/Maestro: Maestro Maestro.Editors/FeatureSource Maestro.Editors/FeatureSource/Extensions OSGeo.MapGuide.MaestroAPI/Services OSGeo.MapGuide.MaestroAPI.Http

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 22 10:07:09 EDT 2012


Author: jng
Date: 2012-05-22 07:07:08 -0700 (Tue, 22 May 2012)
New Revision: 6678

Modified:
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs
   trunk/Tools/Maestro/Maestro/Maestro_All.sln
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
Log:
#2004: Eliminate the need for a full schema walk in Join settings UI. We're only fetching class names anyway and the only time we need to fetch a single class definition is when we're picking join properties and there's an API for that. Also clean up the IFeatureService API documentation for GetClasses.

Modified: trunk/Tools/Maestro/Maestro/Maestro_All.sln
===================================================================
--- trunk/Tools/Maestro/Maestro/Maestro_All.sln	2012-05-22 13:50:39 UTC (rev 6677)
+++ trunk/Tools/Maestro/Maestro/Maestro_All.sln	2012-05-22 14:07:08 UTC (rev 6678)
@@ -1,6 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
+# SharpDevelop 4.2.0.8783
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro", "Maestro.csproj", "{E0C36475-2B70-4F6D-ACE0-8943167806DC}"
 	ProjectSection(ProjectDependencies) = postProject
 		{B3A2B816-9F41-4857-A111-09D2DF2550D6} = {B3A2B816-9F41-4857-A111-09D2DF2550D6}

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs	2012-05-22 13:50:39 UTC (rev 6677)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Extensions/JoinSettings.cs	2012-05-22 14:07:08 UTC (rev 6678)
@@ -47,17 +47,20 @@
 
         private IAttributeRelation _rel;
 
-        private ClassDefinition _primaryClass;
-        private ClassDefinition[] _secondaryClasses;
-        private ClassDefinition _secondaryClass;
+        private string _primaryFeatureSource;
+        private string _primaryClass;
+        private string[] _secondaryClasses;
+        private string _secondaryClass;
 
         private BindingList<IRelateProperty> _propertyJoins;
 
-        public JoinSettings(ClassDefinition primaryClass, IAttributeRelation rel)
+        public JoinSettings(string primaryFeatureSource, string primaryClass, IAttributeRelation rel)
             : this()
         {
             Check.NotNull(rel, "rel");
             Check.NotNull(primaryClass, "primaryClass");
+            Check.NotNull(primaryFeatureSource, "primaryFeatureSource");
+            _primaryFeatureSource = primaryFeatureSource;
             _primaryClass = primaryClass;
 
             _init = true;
@@ -89,9 +92,7 @@
             if (!string.IsNullOrEmpty(resId))
             {
                 txtFeatureSource.Text = resId;
-
-                var schema = _edSvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
-                _secondaryClasses = new List<ClassDefinition>(schema.AllClasses).ToArray();
+                _secondaryClasses = _edSvc.FeatureService.GetClassNames(txtFeatureSource.Text, null);
                 //Invalidate existing secondary class
                 txtSecondaryClass.Text = string.Empty;
                 _secondaryClass = null;
@@ -113,7 +114,7 @@
             if (selClass != null)
             {
                 _secondaryClass = selClass;
-                txtSecondaryClass.Text = _secondaryClass.QualifiedName;
+                txtSecondaryClass.Text = _secondaryClass;
                 CheckAddStatus();
             }
         }
@@ -137,14 +138,13 @@
             //Init selected classes
             if (!string.IsNullOrEmpty(_rel.ResourceId))
             {
-                var schema = _edSvc.FeatureService.DescribeFeatureSource(_rel.ResourceId);
-                _secondaryClasses = new List<ClassDefinition>(schema.AllClasses).ToArray();
+                _secondaryClasses = _edSvc.FeatureService.GetClassNames(_rel.ResourceId, null);
 
                 if (!string.IsNullOrEmpty(_rel.AttributeClass))
                 {
                     foreach (var cls in _secondaryClasses)
                     {
-                        if (cls.QualifiedName.Equals(_rel.AttributeClass))
+                        if (cls.Equals(_rel.AttributeClass))
                         {
                             _secondaryClass = cls;
                             break;
@@ -235,7 +235,10 @@
         {
             if (_primaryClass != null && _secondaryClass != null)
             {
-                var dlg = new SelectJoinKeyDialog(_primaryClass, _secondaryClass);
+                var pc = _edSvc.FeatureService.GetClassDefinition(_primaryFeatureSource, _primaryClass);
+                var sc = _edSvc.FeatureService.GetClassDefinition(_rel.ResourceId, _secondaryClass);
+                
+                var dlg = new SelectJoinKeyDialog(pc, sc);
                 if (dlg.ShowDialog() == DialogResult.OK)
                 {
                     var rel = _rel.CreatePropertyJoin(dlg.PrimaryProperty, dlg.SecondaryProperty);

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs	2012-05-22 13:50:39 UTC (rev 6677)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/ExtensionsCtrl.cs	2012-05-22 14:07:08 UTC (rev 6678)
@@ -331,11 +331,12 @@
                 ext = e.Node.Parent.Tag as IFeatureSourceExtension;
                 if (ext != null)
                 {
-                    ClassDefinition cls = _fs.GetClass(ext.FeatureClass); //TODO: Cache?
-                    
-                    if (cls != null)
+                    if (ext.FeatureClass != null)
                     {
-                        var ctl = new JoinSettings(cls, join);
+                        //NOTE: The feature source id here may be session based, but this is still okay
+                        //as we're only giving context (the primary class to join on) for the secondary join UI. 
+                        //This feature source id is never written into the actual document
+                        var ctl = new JoinSettings(_fs.ResourceID, ext.FeatureClass, join);
                         ctl.Bind(_edSvc);
                         ctl.Dock = DockStyle.Fill;
                         splitContainer1.Panel2.Controls.Clear();

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs	2012-05-22 13:50:39 UTC (rev 6677)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs	2012-05-22 14:07:08 UTC (rev 6678)
@@ -247,10 +247,13 @@
         string[] GetSchemas(string resourceId);
 
         /// <summary>
-        /// Gets an array of feature class names from the specified feature source
+        /// Gets an array of qualified feature class names from the specified feature source
         /// </summary>
-        /// <param name="resourceId"></param>
-        /// <param name="schemaName"></param>
+        /// <param name="resourceId">The feature source id</param>
+        /// <param name="schemaName">
+        /// The name of the schema whose class names are to be returned. If null, class names from all schemas in the feature source
+        /// are returned
+        /// </param>
         /// <returns></returns>
         string[] GetClassNames(string resourceId, string schemaName);
     }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs	2012-05-22 13:50:39 UTC (rev 6677)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs	2012-05-22 14:07:08 UTC (rev 6678)
@@ -1510,7 +1510,8 @@
                 param.Add("LOCALE", m_locale);
 
             param.Add("RESOURCEID", resourceId);
-            param.Add("SCHEMA", schemaName);
+            if (!string.IsNullOrEmpty(schemaName))
+                param.Add("SCHEMA", schemaName);
 
             return m_hosturi + "?" + EncodeParameters(param);
         }



More information about the mapguide-commits mailing list