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;
}
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;
}
Aggregations