use of org.apache.cxf.binding.corba.wsdl.Abstractsequence in project cxf by apache.
the class CorbaStructListener method processStartElement.
public void processStartElement(QName name) {
if (depth == 0 && (currentElement != null) && (!currentElement.equals(name))) {
currentTypeListener = null;
}
depth++;
if (currentTypeListener == null) {
QName elName = name;
MemberType member = null;
while (true) {
member = structMembers.get(memberCount++);
// members - we have a chance to "catch up" and add required (empty sequences) members
if (member.getName().equals(name.getLocalPart()) || (member.isSetAnonschematype() && member.isAnonschematype())) {
break;
}
currentTypeListener = CorbaHandlerUtils.getTypeListener(elName, member.getIdltype(), typeMap, orb, serviceInfo);
currentTypeListener.setNamespaceContext(ctx);
((CorbaStructHandler) handler).addMember(currentTypeListener.getCorbaObject());
}
boolean anonType = false;
if (member.isSetAnonschematype() && member.isAnonschematype()) {
anonType = true;
elName = CorbaUtils.getEmptyQName();
currentElement = null;
} else {
currentElement = name;
}
currentTypeListener = CorbaHandlerUtils.getTypeListener(elName, member.getIdltype(), typeMap, orb, serviceInfo);
currentTypeListener.setNamespaceContext(ctx);
((CorbaStructHandler) handler).addMember(currentTypeListener.getCorbaObject());
if (anonType) {
currentTypeListener.getCorbaObject().setAnonymousType(true);
currentTypeListener.processStartElement(name);
} else {
CorbaType type = CorbaUtils.getCorbaType(member.getIdltype(), typeMap);
boolean wrapped = true;
if (type instanceof Abstractsequence) {
wrapped = ((Abstractsequence) type).isWrapped();
} else if (type instanceof Abstractanonsequence) {
wrapped = ((Abstractanonsequence) type).isWrapped();
}
// to process StartElement of first element of collection
if (!wrapped) {
currentTypeListener.processStartElement(name);
}
}
} else {
currentTypeListener.processStartElement(name);
}
}
use of org.apache.cxf.binding.corba.wsdl.Abstractsequence in project cxf by apache.
the class WSDLToCorbaHelper method processLocalElement.
private CorbaType processLocalElement(QName containingTypeName, XmlSchemaElement element, String uri) throws Exception {
CorbaType membertype = new CorbaType();
XmlSchemaType schemaType = element.getSchemaType();
QName schemaName = element.getQName();
if (schemaType == null) {
if (element.getRef().getTarget() != null) {
schemaType = findSchemaType(element.getRef().getTarget().getSchemaTypeName());
schemaName = element.getRef().getTargetQName();
} else {
schemaType = findSchemaType(element.getSchemaTypeName());
}
}
if (schemaName.getNamespaceURI().equals("")) {
schemaName = new QName(uri, schemaName.getLocalPart());
}
QName elemName = schemaName;
boolean elementQualified = getElementQualification(element, uri);
if (!elementQualified) {
elemName = new QName("", elemName.getLocalPart());
}
QName memName = null;
if (element.isNillable()) {
CorbaType elemtype = convertSchemaToCorbaType(schemaType, elemName, schemaType, null, true);
QName name = createQNameTargetNamespace(elemtype.getQName().getLocalPart() + "_nil");
QName elName = checkPrefix(elemName);
if (elName == null) {
elName = createQNameTargetNamespace(elemName.getLocalPart());
}
CorbaType memtype = createNillableUnion(elName, name, elemtype.getQName(), elementQualified);
memName = createQNameCorbaNamespace(memtype.getQName().getLocalPart());
if (!isDuplicate(memtype)) {
typeMappingType.getStructOrExceptionOrUnion().add(memtype);
}
membertype.setQName(memName);
membertype.setName(memtype.getName());
membertype.setType(memtype.getType());
} else if (schemaType != null) {
XmlSchemaType st = schemaType;
boolean anonymous = WSDLTypes.isAnonymous(st.getName());
QName typeName = null;
if (anonymous) {
typeName = new QName(elemName.getNamespaceURI(), containingTypeName.getLocalPart() + "." + elemName.getLocalPart());
} else {
typeName = st.getQName();
}
membertype = convertSchemaToCorbaType(st, typeName, st, null, anonymous);
} else if (element.getSchemaTypeName() != null) {
QName name = checkPrefix(element.getSchemaTypeName());
membertype = getLocalType(name);
}
if (membertype == null) {
return null;
}
if (!(element.getMaxOccurs() == 1) || !(element.getMinOccurs() == 1)) {
QName name = createQNameCorbaNamespace(getModulePrefix(membertype) + elemName.getLocalPart() + "Array");
CorbaType arraytype = null;
if (memName != null) {
arraytype = createArray(name, /*schemaName*/
name, memName, elemName, element.getMaxOccurs(), element.getMinOccurs(), false);
} else {
arraytype = createArray(name, /*schemaName*/
name, membertype.getQName(), elemName, element.getMaxOccurs(), element.getMinOccurs(), false);
}
if (arraytype != null) {
if (arraytype instanceof Abstractsequence) {
((Abstractsequence) arraytype).setWrapped(false);
}
if (arraytype instanceof Abstractanonsequence) {
((Abstractanonsequence) arraytype).setWrapped(false);
}
if (!isDuplicate(arraytype)) {
typeMappingType.getStructOrExceptionOrUnion().add(arraytype);
}
// the local element with maxOccurs != 1 or minOccurs != 1 becomes the just created array
membertype = arraytype;
}
}
membertype.setQualified(elementQualified);
return membertype;
}
Aggregations