Search in sources :

Example 1 with XmlSchemaAttributeOrGroupRef

use of org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef in project tomee by apache.

the class SchemaCollection method addCrossImportsAttributeList.

private void addCrossImportsAttributeList(XmlSchema schema, List<XmlSchemaAttributeOrGroupRef> list) {
    for (XmlSchemaAttributeOrGroupRef attr : list) {
        final QName ref;
        if (attr instanceof XmlSchemaAttribute) {
            ref = ((XmlSchemaAttribute) attr).getRef().getTargetQName();
        } else {
            XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef) attr;
            ref = groupRef.getRef().getTargetQName();
        }
        if (ref != null) {
            XmlSchemaUtils.addImportIfNeeded(schema, ref);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef) XmlSchemaAttributeGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)

Example 2 with XmlSchemaAttributeOrGroupRef

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

the class XmlSchemaUtils method getContentAttributes.

public static List<XmlSchemaAnnotated> getContentAttributes(XmlSchemaComplexType type, SchemaCollection collection) {
    List<XmlSchemaAnnotated> results = new ArrayList<>();
    QName baseTypeName = getBaseType(type);
    if (baseTypeName != null) {
        XmlSchemaComplexType baseType = (XmlSchemaComplexType) collection.getTypeByQName(baseTypeName);
        // recurse onto the base type ...
        results.addAll(getContentAttributes(baseType, collection));
        // and now process our sequence.
        List<XmlSchemaAttributeOrGroupRef> extAttrs = getContentAttributes(type);
        results.addAll(extAttrs);
        return results;
    }
    // no base type, the simple case.
    List<XmlSchemaAttributeOrGroupRef> attrs = type.getAttributes();
    results.addAll(attrs);
    return results;
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) XmlSchemaAnnotated(org.apache.ws.commons.schema.XmlSchemaAnnotated) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef)

Example 3 with XmlSchemaAttributeOrGroupRef

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

the class WSDLToCorbaHelper method processAttributesAsMembers.

protected List<MemberType> processAttributesAsMembers(List<XmlSchemaAttributeOrGroupRef> list, String uri) throws Exception {
    QName memName = null;
    List<MemberType> members = new ArrayList<>();
    for (XmlSchemaAttributeOrGroupRef aog : list) {
        if (!(aog instanceof XmlSchemaAttribute)) {
            LOG.warning(aog.getClass() + " not supported in CORBA binding.  Skipping.");
            continue;
        }
        XmlSchemaAttribute attribute = (XmlSchemaAttribute) aog;
        QName attrName = attribute.getQName();
        if (attrName.getNamespaceURI().isEmpty()) {
            attrName = new QName(uri, attrName.getLocalPart());
        }
        CorbaType membertype = null;
        boolean attrQualified = getAttributeQualification(attribute, uri);
        if (attribute.getUse() == XmlSchemaUse.NONE || attribute.getUse() == XmlSchemaUse.OPTIONAL) {
            if (attribute.getSchemaType() != null) {
                // REVISIT, edell bug in XmlSchema 1.2.
                // https://issues.apache.org/jira/browse/WSCOMMONS-208
                CorbaType attType = convertSchemaToCorbaType(attribute.getSchemaType(), checkPrefix(attrName), attribute.getSchemaType(), null, true);
                if (attType != null) {
                    QName typeName = attType.getQName();
                    if (!isDuplicate(attType)) {
                        typeMappingType.getStructOrExceptionOrUnion().add(attType);
                    }
                    QName name = createQNameTargetNamespace(typeName.getLocalPart() + "_nil");
                    membertype = createNillableUnion(name, checkPrefix(attrName), createQNameCorbaNamespace(typeName.getLocalPart()), attrQualified);
                }
            } else {
                CorbaType attType = processPrimitiveType(attribute.getSchemaTypeName());
                // {http://www.w3.org/2005/08/addressing}RelationshipTypeOpenEnum
                if (attType != null) {
                    QName name = createQNameTargetNamespace(attType.getQName().getLocalPart() + "_nil");
                    // REVISIT, Edell - bug in Xmlschema 1.2
                    // https://issues.apache.org/jira/browse/WSCOMMONS-208
                    membertype = createNillableUnion(name, checkPrefix(attrName), attType.getQName(), attrQualified);
                }
            }
            if (membertype != null) {
                memName = createQNameCorbaNamespace(membertype.getQName().getLocalPart());
                if (!isDuplicate(membertype)) {
                    typeMappingType.getStructOrExceptionOrUnion().add(membertype);
                }
            }
        } else {
            if (attribute.getSchemaType() != null) {
                membertype = convertSchemaToCorbaType(attribute.getSchemaType(), attrName, attribute.getSchemaType(), null, false);
            } else {
                membertype = processPrimitiveType(attribute.getSchemaTypeName());
            }
        }
        if (membertype != null) {
            MemberType member;
            String memberName = attrName.getLocalPart();
            member = new MemberType();
            member.setName(memberName);
            if (memName != null) {
                member.setIdltype(memName);
            } else {
                member.setIdltype(membertype.getQName());
            }
            if (attrQualified) {
                member.setQualified(true);
            }
            members.add(member);
        } else {
            String msg = "Unsupported Attribute Found in CORBA Binding Generation:" + attrName;
            LOG.log(Level.WARNING, msg);
        }
    }
    return members;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef)

Example 4 with XmlSchemaAttributeOrGroupRef

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

the class SchemaCollection method addCrossImportsAttributeList.

private void addCrossImportsAttributeList(XmlSchema schema, List<XmlSchemaAttributeOrGroupRef> list) {
    for (XmlSchemaAttributeOrGroupRef attr : list) {
        final QName ref;
        if (attr instanceof XmlSchemaAttribute) {
            ref = ((XmlSchemaAttribute) attr).getRef().getTargetQName();
        } else {
            XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef) attr;
            ref = groupRef.getRef().getTargetQName();
        }
        if (ref != null) {
            XmlSchemaUtils.addImportIfNeeded(schema, ref);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef) XmlSchemaAttributeGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)

Aggregations

QName (javax.xml.namespace.QName)4 XmlSchemaAttributeOrGroupRef (org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef)4 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)3 ArrayList (java.util.ArrayList)2 XmlSchemaAttributeGroupRef (org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)2 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)1 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)1 XmlSchemaAnnotated (org.apache.ws.commons.schema.XmlSchemaAnnotated)1 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)1