Search in sources :

Example 6 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project tomee by apache.

the class CommonsSchemaInfoBuilder method buildXmlTypeInfos.

private void buildXmlTypeInfos() {
    for (XmlSchema schema : xmlSchemaCollection.getXmlSchemas()) {
        // Global Elements
        for (Iterator iterator = schema.getElements().getValues(); iterator.hasNext(); ) {
            XmlSchemaElement globalElement = (XmlSchemaElement) iterator.next();
            addGlobalElement(globalElement);
        }
        // Global Types
        for (Iterator iterator = schema.getSchemaTypes().getValues(); iterator.hasNext(); ) {
            XmlSchemaType globalType = (XmlSchemaType) iterator.next();
            addType(globalType.getQName(), globalType);
        }
    }
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Iterator(java.util.Iterator) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 7 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindSingleGmlProperty.

@Test
public void testfeatureMetacardTypeFindSingleGmlProperty() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getGmlProperties().size() == 1);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.GEO_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 8 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testFeatureMetacardTypeSingleStringProperty.

@Test
public void testFeatureMetacardTypeSingleStringProperty() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
    stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    stringElement.setSchemaTypeName(Constants.XSD_STRING);
    stringElement.setName(ELEMENT_NAME_1);
    schema.getElements().put(new QName(ELEMENT_NAME_1), stringElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getTextualProperties().size() == 1);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.STRING_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 9 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testFeatureMetacardTypeStringAndGmlProperties.

@Test
public void testFeatureMetacardTypeStringAndGmlProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
    stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    stringElement.setSchemaTypeName(Constants.XSD_STRING);
    stringElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_2);
    schema.getElements().put(new QName(ELEMENT_NAME_1), stringElement);
    schema.getElements().put(new QName(ELEMENT_NAME_2), gmlElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getTextualProperties().size() == 1);
    assertTrue(featureMetacardType.getGmlProperties().size() == 1);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.STRING_TYPE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.GEO_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 10 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindDoubleProperties.

@Test
public void testfeatureMetacardTypeFindDoubleProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement doubleElement = new XmlSchemaElement(schema, true);
    doubleElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    doubleElement.setSchemaTypeName(Constants.XSD_DOUBLE);
    doubleElement.setName(ELEMENT_NAME_1);
    schema.getElements().put(new QName(ELEMENT_NAME_1), doubleElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.DOUBLE_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Aggregations

XmlSchema (org.apache.ws.commons.schema.XmlSchema)51 QName (javax.xml.namespace.QName)37 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)37 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)35 Test (org.junit.Test)35 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)28 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)11 ArrayList (java.util.ArrayList)10 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)6 Iterator (java.util.Iterator)6 List (java.util.List)5 XmlSchemaCollection (org.apache.ws.commons.schema.XmlSchemaCollection)5 Map (java.util.Map)4 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)4 HashMap (java.util.HashMap)3 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)3 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)3 XmlSchemaObjectTable (org.apache.ws.commons.schema.XmlSchemaObjectTable)3 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)3 WfsException (org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsException)3