[mapguide-commits] r9157 - in sandbox/jng/clean_json: Common/PlatformBase/Services UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Apr 19 09:00:47 PDT 2017
Author: jng
Date: 2017-04-19 09:00:47 -0700 (Wed, 19 Apr 2017)
New Revision: 9157
Modified:
sandbox/jng/clean_json/Common/PlatformBase/Services/ClassDefinition.cpp
sandbox/jng/clean_json/Common/PlatformBase/Services/FeatureSchemaCollection.cpp
sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/describeschemaform.html
sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getclassdefinitionform.html
sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.cpp
sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.h
sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.cpp
sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.h
sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.cpp
sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.h
Log:
- Fix typo in simple class definition XML
- Fix IsIdentity not being written out to the simple XML
- Add missing XML prolog in Feature Schema Collection simple XML
- Update DESCRIBESCHEMA and GETCLASSDEFINITION operations to support a new SIMPLE flag that will instruct the operation to request the simplified XML of the requested schema or class definition instead of the normal verbose FDO schema XML
- Update respective test forms to include the new SIMPLE flag
Modified: sandbox/jng/clean_json/Common/PlatformBase/Services/ClassDefinition.cpp
===================================================================
--- sandbox/jng/clean_json/Common/PlatformBase/Services/ClassDefinition.cpp 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Common/PlatformBase/Services/ClassDefinition.cpp 2017-04-19 16:00:47 UTC (rev 9157)
@@ -278,6 +278,7 @@
xml.append(L"<Properties>");
Ptr<MgPropertyDefinitionCollection> props = GetProperties();
+ Ptr<MgPropertyDefinitionCollection> idProps = GetIdentityProperties();
INT32 pcount = props->GetCount();
for (INT32 i = 0; i < pcount; i++)
{
@@ -307,6 +308,10 @@
MgGeometricPropertyDefinition* gpd = dynamic_cast<MgGeometricPropertyDefinition*>(pdef.p);
MgRasterPropertyDefinition* rpd = dynamic_cast<MgRasterPropertyDefinition*>(pdef.p);
+ xml.append(L"<IsIdentity>");
+ xml.append((idProps->IndexOf(pdef->GetName()) >= 0) ? L"true" : L"false");
+ xml.append(L"</IsIdentity>");
+
if (NULL != dpd)
{
xml.append(L"<DataType>");
@@ -355,7 +360,7 @@
xml.append(gpd->GetReadOnly() ? L"true" : L"false");
xml.append(L"</ReadOnly>");
- xml.append(L"<SpatialContextAssocation>");
+ xml.append(L"<SpatialContextAssociation>");
xml.append(gpd->GetSpatialContextAssociation());
xml.append(L"</SpatialContextAssociation>");
@@ -397,7 +402,7 @@
xml.append(rpd->GetReadOnly() ? L"true" : L"false");
xml.append(L"</ReadOnly>");
- xml.append(L"<SpatialContextAssocation>");
+ xml.append(L"<SpatialContextAssociation>");
xml.append(rpd->GetSpatialContextAssociation());
xml.append(L"</SpatialContextAssociation>");
Modified: sandbox/jng/clean_json/Common/PlatformBase/Services/FeatureSchemaCollection.cpp
===================================================================
--- sandbox/jng/clean_json/Common/PlatformBase/Services/FeatureSchemaCollection.cpp 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Common/PlatformBase/Services/FeatureSchemaCollection.cpp 2017-04-19 16:00:47 UTC (rev 9157)
@@ -202,7 +202,8 @@
void MgFeatureSchemaCollection::ToSimpleXml(std::string & str)
{
- str = "<FeatureSchemaCollection xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FeatureSchemaCollection-3.3.0.xsd\">";
+ str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
+ str.append("<FeatureSchemaCollection xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FeatureSchemaCollection-3.3.0.xsd\">");
INT32 fcount = GetCount();
for (INT32 i = 0; i < fcount; i++)
Modified: sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/describeschemaform.html
===================================================================
--- sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/describeschemaform.html 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/describeschemaform.html 2017-04-19 16:00:47 UTC (rev 9157)
@@ -32,6 +32,8 @@
<p>
Clean JSON: <input type="text" name="CLEAN" value="0" ID="TextClean">
<p>
+ Simple: <input type="text" name="SIMPLE" value="0" ID="TextSimple">
+ <p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
</body>
Modified: sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getclassdefinitionform.html
===================================================================
--- sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getclassdefinitionform.html 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/UnitTest/WebTier/MapAgent/MapAgentForms/getclassdefinitionform.html 2017-04-19 16:00:47 UTC (rev 9157)
@@ -32,6 +32,8 @@
<p>
Clean JSON: <input type="text" name="CLEAN" value="0" ID="TextClean">
<p>
+ Simple: <input type="text" name="SIMPLE" value="0" ID="TextSimple">
+ <p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
</body>
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.cpp 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.cpp 2017-04-19 16:00:47 UTC (rev 9157)
@@ -41,6 +41,14 @@
m_schemaName = params->GetParameterValue(MgHttpResourceStrings::reqFeatSchema);
m_classNames = MgStringCollection::ParseCollection(
params->GetParameterValue(MgHttpResourceStrings::reqFeatClassNames), L".");
+
+ m_bSimple = false;
+ // Get simple flag (SIMPLE)
+ STRING simple = params->GetParameterValue(MgHttpResourceStrings::reqFeatSimple);
+ if (simple.length() > 0)
+ {
+ m_bSimple = (simple == L"1");
+ }
}
/// <summary>
@@ -64,13 +72,24 @@
// Create Proxy Feature Service instance
Ptr<MgFeatureService> service = (MgFeatureService*)(CreateService(MgServiceType::FeatureService));
- // Call the C++ API.
- STRING xmlSchema = service->DescribeSchemaAsXml(m_resource, m_schemaName, m_classNames);
-
- // Convert to multibyte
string mbXmlSchema;
- MgUtil::WideCharToMultiByte(xmlSchema, mbXmlSchema);
+ if (m_bSimple)
+ {
+ // Call the C++ API.
+ Ptr<MgFeatureSchemaCollection> schemas = service->DescribeSchema(m_resource, m_schemaName, m_classNames);
+ // Get the simple XML
+ schemas->ToSimpleXml(mbXmlSchema);
+ }
+ else
+ {
+ // Call the C++ API.
+ STRING xmlSchema = service->DescribeSchemaAsXml(m_resource, m_schemaName, m_classNames);
+
+ // Convert to multibyte
+ MgUtil::WideCharToMultiByte(xmlSchema, mbXmlSchema);
+ }
+
// Create a byte reader.
Ptr<MgByteReader> byteReader = MgUtil::GetByteReader(mbXmlSchema, (STRING*)&MgMimeType::Xml);
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.h
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.h 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpDescribeSchema.h 2017-04-19 16:00:47 UTC (rev 9157)
@@ -47,6 +47,7 @@
Ptr<MgResourceIdentifier> m_resource;
STRING m_schemaName;
Ptr<MgStringCollection> m_classNames;
+ bool m_bSimple;
};
#endif // HTTPDESCRIBESCHEMA_H_
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.cpp 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.cpp 2017-04-19 16:00:47 UTC (rev 9157)
@@ -36,6 +36,14 @@
Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
m_resId = params->GetParameterValue(MgHttpResourceStrings::reqFeatResourceId);
+
+ m_bSimple = false;
+ // Get simple flag (SIMPLE)
+ STRING simple = params->GetParameterValue(MgHttpResourceStrings::reqFeatSimple);
+ if (simple.length() > 0)
+ {
+ m_bSimple = (simple == L"1");
+ }
}
/// <summary>
@@ -66,8 +74,16 @@
// call the C++ APIs
Ptr<MgClassDefinition> classDef = service->GetClassDefinition(&resId, schema, className);
string xml;
- classDef->ToXml(xml);
+ if (m_bSimple)
+ {
+ classDef->ToSimpleXml(xml, true);
+ }
+ else
+ {
+ classDef->ToXml(xml);
+ }
+
// Create a byte reader.
Ptr<MgByteReader> byteReader = MgUtil::GetByteReader(xml, (STRING*)&MgMimeType::Xml);
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.h
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.h 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpGetClassDefinition.h 2017-04-19 16:00:47 UTC (rev 9157)
@@ -45,6 +45,7 @@
private:
STRING m_resId;
+ bool m_bSimple;
};
#endif // _FS_GET_CLASS_DEFINITION_H
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-04-19 16:00:47 UTC (rev 9157)
@@ -153,6 +153,7 @@
const STRING MgHttpResourceStrings::reqFeatActiveOnly = L"ACTIVEONLY";
const STRING MgHttpResourceStrings::reqFeatComputedProperties = L"COMPUTED_PROPERTIES";
const STRING MgHttpResourceStrings::reqFeatComputedAliases = L"COMPUTED_ALIASES";
+const STRING MgHttpResourceStrings::reqFeatSimple = L"SIMPLE";
// Feature Service Operation Requests
const STRING MgHttpResourceStrings::opGetFeatureProviders = L"GETFEATUREPROVIDERS";
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.h
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.h 2017-04-19 15:27:47 UTC (rev 9156)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/HttpResourceStrings.h 2017-04-19 16:00:47 UTC (rev 9157)
@@ -128,6 +128,7 @@
static const STRING reqFeatActiveOnly;
static const STRING reqFeatComputedProperties;
static const STRING reqFeatComputedAliases;
+ static const STRING reqFeatSimple;
// PREDEFINED DRAWING REQUEST PARAMETERS
static const STRING reqDrawingResourceId;
More information about the mapguide-commits
mailing list