use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.
the class GraphUtil method getStreamSourceNodes.
/**
* @param graph
* @return
*/
public static LinkedList<StreamSourceNode> getStreamSourceNodes(WSGraph graph) {
List<NodeImpl> nodes = graph.getNodes();
LinkedList<StreamSourceNode> ret = new LinkedList<StreamSourceNode>();
for (NodeImpl nodeImpl : nodes) {
if (nodeImpl instanceof StreamSourceNode) {
ret.add((StreamSourceNode) nodeImpl);
}
}
return ret;
}
use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.
the class GraphUtil method getJoinRequiredNodes.
/**
* @param wsGraph
* @return
*/
public static List<Node> getJoinRequiredNodes(WSGraph wsGraph) {
List<NodeImpl> nodes = wsGraph.getNodes();
List<Node> ret = new LinkedList<Node>();
for (NodeImpl node : nodes) {
if (node.getRequireJoin()) {
ret.add(node);
}
}
return ret;
}
use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.
the class WSGraphFactory method createNode.
/**
* @see org.apache.airavata.workflow.model.graph.GraphFactory#createNode(org.xmlpull.infoset.XmlElement)
*/
public NodeImpl createNode(XmlElement nodeElement) throws GraphException {
String type = nodeElement.attributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE);
if (type == null) {
// Old graphs don't have the namespace for the attribute.
type = nodeElement.attributeValue(GraphSchema.NODE_TYPE_ATTRIBUTE);
}
NodeImpl node;
if (GraphSchema.NODE_TYPE_WS.equals(type)) {
node = new WSNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)) {
node = new StreamSourceNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_WORKFLOW.equals(type)) {
node = new WorkflowNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
node = new InputNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
node = new OutputNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
node = new ConstantNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
node = new ForEachNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
node = new EndForEachNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
node = new IfNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
node = new EndifNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
node = new DoWhileNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
node = new EndDoWhileNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_MEMO.equals(type)) {
node = new MemoNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_RECEIVE.equals(type)) {
node = new ReceiveNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_BLOCK.equals(type)) {
node = new BlockNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDBLOCK.equals(type)) {
node = new EndBlockNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_INSTANCE.equals(type)) {
node = new InstanceNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_TERMINATE.equals(type)) {
node = new TerminateInstanceNode(nodeElement);
} else {
// Default is WsNode for backward compatibility.
node = new WSNode(nodeElement);
}
return node;
}
use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.
the class WSGraphFactory method createNode.
public NodeImpl createNode(JsonObject nodeObject) throws GraphException {
String type = nodeObject.getAsJsonPrimitive(GraphSchema.NODE_TYPE_ATTRIBUTE).getAsString();
NodeImpl node;
if (GraphSchema.NODE_TYPE_WS.equals(type)) {
node = new WSNode(nodeObject);
} else if (GraphSchema.NODE_TYPE_WORKFLOW.equals(type)) {
node = new WorkflowNode(nodeObject);
} else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
node = new InputNode(nodeObject);
} else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
node = new OutputNode(nodeObject);
/* } else if (GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)) {
node = new StreamSourceNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
node = new ConstantNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
node = new ForEachNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
node = new EndForEachNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
node = new IfNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
node = new EndifNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
node = new DoWhileNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
node = new EndDoWhileNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_MEMO.equals(type)) {
node = new MemoNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_RECEIVE.equals(type)) {
node = new ReceiveNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_BLOCK.equals(type)) {
node = new BlockNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_ENDBLOCK.equals(type)) {
node = new EndBlockNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_INSTANCE.equals(type)) {
node = new InstanceNode(nodeElement);
} else if (GraphSchema.NODE_TYPE_TERMINATE.equals(type)) {
node = new TerminateInstanceNode(nodeElement);*/
} else {
// Default is WsNode for backward compatibility.
node = new WSNode(nodeObject);
}
return node;
}
use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.
the class InterpreterUtil method getNodeCountWithBodyColor.
public static int getNodeCountWithBodyColor(NodeExecutionState state, WSGraph graph) {
int sum = 0;
List<NodeImpl> nodes = graph.getNodes();
for (Node node : nodes) {
if (node.getState() == state) {
++sum;
}
}
return sum;
}
Aggregations