use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class InstanceDataPort method toXML.
/**
* @see org.apache.airavata.workflow.model.graph.impl.PortImpl#toXML()
*/
@Override
protected XmlElement toXML() {
XmlElement portElement = super.toXML();
portElement.setAttributeValue(GraphSchema.NS, GraphSchema.PORT_TYPE_ATTRIBUTE, GraphSchema.PORT_TYPE_INSTANCE);
return portElement;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class WorkflowWSDL method addParameter.
/**
* Adds the parameter element.
*
* @param node
* @param sequence
* @param schema
* @return The parameter element
*/
private XmlElement addParameter(ParameterNode node, XmlElement sequence, XmlElement schema) {
XmlElement element;
SystemDataPort port = node.getPort();
element = addParameter(node, port, sequence, schema);
//
// Annotation
//
String description = node.getDescription();
XmlElement appinfo = node.getMetadata();
// description
if (description != null && description.trim().length() != 0) {
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
XmlElement documentation = annotation.addElement(WSConstants.DOCUMENTATION_TAG);
documentation.setText(node.getDescription());
}
// appinfo
if (appinfo != null) {
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
try {
annotation.addElement(XMLUtil.deepClone(appinfo));
} catch (AiravataException e) {
log.error(e.getMessage(), e);
}
}
//
if (node instanceof InputNode) {
InputNode inputNode = (InputNode) node;
Object value = inputNode.getDefaultValue();
if (value instanceof String) {
element.setAttributeValue(WSConstants.DEFAULT_ATTRIBUTE, (String) value);
} else if (value instanceof XmlElement) {
// Add the default value in <annotation><default> because there
// is no standard way.
XmlElement valueElement = null;
try {
valueElement = XMLUtil.deepClone((XmlElement) value);
} catch (AiravataException e) {
log.error(e.getMessage(), e);
}
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
XmlElement defaultElement = annotation.addElement(WSComponentPort.DEFAULT);
defaultElement.addElement(valueElement);
}
}
return element;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class DataEdge method toXML.
/**
* @see org.apache.airavata.workflow.model.graph.impl.EdgeImpl#toXML()
*/
@Override
protected XmlElement toXML() {
XmlElement edgeElement = super.toXML();
edgeElement.setAttributeValue(GraphSchema.NS, GraphSchema.EDGE_TYPE_ATTRIBUTE, GraphSchema.EDGE_TYPE_DATA);
return edgeElement;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class EPRPort method toXML.
/**
* @see org.apache.airavata.workflow.model.graph.impl.PortImpl#toXML()
*/
@Override
protected XmlElement toXML() {
XmlElement portElement = super.toXML();
portElement.setAttributeValue(GraphSchema.NS, GraphSchema.PORT_TYPE_ATTRIBUTE, GraphSchema.PORT_TYPE_EPR);
return portElement;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class WSComponentPort method parse.
/**
* @param element
* @throws ComponentException
*/
private void parse(XmlElement element) throws ComponentException {
this.name = element.attributeValue(WSConstants.NAME_ATTRIBUTE);
// type
String typeQNameString = element.attributeValue(WSConstants.TYPE_ATTRIBUTE);
if (typeQNameString == null) {
// Type might be defined inline.
// TODO fix this.
// this.type = WSConstants.XSD_ANY_TYPE;
} else {
}
// annotation
this.annotation = element.element(null, WSConstants.ANNOTATION_TAG);
if (this.annotation != null) {
XmlElement documentationElement = this.annotation.element(null, WSConstants.DOCUMENTATION_TAG);
if (documentationElement != null) {
// Sets the documentation.
this.description = documentationElement.requiredText();
}
this.appinfo = this.annotation.element(null, WSConstants.APPINFO_TAG);
}
// defaut value
this.defaultValue = element.attributeValue(WSConstants.DEFAULT_ATTRIBUTE);
if (this.defaultValue == null && this.annotation != null) {
XmlElement defaultElement = this.annotation.element(null, DEFAULT);
if (defaultElement != null) {
for (Object child : defaultElement.children()) {
if (child instanceof XmlElement) {
this.defaultValue = XMLUtil.xmlElementToString((XmlElement) child);
}
}
}
}
// minOccurs
String minOccurs = element.attributeValue(WSConstants.MIN_OCCURS_ATTRIBUTE);
if ("0".equals(minOccurs)) {
this.optional = true;
} else {
this.optional = false;
}
}
Aggregations