[mapguide-commits] r7574 - branches/2.5/MgDev/Desktop/MgDesktop/Services/Feature/Commands
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 7 01:59:35 PDT 2013
Author: jng
Date: 2013-06-07 01:59:34 -0700 (Fri, 07 Jun 2013)
New Revision: 7574
Modified:
branches/2.5/MgDev/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp
Log:
mg-desktop: When interrogating identity properties and we get MgDuplicateObjectException thrown back, catch and re-throw with added context as we'd like to know which Feature Class is causing this to happen. Also change a bunch of CHECKNULL calls to CHECKARGUMENTNULL
Modified: branches/2.5/MgDev/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp
===================================================================
--- branches/2.5/MgDev/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp 2013-06-06 18:23:16 UTC (rev 7573)
+++ branches/2.5/MgDev/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp 2013-06-07 08:59:34 UTC (rev 7574)
@@ -1264,7 +1264,7 @@
///
bool MgdDescribeSchema::IsClassNameHintUsed(FdoIDescribeSchema* fdoCommand)
{
- CHECKNULL(fdoCommand, L"MgdDescribeSchema.IsClassNameHintUsed");
+ CHECKARGUMENTNULL(fdoCommand, L"MgdDescribeSchema.IsClassNameHintUsed");
FdoPtr<FdoStringCollection> classNames = fdoCommand->GetClassNames();
bool classNameHintUsed = (NULL != classNames.p);
@@ -1275,7 +1275,7 @@
///////////////////////////////////////////////////////////////////////////////
MgStringCollection* MgdDescribeSchema::GetSchemaNames(MgFeatureSchemaCollection* schemas)
{
- CHECKNULL(schemas, L"MgdDescribeSchema.GetSchemaNames");
+ CHECKARGUMENTNULL(schemas, L"MgdDescribeSchema.GetSchemaNames");
Ptr<MgStringCollection> schemaNames = new MgStringCollection();
INT32 schemaCount = schemas->GetCount();
@@ -1336,7 +1336,7 @@
///////////////////////////////////////////////////////////////////////////////
MgClassDefinition* MgdDescribeSchema::GetClassDefinition(MgFeatureSchemaCollection* schemas, CREFSTRING schemaName, CREFSTRING className)
{
- CHECKNULL(schemas, L"MgdDescribeSchema.GetClassDefinition");
+ CHECKARGUMENTNULL(schemas, L"MgdDescribeSchema.GetClassDefinition");
Ptr<MgClassDefinition> classDef;
INT32 schemaCount = schemas->GetCount();
@@ -1390,9 +1390,12 @@
FdoFeatureSchemaCollection* schemas, MgResourceIdentifier* resource,
CREFSTRING schemaName, CREFSTRING className)
{
- CHECKNULL(schemas, L"MgdDescribeSchema.GetIdentityProperties");
+ CHECKARGUMENTNULL(schemas, L"MgdDescribeSchema.GetIdentityProperties");
+ CHECKARGUMENTNULL(resource, L"MgdDescribeSchema.GetIdentityProperties");
+ Ptr<MgPropertyDefinitionCollection> idProps;
- Ptr<MgPropertyDefinitionCollection> idProps = new MgPropertyDefinitionCollection();
+ MG_FEATURE_SERVICE_TRY()
+ idProps = new MgPropertyDefinitionCollection();
INT32 schemaCount = schemas->GetCount();
// There should be at least one schema for the primary feature source.
@@ -1453,6 +1456,31 @@
}
}
+ MG_FEATURE_SERVICE_CATCH_WITH_FEATURE_SOURCE(L"MgdDescribeSchema.GetIdentityProperties", resource)
+
+ if (mgException != NULL)
+ {
+ //Sorry, if you're complaining about duplicate identity properties, then we need that thing called context
+ if (mgException->IsOfClass(Foundation_Exception_MgDuplicateObjectException))
+ {
+ STRING detail = mgException->GetDetails();
+ MgStringCollection args;
+ args.Add(resource->ToString());
+ STRING qualifiedClassName;
+ qualifiedClassName += schemaName;
+ qualifiedClassName += L":";
+ qualifiedClassName += className;
+ args.Add(qualifiedClassName);
+ args.Add(L"MgDuplicateObjectException"); //NOXLATE
+ args.Add(detail);
+
+ mgException = NULL;
+ mgException = new MgFeatureServiceException(L"MgdDescribeSchema.GetIdentityProperties", __LINE__, __WFILE__, NULL, L"MgFeatureSourceFormatInnerExceptionMessage", &args);
+ }
+ }
+
+ MG_FEATURE_SERVICE_THROW()
+
return idProps.Detach();
}
More information about the mapguide-commits
mailing list