}
return aliasNamesStringBuilder.toString();
}
private Element buildElement(Property property, NestedParticle nestedParticle) {
SDOProperty sdoProperty = (SDOProperty) property;
Element elem = new Element();
String xsdLocalName = sdoProperty.getXsdLocalName();
if (xsdLocalName != null) {
elem.setName(xsdLocalName);
} else {
elem.setName(sdoProperty.getName());
}
elem.setMinOccurs(Occurs.ZERO);
elem.setNillable(sdoProperty.isNullable());
if ((sdoProperty.getAppInfoElements() != null) && (sdoProperty.getAppInfoElements().size() > 0)) {
Annotation annotation = new Annotation();
annotation.setAppInfo(sdoProperty.getAppInfoElements());
elem.setAnnotation(annotation);
}
// process default values that are defined in the schema (not via primitive numeric Object wrapped pseudo defaults)
if (sdoProperty.isDefaultSet()) {
if (!sdoProperty.isMany() && sdoProperty.getType().isDataType()) {
XMLConversionManager xmlConversionManager = ((SDOXMLHelper)aHelperContext.getXMLHelper()).getXmlConversionManager();
elem.setDefaultValue((String)xmlConversionManager.convertObject(sdoProperty.getDefault(), ClassConstants.STRING, sdoProperty.getXsdType()));
}
}
addSimpleComponentAnnotations(elem, sdoProperty, true);
/*
When containment is true, then DataObjects of that Type will appear as nested elements in an XML document.
When containment is false and the property's type is a DataObject, a URI reference
to the element containing the DataObject is used and an sdo:propertyType
declaration records the target type. Values in XML documents will be of the form
"#xpath" where the xpath is an SDO DataObject XPath subset. It is typical to
customize the declaration to IDREF if the target element has an attribute with type
customized to ID.
[TYPE.NAME] is the type of the element. If property.type.dataType is true,
[TYPE.NAME] is the name of the XSD built in SimpleType corresponding to
property.type, where the prefix is for the xsd namespace. Otherwise,
[TYPE.NAME] is property.type.name where the tns: prefix is determined by the
namespace declaration for the Type's URI.
*/
Type schemaSDOType = null;
QName schemaType = sdoProperty.getXsdType();
if (schemaType != null) {
schemaSDOType = ((SDOTypeHelper)aHelperContext.getTypeHelper()).getType(schemaType.getNamespaceURI(), schemaType.getLocalPart());
if ((sdoProperty.getType() == SDOConstants.SDO_STRING) && (schemaSDOType != SDOConstants.SDO_STRING)) {
String sdoXmlPrefix = getPrefixForURI(SDOConstants.SDOXML_URL);
QName qname = new QName(SDOConstants.SDOXML_URL, SDOConstants.SDOXML_STRING_NAME, sdoXmlPrefix);
elem.getAttributesMap().put(qname, "true");
}
}
if (!sdoProperty.isContainment() && !sdoProperty.getType().isDataType()) {
schemaType = SDOConstants.ANY_URI_QNAME;
}
Type propertyType = sdoProperty.getType();
if (propertyType != null) {
if (sdoProperty.getContainingType() != null) {
addTypeToListIfNeeded(sdoProperty.getContainingType(), propertyType);
}
if (schemaType == null) {
schemaType = ((SDOTypeHelper)aHelperContext.getTypeHelper()).getXSDTypeFromSDOType(propertyType);
}
//get url for prefix in namespace resolver and map sure it is added to the schema if necessary
if (schemaType != null) {
elem.setType(getPrefixStringForURI(schemaType.getNamespaceURI()) + schemaType.getLocalPart());
if (schemaSDOType != null) {
addTypeToListIfNeeded(sdoProperty.getContainingType(), schemaSDOType);
}
} else if ((propertyType.getURI() == null) || (propertyType.getURI().equalsIgnoreCase(generatedSchema.getTargetNamespace()))) {
String xsdTypeLocalName = ((SDOType)propertyType).getXsdLocalName();
if (xsdTypeLocalName != null) {
elem.setType(xsdTypeLocalName);
} else {
elem.setType(propertyType.getName());
}
} else {
String nameString = null;
String xsdTypeLocalName = ((SDOType)propertyType).getXsdLocalName();
if (xsdTypeLocalName != null) {
nameString = xsdTypeLocalName;
} else {
nameString = propertyType.getName();
}
elem.setType(getPrefixStringForURI(propertyType.getURI()) + nameString);
}
} else {
elem.setType("anyURI");
}
if (sdoProperty.isMany()) {
elem.setMaxOccurs(Occurs.UNBOUNDED);
} else if (nestedParticle.getMaxOccurs() == Occurs.UNBOUNDED) {
//this means property.isMany==false and the owning sequence of choice is unbounded Jira SDO-3
String sdoXmlPrefix = getPrefixForURI(SDOConstants.SDOXML_URL);
QName qname = new QName(SDOConstants.SDOXML_URL, SDOConstants.SDOXML_MANY, sdoXmlPrefix);