Search in sources :

Example 6 with EdgeImpl

use of org.apache.airavata.workflow.model.graph.impl.EdgeImpl in project airavata by apache.

the class DoWhileHandler method handleDowhile.

/**
 * To get only web service components attached to dowhile
 *
 * @param waitingNode
 * @return list
 */
private ArrayList<Node> handleDowhile(ArrayList<Node> waitingNode, ArrayList<Node> finishedNodes) {
    ArrayList<Node> list = new ArrayList<Node>();
    for (Node node : waitingNode) {
        Component component = node.getComponent();
        if (component instanceof WSComponent) {
            ControlPort control = node.getControlInPort();
            boolean controlDone = true;
            if (control != null) {
                for (EdgeImpl edge : control.getEdges()) {
                    controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode()) || ((ControlPort) edge.getFromPort()).isConditionMet());
                }
            }
            /*
				 * Check for input ports
				 */
            List<DataPort> inputPorts = node.getInputPorts();
            boolean inputsDone = true;
            for (DataPort dataPort : inputPorts) {
                inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
            }
            if (inputsDone && controlDone) {
                list.add(node);
            }
        }
    }
    return list;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) EndDoWhileNode(org.apache.airavata.workflow.model.graph.system.EndDoWhileNode) Node(org.apache.airavata.workflow.model.graph.Node) DoWhileNode(org.apache.airavata.workflow.model.graph.system.DoWhileNode) ArrayList(java.util.ArrayList) WSComponent(org.apache.airavata.workflow.model.component.ws.WSComponent) EdgeImpl(org.apache.airavata.workflow.model.graph.impl.EdgeImpl) WSComponent(org.apache.airavata.workflow.model.component.ws.WSComponent) Component(org.apache.airavata.workflow.model.component.Component)

Aggregations

EdgeImpl (org.apache.airavata.workflow.model.graph.impl.EdgeImpl)6 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)4 ControlEdge (org.apache.airavata.workflow.model.graph.ControlEdge)3 DataPort (org.apache.airavata.workflow.model.graph.DataPort)3 Node (org.apache.airavata.workflow.model.graph.Node)3 Component (org.apache.airavata.workflow.model.component.Component)2 WSComponent (org.apache.airavata.workflow.model.component.ws.WSComponent)2 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 InstanceComponent (org.apache.airavata.workflow.model.component.amazon.InstanceComponent)1 TerminateInstanceComponent (org.apache.airavata.workflow.model.component.amazon.TerminateInstanceComponent)1 DynamicComponent (org.apache.airavata.workflow.model.component.dynamic.DynamicComponent)1 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)1 GraphException (org.apache.airavata.workflow.model.graph.GraphException)1 Kind (org.apache.airavata.workflow.model.graph.Port.Kind)1 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)1 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)1 DoWhileNode (org.apache.airavata.workflow.model.graph.system.DoWhileNode)1