Object returnValForProvenance = null;
for(DataPort inputPort:inputPorts){
Node forEachInputNode = inputPort.getFromNode();
// if input node for for-each is WSNode
if (forEachInputNode instanceof InputNode) {
for (DataPort dataPort : forEachNode.getInputPorts()) {
returnValForProvenance = InterpreterUtil
.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) {
int index = forEachInputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort());
String outputName = "";
if(forEachInputNode.getInputPort(index) instanceof SystemDataPort){
outputName = ((SystemDataPort)forEachInputNode.getInputPort(index)).getWSComponentPort().getName();
}else if(forEachInputNode.getInputPort(index) instanceof WSPort){
outputName = ((SystemDataPort)forEachInputNode.getInputPort(
forEachInputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
}
returnValForProvenance = workflowInvoker
.getOutput(outputName);
XmlElement msgElmt = XmlConstants.BUILDER
.parseFragmentFromString("<temp>"