Search in sources :

Example 1 with XmlSchemaSimpleContent

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

the class WSDLToCorbaHelper method processStruct.

private CorbaType processStruct(XmlSchemaComplexType complex, QName defaultName) throws Exception {
    QName name;
    Struct corbaStruct = null;
    QName schematypeName = checkPrefix(complex.getQName());
    if (schematypeName == null) {
        schematypeName = createQNameTargetNamespace(defaultName.getLocalPart());
        if (defaultName.getNamespaceURI().equals("")) {
            schematypeName = checkPrefix(schematypeName);
        } else {
            schematypeName = checkPrefix(defaultName);
        }
        name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));
    } else {
        name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));
    }
    corbaStruct = (Struct) recursionMap.get(name);
    if (corbaStruct != null) {
        return corbaStruct;
    }
    corbaStruct = new Struct();
    corbaStruct.setName(name.getLocalPart());
    corbaStruct.setQName(name);
    String repoId = REPO_STRING + name.getLocalPart().replace('.', '/') + IDL_VERSION;
    corbaStruct.setRepositoryID(repoId);
    corbaStruct.setType(schematypeName);
    recursionMap.put(name, corbaStruct);
    if (complex.getContentModel() instanceof XmlSchemaSimpleContent) {
        corbaStruct = processSimpleContentStruct((XmlSchemaSimpleContent) complex.getContentModel(), defaultName, corbaStruct, schematypeName);
    } else if (complex.getContentModel() instanceof XmlSchemaComplexContent) {
        corbaStruct = processComplexContentStruct((XmlSchemaComplexContent) complex.getContentModel(), defaultName, corbaStruct, schematypeName);
    }
    // Process attributes at ComplexType level
    if (!complex.getAttributes().isEmpty()) {
        String uri;
        if (schematypeName != null) {
            uri = schematypeName.getNamespaceURI();
        } else {
            uri = defaultName.getNamespaceURI();
        }
        List<MemberType> attlist2 = processAttributesAsMembers(complex.getAttributes(), uri);
        for (int i = 0; i < attlist2.size(); i++) {
            MemberType member = attlist2.get(i);
            corbaStruct.getMember().add(member);
        }
    }
    if (complex.getParticle() != null) {
        List<MemberType> members = processContainerAsMembers(complex.getParticle(), defaultName, schematypeName);
        for (MemberType memberType : members) {
            corbaStruct.getMember().add(memberType);
        }
    }
    recursionMap.remove(name);
    return corbaStruct;
}
Also used : XmlSchemaSimpleContent(org.apache.ws.commons.schema.XmlSchemaSimpleContent) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType) QName(javax.xml.namespace.QName) XmlSchemaComplexContent(org.apache.ws.commons.schema.XmlSchemaComplexContent) Struct(org.apache.cxf.binding.corba.wsdl.Struct)

Aggregations

QName (javax.xml.namespace.QName)1 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)1 Struct (org.apache.cxf.binding.corba.wsdl.Struct)1 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)1 XmlSchemaSimpleContent (org.apache.ws.commons.schema.XmlSchemaSimpleContent)1