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);
}
}
}
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;
}
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;
}
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);
}
}
}
Aggregations