Search in sources :

Example 21 with XmlSchemaElement

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

the class FeatureMetacardTypeTest method testFeatureMetacardTypeNonQueryGmlProperty.

@Test
public void testFeatureMetacardTypeNonQueryGmlProperty() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement2 = new XmlSchemaElement(schema, true);
    gmlElement2.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement2.setSchemaTypeName(new QName(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement2.setName(ELEMENT_NAME_2);
    List<String> nonQueryProps = new ArrayList<String>();
    nonQueryProps.add(ELEMENT_NAME_2);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, nonQueryProps, Wfs10Constants.GML_NAMESPACE);
    assertTrue(featureMetacardType.getGmlProperties().size() == 2);
    AttributeDescriptor attrDesc = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_1));
    assertNotNull(attrDesc);
    assertTrue(attrDesc.getType() == BasicTypes.GEO_TYPE);
    assertTrue(attrDesc.isIndexed());
    AttributeDescriptor attrDesc2 = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_2));
    assertNotNull(attrDesc2);
    assertTrue(attrDesc2.getType() == BasicTypes.GEO_TYPE);
    assertFalse(attrDesc2.isIndexed());
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 22 with XmlSchemaElement

use of org.apache.ws.commons.schema.XmlSchemaElement 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(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_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 23 with XmlSchemaElement

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

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

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindFloatProperties.

@Test
public void testfeatureMetacardTypeFindFloatProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement floatElement = new XmlSchemaElement(schema, true);
    floatElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    floatElement.setSchemaTypeName(Constants.XSD_FLOAT);
    floatElement.setName(ELEMENT_NAME_1);
    schema.getElements().put(new QName(ELEMENT_NAME_1), floatElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.FLOAT_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 25 with XmlSchemaElement

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

the class FeatureMetacardType method processXmlSchemaParticle.

private void processXmlSchemaParticle(XmlSchemaParticle particle) {
    XmlSchemaSequence schemaSequence;
    if (particle instanceof XmlSchemaSequence) {
        schemaSequence = (XmlSchemaSequence) particle;
        List<XmlSchemaSequenceMember> schemaObjectCollection = schemaSequence.getItems();
        Iterator<XmlSchemaSequenceMember> iterator = schemaObjectCollection.iterator();
        while (iterator.hasNext()) {
            Object element = iterator.next();
            if (element instanceof XmlSchemaElement) {
                XmlSchemaElement innerElement = ((XmlSchemaElement) element);
                XmlSchemaType innerEleType = innerElement.getSchemaType();
                if (innerEleType instanceof XmlSchemaComplexType) {
                    processComplexType(innerElement);
                } else if (innerEleType instanceof XmlSchemaSimpleType) {
                    processSimpleType(innerElement);
                } else if (innerEleType == null) {
                    // Check if this is the GML location Property
                    processGmlType(innerElement);
                }
            }
        }
    }
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaSequenceMember(org.apache.ws.commons.schema.XmlSchemaSequenceMember) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

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