window.show();
}
public static Object getInputsForForEachNode(final ForEachNode forEachNode,
final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
Node forEachInputNode = forEachNode.getInputPort(0).getFromNode();
// if input node for for-each is WSNode
Object returnValForProvenance = null;
if (forEachInputNode instanceof InputNode) {
for (DataPort dataPort : forEachNode.getInputPorts()) {
returnValForProvenance = XBayaUtil
.findInputFromPort(dataPort, invokerMap);
if (null == returnValForProvenance) {
throw new WorkFlowInterpreterException(
"Unable to find input for the node:"
+ forEachNode.getID());
}
String[] vals = returnValForProvenance.toString().split(",");
listOfValues.addAll(Arrays.asList(vals));
}
} else {
Invoker workflowInvoker = invokerMap
.get(forEachInputNode);
if (workflowInvoker != null) {
if (workflowInvoker instanceof GenericInvoker) {
returnValForProvenance = ((GenericInvoker) workflowInvoker)
.getOutputs();
String message = returnValForProvenance.toString();
XmlElement msgElmt = XmlConstants.BUILDER
.parseFragmentFromString(message);
Iterator children = msgElmt.children().iterator();
while (children.hasNext()) {
Object object = children.next();
// foreachWSNode.getInputPort(0).getType()
if (object instanceof XmlElement) {
listOfValues.add(XmlConstants.BUILDER
.serializeToString(object));
// TODO fix for simple type - Done
}
}
} else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
String outputName = forEachInputNode.getOutputPort(0)
.getName();
returnValForProvenance = workflowInvoker
.getOutput(outputName);
org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
Iterator children = msgElmt.children();
while (children.hasNext()) {
Object object = children.next();
if (object instanceof org.xmlpull.v1.builder.XmlElement) {
org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
Iterator valItr = child.children();
if (valItr.hasNext()) {
Object object2 = valItr.next();
if (object2 instanceof String) {
listOfValues.add(object2.toString());
}
}
}
}
} else if (workflowInvoker instanceof SystemComponentInvoker) {
String outputName = forEachInputNode.getOutputPort(0)
.getName();
returnValForProvenance = workflowInvoker
.getOutput(outputName);
XmlElement msgElmt = XmlConstants.BUILDER
.parseFragmentFromString("<temp>"