Search in sources :

Example 76 with DataPort

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

the class ForEachNode method addInputPortAndReturn.

public DataPort addInputPortAndReturn() {
    ForEachComponent component = getComponent();
    ComponentDataPort input = component.getInputPort();
    DataPort port = input.createPort();
    addInputPort(port);
    return port;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) ForEachComponent(org.apache.airavata.workflow.model.component.system.ForEachComponent) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

Example 77 with DataPort

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

the class ConstantNode method getEdges.

private List<DataEdge> getEdges() {
    DataPort port = getPort();
    List<DataEdge> edges = port.getEdges();
    return edges;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge)

Example 78 with DataPort

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

the class DoWhileNode method addOutputPort.

/**
 * Adds additional output port.
 */
public void addOutputPort() {
    DoWhileComponent component = getComponent();
    ComponentDataPort outputPort = component.getOutputPort();
    DataPort port = outputPort.createPort();
    addOutputPort(port);
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) DoWhileComponent(org.apache.airavata.workflow.model.component.system.DoWhileComponent) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

Example 79 with DataPort

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

the class SystemDataPort method copyType.

/**
 * @param port
 * @param arrayIncrement
 * @throws GraphException
 */
public void copyType(DataPort port, int arrayIncrement) throws GraphException {
    DataType newType = port.getType();
    if (this.type != newType) {
        this.type = newType;
        if (port instanceof WSPort) {
            WSPort wsPort = (WSPort) port;
            this.wsComponentPort = wsPort.getComponentPort();
            this.arrayDimension = 0;
        } else if (port instanceof SystemDataPort) {
            SystemDataPort systemPort = (SystemDataPort) port;
            this.wsComponentPort = systemPort.getWSComponentPort();
            this.arrayDimension = systemPort.getArrayDimension() + arrayIncrement;
        }
        // propagate to other ports of this node.
        getNode().portTypeChanged(this);
        // propagate to the connected ports.
        Kind kind = getKind();
        for (DataEdge edge : getEdges()) {
            if (kind == Kind.DATA_IN) {
                DataPort fromPort = edge.getFromPort();
                fromPort.copyType(this);
            } else if (kind == Kind.DATA_OUT) {
                DataPort toPort = edge.getToPort();
                toPort.copyType(this);
            } else {
                throw new WorkflowRuntimeException();
            }
        }
    }
}
Also used : WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataType(org.apache.airavata.model.application.io.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 80 with DataPort

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

the class GraphUtil method isSameLabeledInput.

/**
 * @param node
 * @return null if not the same
 */
public static String isSameLabeledInput(Node node) {
    if (!isAllInputsConnected(node)) {
        throw new WorkflowRuntimeException("Node inputs not connected" + node);
    }
    if (!isAllInputsLabeled(node)) {
        throw new WorkflowRuntimeException("Some or all of the node inputs not labeled" + node);
    }
    List<DataPort> inputPorts = node.getInputPorts();
    String label = inputPorts.get(0).getEdge(0).getLabel();
    for (DataPort dataPort : inputPorts) {
        // 0 because its got only one
        if (!label.equals(dataPort.getEdge(0).getLabel())) {
            return null;
        }
    }
    return label;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Aggregations

DataPort (org.apache.airavata.workflow.model.graph.DataPort)100 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)39 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)26 Node (org.apache.airavata.workflow.model.graph.Node)26 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)20 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)16 GraphException (org.apache.airavata.workflow.model.graph.GraphException)15 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)13 DataType (org.apache.airavata.model.application.io.DataType)12 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)12 Port (org.apache.airavata.workflow.model.graph.Port)11 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)10 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)9 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)8 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)8 LinkedList (java.util.LinkedList)7 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)7 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)7 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)6 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)6