Search in sources :

Example 6 with ControlEdge

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

the class WSGraphFactory method createEdge.

public EdgeImpl createEdge(JsonObject edgeObject) {
    String type = edgeObject.getAsJsonPrimitive(GraphSchema.EDGE_TYPE_ATTRIBUTE).getAsString();
    EdgeImpl edge;
    if (GraphSchema.EDGE_TYPE_DATA.equals(type)) {
        edge = new DataEdge(edgeObject);
    } else if (GraphSchema.PORT_TYPE_CONTROL.equals(type)) {
        edge = new ControlEdge(edgeObject);
    } else {
        // Default is WsPort because of backword compatibility
        edge = new DataEdge(edgeObject);
    }
    return edge;
}
Also used : DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) EdgeImpl(org.apache.airavata.workflow.model.graph.impl.EdgeImpl) ControlEdge(org.apache.airavata.workflow.model.graph.ControlEdge)

Example 7 with ControlEdge

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

the class WSGraphFactory method createEdge.

/**
 * @see org.apache.airavata.workflow.model.graph.GraphFactory#createEdge(org.apache.airavata.workflow.model.graph.Port,
 *      org.apache.airavata.workflow.model.graph.Port)
 */
public EdgeImpl createEdge(Port fromPort, Port toPort) {
    Kind fromKind = fromPort.getKind();
    Kind toKind = toPort.getKind();
    if (!((fromKind == Kind.DATA_OUT && toKind == Kind.DATA_IN) || (fromKind == Kind.CONTROL_OUT && toKind == Kind.CONTROL_IN) || (fromKind == Kind.EPR && toKind == Kind.DATA_IN))) {
        throw new WorkflowRuntimeException();
    }
    EdgeImpl edge;
    if (toKind == Kind.DATA_IN) {
        edge = new DataEdge();
    } else if (toKind == Kind.CONTROL_IN) {
        edge = new ControlEdge();
    } else {
        // Should not happen.
        throw new WorkflowRuntimeException();
    }
    return edge;
}
Also used : DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) Kind(org.apache.airavata.workflow.model.graph.Port.Kind) EdgeImpl(org.apache.airavata.workflow.model.graph.impl.EdgeImpl) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) ControlEdge(org.apache.airavata.workflow.model.graph.ControlEdge)

Aggregations

ControlEdge (org.apache.airavata.workflow.model.graph.ControlEdge)7 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)4 EdgeImpl (org.apache.airavata.workflow.model.graph.impl.EdgeImpl)3 GraphException (org.apache.airavata.workflow.model.graph.GraphException)2 Port (org.apache.airavata.workflow.model.graph.Port)2 BasicStroke (java.awt.BasicStroke)1 Point (java.awt.Point)1 Stroke (java.awt.Stroke)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)1 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)1 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)1 DataPort (org.apache.airavata.workflow.model.graph.DataPort)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1 Node (org.apache.airavata.workflow.model.graph.Node)1 Kind (org.apache.airavata.workflow.model.graph.Port.Kind)1 PortImpl (org.apache.airavata.workflow.model.graph.impl.PortImpl)1 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)1 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)1