private TypeDescriptor getArrayType()

in taverna-wsdl-generic/src/main/java/org/apache/taverna/wsdl/parser/TypeDescriptors.java [535:602]


    private TypeDescriptor getArrayType(XmlSchemaAttributeGroupMember attribute) {
        if (attribute instanceof XmlSchemaAttribute) {
            XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute)attribute;
            QName attrName;
            if (xmlSchemaAttribute.isRef()) {
                XmlSchemaRef<XmlSchemaAttribute> xmlSchemaRef = xmlSchemaAttribute.getRef();

                attrName = xmlSchemaRef.getTargetQName();
                if (attrName == null) {
                    XmlSchemaAttribute xmlSchemaRefAttribute = xmlSchemaRef.getTarget();
                    attrName = xmlSchemaRefAttribute.getWireName();
                }
            } else {
                    attrName = xmlSchemaAttribute.getWireName();
            }

            if (SOAPConstants.URI_NS_SOAP_ENCODING.equals(attrName.getNamespaceURI()) &&
                "arrayType".equals(attrName.getLocalPart())) {

                Attr[] unhandled = xmlSchemaAttribute.getUnhandledAttributes();

                String arrayType = null;
                for (Attr attr : unhandled) {
                    if ("arrayType".equals(attr.getLocalName())) {
                        if (SOAPConstants.URI_NS_SOAP_ENCODING.equals(attr.getNamespaceURI())) {
                            arrayType = attr.getValue();
                            break;
                        }
                        if ("http://schemas.xmlsoap.org/wsdl/".equals(attr.getNamespaceURI())) {
                            arrayType = attr.getValue();
                        }
                    }
                }

                if (arrayType != null) {
                    QName arrayTypeQName = getArrayTypeQName(arrayType);

                    if (arrayTypeQName.getNamespaceURI() == null || arrayTypeQName.getNamespaceURI().isEmpty())
                    {
                        String namespace = xmlSchemaAttribute.getParent().getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
                        arrayTypeQName = new QName(namespace, arrayTypeQName.getLocalPart());
                    }
                    return getTypeDescriptor(arrayTypeQName);
                }
            }
        }
        else {
            XmlSchemaAttributeGroup xmlSchemaAttributeGroup;
            if (attribute instanceof XmlSchemaAttributeGroup) {
                xmlSchemaAttributeGroup = (XmlSchemaAttributeGroup)attribute;
            }
            else {
                XmlSchemaAttributeGroupRef xmlSchemaAttributeGroupRef = (XmlSchemaAttributeGroupRef)attribute;
                XmlSchemaRef<XmlSchemaAttributeGroup> xmlSchemaRef = xmlSchemaAttributeGroupRef.getRef();
                xmlSchemaAttributeGroup = xmlSchemaRef.getTarget();
            }

            List<XmlSchemaAttributeGroupMember> xmlSchemaAttributeGroupMembers = xmlSchemaAttributeGroup.getAttributes();
            for (XmlSchemaAttributeGroupMember xmlSchemaAttributeGroupMember : xmlSchemaAttributeGroupMembers) {
                TypeDescriptor arrayTypeDesc = getArrayType(xmlSchemaAttributeGroupMember);
                if (arrayTypeDesc != null) {
                    return arrayTypeDesc;
                }
            }
        }

        return null;
    }