Search in sources :

Example 66 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType in project cxf by apache.

the class EnumVisitor method visit.

public void visit(AST enumNode) {
    // <enum_type> ::= "enum" <identifier> "{" <enumerator> {"," <enumerator>}* "}"
    // <enumerator> ::= <identifier>
    AST enumNameNode = enumNode.getFirstChild();
    Scope enumNameScope = new Scope(getScope(), enumNameNode);
    // xmlschema:enum
    XmlSchemaSimpleType enumSchemaSimpleType = new XmlSchemaSimpleType(schema, true);
    enumSchemaSimpleType.setName(mapper.mapToQName(enumNameScope));
    XmlSchemaSimpleTypeRestriction enumSchemaSimpleTypeRestriction = new XmlSchemaSimpleTypeRestriction();
    enumSchemaSimpleTypeRestriction.setBaseTypeName(Constants.XSD_STRING);
    // XmlSchemaSimpleTypeContent xmlSchemaSimpleTypeContent = enumSchemaSimpleTypeRestriction;
    enumSchemaSimpleType.setContent(enumSchemaSimpleTypeRestriction);
    // corba:enum
    Enum corbaEnum = new Enum();
    corbaEnum.setQName(new QName(typeMap.getTargetNamespace(), enumNameScope.toString()));
    corbaEnum.setRepositoryID(enumNameScope.toIDLRepositoryID());
    corbaEnum.setType(enumSchemaSimpleType.getQName());
    AST node = enumNameNode.getNextSibling();
    while (node != null) {
        // xmlschema:enumeration
        XmlSchemaEnumerationFacet enumeration = new XmlSchemaEnumerationFacet();
        enumeration.setValue(node.toString());
        enumSchemaSimpleTypeRestriction.getFacets().add(enumeration);
        // corba:enumerator
        Enumerator enumerator = new Enumerator();
        enumerator.setValue(node.toString());
        corbaEnum.getEnumerator().add(enumerator);
        node = node.getNextSibling();
    }
    // add corbaType
    typeMap.getStructOrExceptionOrUnion().add(corbaEnum);
    // REVISIT: are there assignments needed?
    setSchemaType(enumSchemaSimpleType);
    setCorbaType(corbaEnum);
}
Also used : Enum(org.apache.cxf.binding.corba.wsdl.Enum) AST(antlr.collections.AST) Enumerator(org.apache.cxf.binding.corba.wsdl.Enumerator) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) XmlSchemaSimpleTypeRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction) XmlSchemaEnumerationFacet(org.apache.ws.commons.schema.XmlSchemaEnumerationFacet)

Example 67 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType in project cxf by apache.

the class DeclaratorVisitor method duplicateXmlSchemaSimpleType.

private XmlSchemaSimpleType duplicateXmlSchemaSimpleType(Scope newScope) {
    XmlSchemaSimpleType oldSimpleType = (XmlSchemaSimpleType) getSchemaType();
    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, oldSimpleType.isTopLevel());
    simpleType.setContent(oldSimpleType.getContent());
    simpleType.setName(newScope.toString());
    return simpleType;
}
Also used : XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType)

Example 68 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType in project cxf by apache.

the class ParameterMapper method map.

public static JavaParameter map(JavaMethod jm, MessagePartInfo part, JavaType.Style style, ToolContext context) {
    String name = ProcessorUtil.mangleNameToVariableName(part.getName().getLocalPart());
    String namespace = ProcessorUtil.resolvePartNamespace(part);
    String type = ProcessorUtil.resolvePartType(part, context);
    JavaParameter parameter = new JavaParameter(name, type, namespace);
    parameter.setPartName(part.getName().getLocalPart());
    if (part.getXmlSchema() instanceof XmlSchemaSimpleType) {
        processXmlSchemaSimpleType((XmlSchemaSimpleType) part.getXmlSchema(), jm, parameter, part);
    } else if (part.getXmlSchema() instanceof XmlSchemaElement) {
        XmlSchemaElement element = (XmlSchemaElement) part.getXmlSchema();
        if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
            processXmlSchemaSimpleType((XmlSchemaSimpleType) element.getSchemaType(), jm, parameter, part);
        }
    }
    parameter.setQName(ProcessorUtil.getElementName(part));
    parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriter(part, context));
    String fullJavaName = ProcessorUtil.getFullClzName(part, context, false);
    parameter.setClassName(fullJavaName);
    if (style == JavaType.Style.INOUT || style == JavaType.Style.OUT) {
        parameter.setHolder(true);
        parameter.setHolderName(javax.xml.ws.Holder.class.getName());
        String holderClass = fullJavaName;
        if (JAXBUtils.holderClass(fullJavaName) != null) {
            holderClass = JAXBUtils.holderClass(fullJavaName).getName();
        }
        parameter.setClassName(holderClass);
    }
    parameter.setStyle(style);
    return parameter;
}
Also used : XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) JavaParameter(org.apache.cxf.tools.common.model.JavaParameter)

Example 69 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType in project cxf by apache.

the class WSDLToCorbaHelper method convertSchemaToCorbaType.

public CorbaType convertSchemaToCorbaType(XmlSchemaType stype, QName defaultName, XmlSchemaType parent, XmlSchemaAnnotation annotation, boolean anonymous) throws Exception {
    CorbaType corbaTypeImpl = null;
    if (!isAddressingNamespace(stype.getQName())) {
        // need to determine if its a primitive type.
        if (stype instanceof XmlSchemaComplexType) {
            corbaTypeImpl = processComplexType((XmlSchemaComplexType) stype, defaultName, annotation, anonymous);
        } else if (stype instanceof XmlSchemaSimpleType) {
            corbaTypeImpl = processSimpleType((XmlSchemaSimpleType) stype, defaultName, anonymous);
        } else if (xmlSchemaList.getElementByQName(stype.getQName()) != null) {
            XmlSchemaElement el = xmlSchemaList.getElementByQName(stype.getQName());
            // REVISIT, passing ns uri because of a bug in XmlSchema (Bug: WSCOMMONS-69)
            corbaTypeImpl = processElementType(el, defaultName, stype.getQName().getNamespaceURI());
        } else {
            throw new Exception("Couldn't convert schema " + stype.getQName() + " to corba type");
        }
    }
    if (corbaTypeImpl != null && !isDuplicate(corbaTypeImpl)) {
        typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
    }
    return corbaTypeImpl;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Aggregations

XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)69 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)47 QName (javax.xml.namespace.QName)46 XmlSchema (org.apache.ws.commons.schema.XmlSchema)31 Test (org.junit.Test)27 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)26 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)21 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)14 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)11 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)10 ArrayList (java.util.ArrayList)8 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)8 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)8 XmlSchemaSimpleTypeList (org.apache.ws.commons.schema.XmlSchemaSimpleTypeList)8 XmlSchemaSimpleTypeRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction)8 List (java.util.List)7 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)7 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)6 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)4 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)4