use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.
the class ReadXMLStep method getXmlSchemaObject.
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
File file = getFile();
if (file != null && file.exists() && file.length() <= 10000000) {
try {
Document doc = XMLUtils.parseDOM(file);
if (!hasXmlRoot(doc)) {
Element xmlRoot = doc.getDocumentElement();
Element newRoot = doc.createElement("document");
doc.replaceChild(newRoot, xmlRoot);
newRoot.appendChild(xmlRoot);
}
XmlSchemaElement elt = XmlSchemaUtils.extractXmlSchemaElement(doc, schema, this);
if (element != null) {
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
sequence.getItems().add(elt);
} else {
element = elt;
}
} catch (Exception e) {
Engine.logBeans.info("Failed to load the xml file " + file.getAbsolutePath(), e);
}
}
if (element == null) {
element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
}
return element;
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.
the class SchemaViewLabelDecorator method decorateText.
public String decorateText(String text, Object element) {
String decoratedText = text;
if (element != null) {
if (element instanceof XmlSchemaObject) {
XmlSchemaObject xso = (XmlSchemaObject) element;
XmlSchemaType type = null;
String value = null;
if (element instanceof XmlSchemaElement) {
type = SchemaMeta.getType(xso, ((XmlSchemaElement) element).getSchemaTypeName());
} else if (element instanceof XmlSchemaAttribute) {
XmlSchemaAttribute attr = (XmlSchemaAttribute) element;
type = SchemaMeta.getType(xso, attr.getSchemaTypeName());
value = attr.getDefaultValue();
value = value == null ? attr.getFixedValue() : "default:" + value;
} else if (element instanceof XmlSchemaSimpleContentExtension) {
type = SchemaMeta.getType(xso, ((XmlSchemaSimpleContentExtension) element).getBaseTypeName());
} else if (element instanceof XmlSchemaSimpleTypeRestriction) {
type = SchemaMeta.getType(xso, ((XmlSchemaSimpleTypeRestriction) element).getBaseTypeName());
} else if (element instanceof XmlSchemaEnumerationFacet) {
XmlSchemaEnumerationFacet enumerationFacet = (XmlSchemaEnumerationFacet) element;
decoratedText += " [" + enumerationFacet.getValue() + "]";
}
if (value != null) {
decoratedText += " {" + value + "}";
}
if (type != null && type instanceof XmlSchemaSimpleType) {
decoratedText += " [" + SchemaMeta.getPrefix(type) + ":" + type.getName() + "]";
}
int size = SchemaMeta.getReferencedDatabaseObjects(xso).size();
if (size > 1 || size >= 0 && element instanceof XmlSchemaComplexType && ((XmlSchemaComplexType) element).getName() != null) {
decoratedText += " (" + size + ")";
}
String prefix = SchemaMeta.getPrefix(xso);
if (prefix != null) {
decoratedText = prefix + ":" + decoratedText;
}
}
}
return decoratedText;
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.
the class LDAPAuthenticationStep method getXmlSchemaObject.
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
XmlSchemaElement subElement = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(subElement);
subElement.setName("rdn");
subElement.setMinOccurs(0);
subElement.setMaxOccurs(Long.MAX_VALUE);
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
subElement.setType(cType);
XmlSchemaSimpleContent sContent = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContent());
cType.setContentModel(sContent);
XmlSchemaSimpleContentExtension sContentExt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContentExtension());
sContent.setContent(sContentExt);
sContentExt.setBaseTypeName(Constants.XSD_STRING);
XmlSchemaAttribute attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("name");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
subElement = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(subElement);
subElement.setName("attribute");
subElement.setMinOccurs(0);
subElement.setMaxOccurs(Long.MAX_VALUE);
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
subElement.setType(cType);
sContent = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContent());
cType.setContentModel(sContent);
sContentExt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContentExtension());
sContent.setContent(sContentExt);
sContentExt.setBaseTypeName(Constants.XSD_STRING);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("name");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
subElement = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(subElement);
subElement.setName("userDn");
subElement.setMinOccurs(0);
subElement.setMaxOccurs(1);
subElement.setSchemaTypeName(Constants.XSD_STRING);
subElement = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(subElement);
subElement.setName("authenticatedUserID");
subElement.setMinOccurs(0);
subElement.setMaxOccurs(1);
subElement.setSchemaTypeName(Constants.XSD_STRING);
/*
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
subElement.setType(cType);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("name");
attr.setSchemaTypeName(Constants.XSD_STRING);
cType.getAttributes().add(attr);
sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
sequence.setMinOccurs(0);
sequence.setMaxOccurs(Long.MAX_VALUE);
cType.setParticle(sequence);
subElement = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(subElement);
subElement.setName("value");
subElement.setSchemaTypeName(Constants.XSD_STRING);
*/
return element;
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.
the class ListDirStep method getXmlSchemaObject.
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
XmlSchemaElement elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(elt);
elt.setName("file");
elt.setMinOccurs(0);
elt.setMaxOccurs(Long.MAX_VALUE);
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
elt.setType(cType);
XmlSchemaSimpleContent sContent = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContent());
cType.setContentModel(sContent);
XmlSchemaSimpleContentExtension sContentExt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContentExtension());
sContent.setContent(sContentExt);
sContentExt.setBaseTypeName(Constants.XSD_STRING);
XmlSchemaAttribute attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("lastModified");
attr.setSchemaTypeName(Constants.XSD_NONNEGATIVEINTEGER);
sContentExt.getAttributes().add(attr);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("size");
attr.setSchemaTypeName(Constants.XSD_NONNEGATIVEINTEGER);
sContentExt.getAttributes().add(attr);
return element;
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.
the class PushNotificationStep method getXmlSchemaObject.
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
XmlSchemaElement errorMessage = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(errorMessage);
errorMessage.setName("errorMessage");
errorMessage.setMinOccurs(0);
errorMessage.setMaxOccurs(1);
errorMessage.setSchemaTypeName(Constants.XSD_STRING);
/**
* create devices complextype tag
*/
XmlSchemaElement devices = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(devices);
devices.setName("devices");
devices.setMinOccurs(0);
devices.setMaxOccurs(1);
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
devices.setType(cType);
sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
/**
* create device simple type tag
*/
XmlSchemaElement elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(elt);
elt.setName("device");
elt.setMinOccurs(1);
elt.setMaxOccurs(Long.MAX_VALUE);
cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
elt.setType(cType);
/**
*/
XmlSchemaSimpleContent sContent = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContent());
cType.setContentModel(sContent);
XmlSchemaSimpleContentExtension sContentExt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSimpleContentExtension());
sContent.setContent(sContentExt);
sContentExt.setBaseTypeName(Constants.XSD_STRING);
/**
* create all device attributes
*/
XmlSchemaAttribute attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("plugIn");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("regId");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("messageId");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("canonicalRegId");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
attr = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attr.setName("errorType");
attr.setSchemaTypeName(Constants.XSD_STRING);
sContentExt.getAttributes().add(attr);
return element;
}
Aggregations