[mapguide-commits] r6441 - sandbox/adsk/2.4j/Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jan 18 01:41:55 EST 2012


Author: christinebao
Date: 2012-01-17 22:41:55 -0800 (Tue, 17 Jan 2012)
New Revision: 6441

Modified:
   sandbox/adsk/2.4j/Server/src/Services/Feature/ServerDescribeSchema.cpp
Log:
http://trac.osgeo.org/mapguide/ticket/1917
Join WFS feature source cause ServerDescribeScheme fail

Modified: sandbox/adsk/2.4j/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- sandbox/adsk/2.4j/Server/src/Services/Feature/ServerDescribeSchema.cpp	2012-01-18 02:12:13 UTC (rev 6440)
+++ sandbox/adsk/2.4j/Server/src/Services/Feature/ServerDescribeSchema.cpp	2012-01-18 06:41:55 UTC (rev 6441)
@@ -153,19 +153,6 @@
                         ffsc2 = fdoCommand2->Execute();
                         CHECKNULL((FdoFeatureSchemaCollection*)ffsc2, L"MgServerDescribeSchema.DescribeFdoSchema");
 
-                        if (!secSchemaName.empty())
-                        {
-                            fdoCommand2->SetSchemaName(secSchemaName.c_str());
-                        }
-
-                        if (!secClassName.empty())
-                        {
-                            FdoPtr<FdoStringCollection> fdoClassNames2 = FdoStringCollection::Create();
-
-                            fdoClassNames2->Add(secClassName.c_str());
-                            fdoCommand2->SetClassNames(fdoClassNames2.p);
-                        }
-
                         // Extract the schemas from the secondary collection and add them to the main collection
                         // Get schema count
                         FdoInt32 cnt = ffsc2->GetCount();
@@ -185,13 +172,92 @@
                             modifiedSchemaName += L"[" + attributeRelateName + L"]";
                             modifiedSchemaName += fdoSchemaName;
                             FdoString* msn = modifiedSchemaName.c_str();
-                            ffs->SetName(msn);
 
-                            // Add this schema to the collection if it isn't already there
-                            if (!ffsc->Contains(ffs))
+                            if(connection2->GetProviderName().find(L"OSGeo.WFS") != STRING::npos)
                             {
-                                ffsc->Add(ffs);
+                                //make a copy of ffs and add to return schema collection
+                                FdoPtr<FdoFeatureSchema> ffsCopy = FdoFeatureSchema::Create();
+                                ffsCopy->SetName(msn);
+                                ffsCopy->SetDescription(ffs->GetDescription());
+                                FdoPtr<FdoClassCollection> classColl = ffs->GetClasses();
+                                FdoPtr<FdoClassCollection> classCollCopy = ffsCopy->GetClasses();
+                                for(int i = 0; i < classColl->GetCount(); i ++)
+                                {
+                                    FdoPtr<FdoClassDefinition> classDef = classColl->GetItem(i);
+                                    FdoPtr<FdoClassDefinition> classDefCopy;
+                                    if(classDef->GetClassType() == FdoClassType_FeatureClass) 
+                                    {
+                                        classDefCopy = FdoFeatureClass::Create();
+                                    }
+                                    else if(classDef->GetClassType() == FdoClassType_Class)
+                                    {
+                                        classDefCopy = FdoClass::Create();
+                                    }
+                                    else if(classDef->GetClassType() == FdoClassType_NetworkClass)
+                                    {
+                                        classDefCopy = FdoNetworkClass::Create();
+                                    }
+                                    else if(classDef->GetClassType() == FdoClassType_NetworkLayerClass)
+                                    {
+                                        classDefCopy = FdoNetworkLayerClass::Create();
+                                    }
+                                    else if(classDef->GetClassType() == FdoClassType_NetworkLinkClass)
+                                    {
+                                        classDefCopy = FdoNetworkLinkFeatureClass::Create();
+                                    }
+                                    else if(classDef->GetClassType() == FdoClassType_NetworkNodeClass)
+                                    {
+                                        classDefCopy = FdoNetworkNodeFeatureClass::Create();
+                                    }
+                                    classDefCopy->SetName(classDef->GetName());
+                                    classDefCopy->SetDescription(classDef->GetDescription());
+                                    classCollCopy->Add(classDefCopy);
+                                    FdoPtr<FdoPropertyDefinitionCollection> propColl = classDef->GetProperties();
+                                    FdoPtr<FdoPropertyDefinitionCollection> propCollCopy = classDefCopy->GetProperties();
+                                    for(int j = 0; j < propColl->GetCount(); j ++)
+                                    {
+                                        FdoPtr<FdoPropertyDefinition> prop = propColl->GetItem(j);
+                                        FdoPtr<FdoPropertyDefinition> propCopy;
+                                        if(prop->GetPropertyType() == FdoPropertyType_AssociationProperty)
+                                        {
+                                            propCopy = FdoAssociationPropertyDefinition::Create();
+                                        }
+                                        else if(prop->GetPropertyType() == FdoPropertyType_DataProperty)
+                                        {
+                                            propCopy = FdoDataPropertyDefinition::Create();
+                                        }
+                                        else if(prop->GetPropertyType() == FdoPropertyType_GeometricProperty)
+                                        {
+                                            propCopy = FdoGeometricPropertyDefinition::Create();
+                                        }
+                                        else if(prop->GetPropertyType() == FdoPropertyType_ObjectProperty)
+                                        {
+                                            propCopy = FdoObjectPropertyDefinition::Create();
+                                        }
+                                        else if(prop->GetPropertyType() == FdoPropertyType_RasterProperty)
+                                        {
+                                            propCopy = FdoRasterPropertyDefinition::Create();
+                                        }
+                                        propCopy->SetName(prop->GetName());
+                                        propCopy->SetDescription(prop->GetDescription());
+                                        propCollCopy->Add(propCopy);
+                                    }
+                                }
+                                // Add this schema to the collection if it isn't already there
+                                if (!ffsc->Contains(ffsCopy))
+                                {
+                                    ffsc->Add(ffsCopy);
+                                }
                             }
+                            else 
+                            {
+                                ffs->SetName(msn);
+                                // Add this schema to the collection if it isn't already there
+                                if (!ffsc->Contains(ffs))
+                                {
+                                    ffsc->Add(ffs);
+                                }
+                            }
                         }
                     }
                     else



More information about the mapguide-commits mailing list