Search in sources :

Example 96 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 97 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 98 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)

Example 99 with XmlSchemaElement

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

the class TestGenericFeatureConverter method buildElementMap.

private Map<QName, XmlSchemaElement> buildElementMap(XmlSchema schema) {
    Map<QName, XmlSchemaElement> elementMap = new HashMap<QName, XmlSchemaElement>();
    elementMap.put(new QName(ID_ELEMENT), buildSchemaElement(ID_ELEMENT, schema, Constants.XSD_LONG));
    elementMap.put(new QName(VERSION_ELEMENT), buildSchemaElement(VERSION_ELEMENT, schema, Constants.XSD_LONG));
    elementMap.put(new QName(END_DATE_ELEMENT), buildSchemaElement(END_DATE_ELEMENT, schema, Constants.XSD_DATETIME));
    elementMap.put(new QName(FILENAME_ELEMENT), buildSchemaElement(FILENAME_ELEMENT, schema, Constants.XSD_STRING));
    elementMap.put(new QName(HEIGHT_ELEMENT), buildSchemaElement(HEIGHT_ELEMENT, schema, Constants.XSD_LONG));
    elementMap.put(new QName(INDEX_ID_ELEMENT), buildSchemaElement(INDEX_ID_ELEMENT, schema, Constants.XSD_STRING));
    elementMap.put(new QName(OTHER_TAGS_XML_ELEMENT), buildSchemaElement(OTHER_TAGS_XML_ELEMENT, schema, Constants.XSD_STRING));
    elementMap.put(new QName(REPOSITORY_ID_ELEMENT), buildSchemaElement(REPOSITORY_ID_ELEMENT, schema, Constants.XSD_LONG));
    elementMap.put(new QName(START_DATE_ELEMENT), buildSchemaElement(START_DATE_ELEMENT, schema, Constants.XSD_DATETIME));
    elementMap.put(new QName(STYLE_ID_ELEMENT), buildSchemaElement(STYLE_ID_ELEMENT, schema, Constants.XSD_DECIMAL));
    elementMap.put(new QName(WIDTH_ELEMENT), buildSchemaElement(WIDTH_ELEMENT, schema, Constants.XSD_LONG));
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(GROUND_GEOM_ELEMENT);
    elementMap.put(new QName(GROUND_GEOM_ELEMENT), 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)

Example 100 with XmlSchemaElement

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

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindDateProperties.

@Test
public void testfeatureMetacardTypeFindDateProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement dateElement = new XmlSchemaElement(schema, true);
    dateElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    dateElement.setSchemaTypeName(Constants.XSD_DATE);
    dateElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement dateTimeElement = new XmlSchemaElement(schema, true);
    dateTimeElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    dateTimeElement.setSchemaTypeName(Constants.XSD_DATETIME);
    dateTimeElement.setName(ELEMENT_NAME_2);
    schema.getElements().put(new QName(ELEMENT_NAME_1), dateElement);
    schema.getElements().put(new QName(ELEMENT_NAME_2), dateTimeElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.DATE_TYPE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.DATE_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

XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)164 QName (javax.xml.namespace.QName)100 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)59 XmlSchema (org.apache.ws.commons.schema.XmlSchema)54 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)51 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)42 Test (org.junit.Test)42 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)39 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)32 Message (org.apache.cxf.common.i18n.Message)15 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)15 XmlSchemaSequenceMember (org.apache.ws.commons.schema.XmlSchemaSequenceMember)14 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)13 ArrayList (java.util.ArrayList)12 JAXBBeanInfo (org.apache.cxf.common.jaxb.JAXBBeanInfo)12 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)12 Method (java.lang.reflect.Method)11 SchemaInfo (org.apache.cxf.service.model.SchemaInfo)11 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)10 Iterator (java.util.Iterator)9