use of org.apache.ws.commons.schema.XmlSchemaAll in project cxf by apache.
the class WSDLToCorbaHelper method processContainerAsMembers.
protected List<MemberType> processContainerAsMembers(XmlSchemaParticle particle, QName defaultName, QName schemaTypeName) throws Exception {
List<MemberType> members = new ArrayList<>();
Iterator<? extends XmlSchemaObjectBase> iterL = null;
if (particle instanceof XmlSchemaSequence) {
XmlSchemaSequence scontainer = (XmlSchemaSequence) particle;
iterL = scontainer.getItems().iterator();
} else if (particle instanceof XmlSchemaChoice) {
XmlSchemaChoice scontainer = (XmlSchemaChoice) particle;
iterL = scontainer.getItems().iterator();
} else if (particle instanceof XmlSchemaAll) {
XmlSchemaAll acontainer = (XmlSchemaAll) particle;
iterL = acontainer.getItems().iterator();
} else {
LOG.warning("Unknown particle type " + particle.getClass().getName());
iterL = new ArrayList<XmlSchemaObjectBase>().iterator();
}
while (iterL.hasNext()) {
XmlSchemaParticle container = (XmlSchemaParticle) iterL.next();
if (container instanceof XmlSchemaSequence) {
XmlSchemaSequence sequence = (XmlSchemaSequence) container;
CorbaType memberType = processSequenceType(sequence, defaultName, schemaTypeName);
QName typeName = memberType.getQName();
if (memberType instanceof Struct && !isDuplicate(memberType)) {
typeMappingType.getStructOrExceptionOrUnion().add(memberType);
}
MemberType member = new MemberType();
member.setName(memberType.getName() + "_f");
member.setIdltype(typeName);
member.setAnonschematype(true);
if (memberType.isSetQualified() && memberType.isQualified()) {
member.setQualified(true);
}
members.add(member);
} else if (container instanceof XmlSchemaChoice) {
XmlSchemaChoice choice = (XmlSchemaChoice) container;
MemberType member = processChoiceMember(choice, defaultName, schemaTypeName);
member.setAnonschematype(true);
members.add(member);
} else if (container instanceof XmlSchemaAll) {
XmlSchemaAll all = (XmlSchemaAll) container;
MemberType member = processAllMember(all, defaultName, schemaTypeName);
member.setAnonschematype(true);
members.add(member);
} else if (container instanceof XmlSchemaElement) {
XmlSchemaElement element = (XmlSchemaElement) container;
CorbaType corbatype = processLocalElement(defaultName, element, schemaTypeName.getNamespaceURI());
QName elName = element.getQName();
if (elName == null) {
elName = element.getRef().getTargetQName();
}
if (corbatype != null) {
MemberType member;
String memberName = elName.getLocalPart();
member = new MemberType();
member.setName(memberName);
member.setIdltype(corbatype.getQName());
if (corbatype.isSetQualified() && corbatype.isQualified()) {
member.setQualified(true);
}
members.add(member);
} else {
LOG.log(Level.WARNING, "Unsupported Element Found in CORBA Binding Generation:" + elName);
}
}
}
return members;
}
use of org.apache.ws.commons.schema.XmlSchemaAll in project cxf by apache.
the class SchemaCollection method addCrossImportsType.
private void addCrossImportsType(XmlSchema schema, XmlSchemaType schemaType) {
// the base type might cross schemas.
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType;
XmlSchemaUtils.addImportIfNeeded(schema, complexType.getBaseSchemaTypeName());
addCrossImports(schema, complexType.getContentModel());
addCrossImportsAttributeList(schema, complexType.getAttributes());
if (complexType.getParticle() instanceof XmlSchemaChoice) {
XmlSchemaChoice choice = (XmlSchemaChoice) complexType.getParticle();
addCrossImports(schema, choice);
} else if (complexType.getParticle() instanceof XmlSchemaAll) {
XmlSchemaAll all = (XmlSchemaAll) complexType.getParticle();
addCrossImports(schema, all);
} else if (complexType.getParticle() instanceof XmlSchemaSequence) {
XmlSchemaSequence sequence = (XmlSchemaSequence) complexType.getParticle();
addCrossImports(schema, sequence);
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaAll in project cxf by apache.
the class SchemaCollection method addCrossImports.
private void addCrossImports(XmlSchema schema, XmlSchemaContentModel contentModel) {
if (contentModel == null) {
return;
}
XmlSchemaContent content = contentModel.getContent();
if (content == null) {
return;
}
if (content instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
addCrossImportsAttributeList(schema, extension.getAttributes());
XmlSchemaParticle particle = extension.getParticle();
if (particle instanceof XmlSchemaSequence) {
addCrossImports(schema, (XmlSchemaSequence) particle);
} else if (particle instanceof XmlSchemaChoice) {
addCrossImports(schema, (XmlSchemaChoice) particle);
} else if (particle instanceof XmlSchemaAll) {
addCrossImports(schema, (XmlSchemaAll) particle);
}
} else if (content instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
addCrossImportsAttributeList(schema, restriction.getAttributes());
} else if (content instanceof XmlSchemaSimpleContentExtension) {
XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
addCrossImportsAttributeList(schema, extension.getAttributes());
} else if (content instanceof XmlSchemaSimpleContentRestriction) {
XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
addCrossImportsAttributeList(schema, restriction.getAttributes());
}
}
use of org.apache.ws.commons.schema.XmlSchemaAll in project wso2-axis2-transports by wso2.
the class XMPPSender method getParameterListForOperation.
/**
* Retrieves list of parameter names & their type for a given operation
* @param operation
*/
private static String getParameterListForOperation(AxisOperation operation) {
// Logic copied from BuilderUtil.buildsoapMessage(...)
StringBuffer paramList = new StringBuffer();
AxisMessage axisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
XmlSchemaElement xmlSchemaElement = axisMessage.getSchemaElement();
if (xmlSchemaElement != null) {
XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
XmlSchemaParticle particle = complexType.getParticle();
if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) particle;
Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();
while (iterator.hasNext()) {
XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
QName qName = innerElement.getQName();
if (qName == null && innerElement.getSchemaTypeName().equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
break;
}
long minOccurs = innerElement.getMinOccurs();
boolean nillable = innerElement.isNillable();
String name = qName != null ? qName.getLocalPart() : innerElement.getName();
String type = innerElement.getSchemaTypeName().toString();
paramList.append("," + type + " " + name);
}
}
}
}
// remove first ","
String list = paramList.toString();
return list.replaceFirst(",", "");
}
use of org.apache.ws.commons.schema.XmlSchemaAll in project cxf by apache.
the class WSDLToCorbaHelper method processComplexContentStructParticle.
private Struct processComplexContentStructParticle(XmlSchemaParticle extype, QName defaultName, Struct corbaStruct, QName schematypeName, QName extName, List<XmlSchemaAttributeOrGroupRef> list) throws Exception {
String uri;
if (schematypeName != null) {
uri = schematypeName.getNamespaceURI();
} else {
uri = defaultName.getNamespaceURI();
}
// Add base as a member of this struct
MemberType memberType = new MemberType();
memberType.setName(extName.getLocalPart() + "_f");
if (extName.getLocalPart().equals("anyType")) {
memberType.setIdltype(processPrimitiveType(extName).getQName());
} else {
memberType.setIdltype(createQNameCorbaNamespace(extName.getLocalPart()));
}
corbaStruct.getMember().add(memberType);
// process attributes at complexContent level
List<MemberType> attlist1 = processAttributesAsMembers(list, uri);
for (int i = 0; i < attlist1.size(); i++) {
MemberType member = attlist1.get(i);
corbaStruct.getMember().add(member);
}
// Process members of Current Type
if (extype instanceof XmlSchemaChoice) {
XmlSchemaChoice choice = (XmlSchemaChoice) extype;
MemberType choicemem = processComplexContentStructChoice(choice, schematypeName, defaultName);
choicemem.setAnonschematype(true);
corbaStruct.getMember().add(choicemem);
} else if (extype instanceof XmlSchemaSequence) {
XmlSchemaSequence seq = (XmlSchemaSequence) extype;
corbaStruct = processComplexContentStructSequence(corbaStruct, seq, defaultName, schematypeName);
} else if (extype instanceof XmlSchemaAll) {
XmlSchemaAll all = (XmlSchemaAll) extype;
corbaStruct = processComplexContentStructSchemaAll(corbaStruct, all, defaultName, schematypeName);
}
return corbaStruct;
}
Aggregations