use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.
the class InterpreterUtil method getNumberOfInputsForForEachNode.
public static Integer[] getNumberOfInputsForForEachNode(final ForEachNode forEachNode, Map<Node, Invoker> invokerMap) throws WorkflowException {
List<DataPort> inputPorts = forEachNode.getInputPorts();
Integer[] inputNumbers = new Integer[inputPorts.size()];
for (DataPort forEachInputPort : inputPorts) {
// if input node for for-each is WSNode
Node forEachInputNode = forEachInputPort.getFromNode();
int index = 0;
Object returnValForProvenance = null;
if (forEachInputNode instanceof InputNode) {
returnValForProvenance = InterpreterUtil.findInputFromPort(forEachInputPort, invokerMap);
if (null == returnValForProvenance) {
throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
}
String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
}
}
return inputNumbers;
}
use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.
the class XBayaUtil method getInputsForForEachNode.
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 = StringUtil.getElementsFromString(returnValForProvenance.toString());
listOfValues.addAll(Arrays.asList(vals));
}
}
return returnValForProvenance;
}
use of org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException in project airavata by apache.
the class InterpreterUtil method getInputsForForEachNode.
/**
* This method returns the input values for given foreach node
*
* @param forEachNode
* @param listOfValues
* @param invokerMap
* @return
* @throws WorkflowException
*/
public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
List<DataPort> inputPorts = forEachNode.getInputPorts();
Object returnValForProvenance = null;
for (DataPort inputPort : inputPorts) {
Node inputNode = inputPort.getFromNode();
// if input node for for-each is WSNode
if (inputNode instanceof InputNode) {
// for (DataPort dataPort : forEachNode.getInputPorts()) {
returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
if (null == returnValForProvenance) {
throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
}
String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
listOfValues.addAll(Arrays.asList(vals));
// }
}
}
return returnValForProvenance;
}
Aggregations