in taverna-wsdl-generic/src/main/java/org/apache/taverna/wsdl/parser/TypeDescriptors.java [255:337]
private TypeDescriptor getComplexTypeDescriptor(XmlSchemaComplexType xmlSchemaComplexType) {
ComplexTypeDescriptor typeDesc = new ComplexTypeDescriptor();
List<XmlSchemaAttributeOrGroupRef> attributes = xmlSchemaComplexType.getAttributes();
for (XmlSchemaAttributeOrGroupRef attribute : attributes) {
// all XmlSchemaAttributeOrGroupRef descendants are XmlSchemaAttributeGroupMember
addAttributeTypeDescriptors(typeDesc.getAttributes(), (XmlSchemaAttributeGroupMember)attribute);
}
XmlSchemaContentModel xmlSchemaContentModel = xmlSchemaComplexType.getContentModel();
if (xmlSchemaContentModel != null) {
XmlSchemaContent content = xmlSchemaContentModel.getContent();
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension complexContentExtension = (XmlSchemaComplexContentExtension)content;
attributes = complexContentExtension.getAttributes();
XmlSchemaParticle particle = complexContentExtension.getParticle();
addElementTypeDescriptors(typeDesc.getElements(), particle);
QName baseTypeName = complexContentExtension.getBaseTypeName();
if (baseTypeName != null) {
TypeDescriptor baseTypeDesc = getTypeDescriptor(baseTypeName);
if (baseTypeDesc instanceof ComplexTypeDescriptor) {
ComplexTypeDescriptor base = (ComplexTypeDescriptor)baseTypeDesc;
typeDesc.getElements().addAll(base.getElements());
}
}
} else if (content instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction complexContentRestriction = (XmlSchemaComplexContentRestriction)content;
attributes = complexContentRestriction.getAttributes();
// check for "SOAP Encoding"
QName baseTypeName = complexContentRestriction.getBaseTypeName();
if (baseTypeName != null) {
TypeDescriptor baseTypeDesc = getTypeDescriptor(baseTypeName);
if (baseTypeDesc instanceof ArrayTypeDescriptor) {
ArrayTypeDescriptor arrayDesc = (ArrayTypeDescriptor)baseTypeDesc;
TypeDescriptor arrayTypeDesc = getArrayType(attributes);
arrayDesc.setElementType(arrayTypeDesc);
return arrayDesc;
}
}
XmlSchemaParticle particle = complexContentRestriction.getParticle();
addElementTypeDescriptors(typeDesc.getElements(), particle);
} else if (content instanceof XmlSchemaSimpleContentExtension) {
XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension = (XmlSchemaSimpleContentExtension)content;
attributes = xmlSchemaSimpleContentExtension.getAttributes();
QName baseTypeName = xmlSchemaSimpleContentExtension.getBaseTypeName();
if (baseTypeName != null) {
TypeDescriptor baseTypeDesc = getTypeDescriptor(baseTypeName);
typeDesc.setType(baseTypeDesc.getType());
}
} else if (content instanceof XmlSchemaSimpleContentRestriction){
XmlSchemaSimpleContentRestriction xmlSchemaSimpleContentRestriction = (XmlSchemaSimpleContentRestriction)content;
attributes = xmlSchemaSimpleContentRestriction.getAttributes();
QName baseTypeName = xmlSchemaSimpleContentRestriction.getBaseTypeName();
if (baseTypeName == null) {
XmlSchemaSimpleType simpleType = xmlSchemaSimpleContentRestriction.getBaseType();
baseTypeName = simpleType.getQName();
}
TypeDescriptor baseTypeDesc = getTypeDescriptor(baseTypeName);
typeDesc.setType(baseTypeDesc.getType());
}
for (XmlSchemaAttributeOrGroupRef attribute : attributes) {
addAttributeTypeDescriptors(typeDesc.getAttributes(), (XmlSchemaAttributeGroupMember)attribute);
}
} else {
XmlSchemaParticle particle = xmlSchemaComplexType.getParticle();
addElementTypeDescriptors(typeDesc.getElements(), particle);
}
return typeDesc;
}