Search in sources :

Example 41 with XmlSchemaElement

use of org.apache.ws.commons.schema.XmlSchemaElement 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(Wfs10Constants.GML_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, Wfs10Constants.GML_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 42 with XmlSchemaElement

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

the class FeatureMetacardTypeTest method testFeatureMetacardTypeMultipleStringProperties.

@Test
public void testFeatureMetacardTypeMultipleStringProperties() {
    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 stringElement2 = new XmlSchemaElement(schema, true);
    stringElement2.setSchemaType(new XmlSchemaSimpleType(schema, false));
    stringElement2.setSchemaTypeName(Constants.XSD_STRING);
    stringElement2.setName(ELEMENT_NAME_2);
    schema.getElements().put(new QName(ELEMENT_NAME_1), stringElement);
    schema.getElements().put(new QName(ELEMENT_NAME_2), stringElement2);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
    assertTrue(featureMetacardType.getTextualProperties().size() == 2);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.STRING_TYPE);
    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 43 with XmlSchemaElement

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

the class FeatureMetacardTypeTest method testFeatureMetacardTypeFindTaxonomyMetacardAttributes.

@Test
public void testFeatureMetacardTypeFindTaxonomyMetacardAttributes() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement element = new XmlSchemaElement(schema, true);
    element.setSchemaType(new XmlSchemaSimpleType(schema, false));
    element.setSchemaTypeName(Constants.XSD_STRING);
    element.setName(ELEMENT_NAME);
    schema.getElements().put(new QName(ELEMENT_NAME), element);
    FeatureMetacardType fmt = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
    Set<AttributeDescriptor> descriptors = initDescriptors();
    for (AttributeDescriptor ad : descriptors) {
        assertBasicAttributeDescriptor(fmt, ad.getName(), ad.getType());
        assertFalse(fmt.getAttributeDescriptor(ad.getName()).isStored());
    }
    // +1 to account for one element added to schema.
    assertThat(fmt.getAttributeDescriptors().size(), is(descriptors.size() + 1));
}
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) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 44 with XmlSchemaElement

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

the class FeatureMetacardType method processXmlSchema.

private void processXmlSchema(XmlSchema schema) {
    Map<QName, XmlSchemaElement> elements = schema.getElements();
    Iterator<XmlSchemaElement> xmlSchemaElementIterator = elements.values().iterator();
    while (xmlSchemaElementIterator.hasNext()) {
        Object o = xmlSchemaElementIterator.next();
        XmlSchemaElement element = (XmlSchemaElement) o;
        XmlSchemaType schemaType = element.getSchemaType();
        if (schemaType instanceof XmlSchemaComplexType) {
            processComplexType(element);
        } else if (schemaType instanceof XmlSchemaSimpleType) {
            processSimpleType(element);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 45 with XmlSchemaElement

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

the class TestGenericFeatureConverter method buildStatesElementMap.

private Map<QName, XmlSchemaElement> buildStatesElementMap(XmlSchema schema) {
    Map<QName, XmlSchemaElement> elementMap = new HashMap<QName, XmlSchemaElement>();
    elementMap.put(new QName(STATES_TITLE_ELEMENT), buildSchemaElement(STATES_TITLE_ELEMENT, schema, Constants.XSD_STRING));
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName("the_geom");
    elementMap.put(new QName("the_geom"), gmlElement);
    return elementMap;
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Aggregations

XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)52 QName (javax.xml.namespace.QName)38 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)36 XmlSchema (org.apache.ws.commons.schema.XmlSchema)35 Test (org.junit.Test)33 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)32 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)23 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)7 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)6 Iterator (java.util.Iterator)6 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)6 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)6 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)6 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)6 ArrayList (java.util.ArrayList)5 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)5 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)4 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)4 HashMap (java.util.HashMap)3 XmlSchemaAny (org.apache.ws.commons.schema.XmlSchemaAny)3