Element queryElement = createBPELElement("query");
if (query.getQueryLanguage() != null) {
queryElement.setAttribute("queryLanguage", query.getQueryLanguage());
}
if (query.getValue() != null) {
CDATASection cdata = BPELUtils.createCDATASection(document, query.getValue());
queryElement.appendChild(cdata);
}
fromElement.appendChild(queryElement);
}
if (from.isSetEndpointReference()) {
fromElement.setAttribute("endpointReference", from.getEndpointReference().toString());
}
if (from.isSetOpaque()) {
fromElement.setAttribute("opaque", BPELUtils.boolean2XML(from.getOpaque()));
}
if (from.isSetLiteral() && from.getLiteral() != null && !from.getLiteral().equals("")) {
Node node = null;
Element literal = createBPELElement("literal");
fromElement.appendChild(literal);
if (Boolean.TRUE.equals(from.getUnsafeLiteral())) {
node = BPELUtils.convertStringToNode(from.getLiteral(), bpelResource);
}
if (node != null) {
for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
DOMUtil.copyInto(child, literal);
}
} else {
CDATASection cdata = BPELUtils.createCDATASection(document, from.getLiteral());
fromElement.appendChild(cdata);
}
}
if (from.getServiceRef() != null) {
ServiceRef serviceRef = from.getServiceRef();
Element serviceRefElement = createBPELElement("service-ref");
String referenceScheme = serviceRef.getReferenceScheme();
if (referenceScheme != null) {
serviceRefElement.setAttribute("reference-scheme", referenceScheme);
}
if (serviceRef.getValue() != null) {
Object value = serviceRef.getValue();
if (value instanceof ExtensibilityElement) {
ExtensibilityElement extensibilityElement = (ExtensibilityElement)value;
BPELExtensionSerializer serializer = null;
QName qname = extensibilityElement.getElementType();
try {
serializer=(BPELExtensionSerializer)extensionRegistry.querySerializer(ExtensibleElement.class,qname);
} catch (WSDLException e) {
}
if (serializer != null) {
// Deserialize the DOM element and add the new Extensibility element to the parent
// ExtensibleElement
DocumentFragment fragment=document.createDocumentFragment();
try {
serializer.marshall(ExtensibleElement.class,qname,extensibilityElement,fragment,process,extensionRegistry);
Element child = (Element)fragment.getFirstChild();
serviceRefElement.appendChild(child);
} catch (WSDLException e) {
throw new WrappedException(e);
}
}
} else {
ServiceReferenceSerializer serializer = extensionRegistry.getServiceReferenceSerializer(referenceScheme);
if (serializer != null) {
DocumentFragment fragment=document.createDocumentFragment();
serializer.marshall(value, fragment, process, from, this);
Element child = (Element)fragment.getFirstChild();
serviceRefElement.appendChild(child);
} else {
CDATASection cdata = BPELUtils.createCDATASection(document, serviceRef.getValue().toString());
serviceRefElement.appendChild(cdata);
}
}
fromElement.appendChild(serviceRefElement);
}
}
if (from.getExpression() != null) {
Expression expression = from.getExpression();
if (expression.getExpressionLanguage() != null) {
fromElement.setAttribute("expressionLanguage", expression.getExpressionLanguage());
}
if (expression.getBody() != null) {
CDATASection cdata = BPELUtils.createCDATASection(document, (String)expression.getBody());
fromElement.appendChild(cdata);
}
}
if (from.getType() != null) {