use of org.apache.airavata.workflow.model.graph.Node in project airavata by apache.
the class WorkflowHarvester method removeUnnecessaryNodes.
/**
* @param pair
* @param clone
*/
private void removeUnnecessaryNodes(Node node, Port candidatePort, Workflow workflow) {
if (candidatePort.getFromPort().getEdges().size() == 1) {
Node fromNode = candidatePort.getFromNode();
try {
List<DataPort> inputPorts = fromNode.getInputPorts();
for (DataPort dataPort : inputPorts) {
removeUnnecessaryNodes(fromNode, dataPort, workflow);
}
workflow.removeNode(fromNode);
} catch (GraphException e) {
throw new WorkflowRuntimeException(e);
}
}
}
use of org.apache.airavata.workflow.model.graph.Node in project airavata by apache.
the class GraphUtil method getNextNodes.
/**
* Returns next nodes connected to a specified node.
*
* @param node
* The specified node.
* @return The next nodes.
*/
public static List<Node> getNextNodes(Node node) {
List<Node> nextNodes = getOutputNodes(node);
for (Port port : node.getControlOutPorts()) {
Collection<Node> toNodes = port.getToNodes();
nextNodes.addAll(toNodes);
}
return nextNodes;
}
use of org.apache.airavata.workflow.model.graph.Node in project airavata by apache.
the class GraphUtil method partitionGraphOnLabel.
/**
* @param wsGraph
* @return
*/
public static HashMap<String, LinkedList<Node>> partitionGraphOnLabel(WSGraph wsGraph) {
HashMap<String, LinkedList<Node>> returnMap = new HashMap<String, LinkedList<Node>>();
List<NodeImpl> nodes = wsGraph.getNodes();
for (NodeImpl node : nodes) {
if (!isInputOutputNode(node)) {
LinkedList<Node> list = returnMap.get(node.getLabel());
if (null == list) {
list = new LinkedList<Node>();
returnMap.put(node.getLabel(), list);
}
list.add(node);
}
}
return returnMap;
}
use of org.apache.airavata.workflow.model.graph.Node in project airavata by apache.
the class XBayaUtil method getInputsForForEachNode.
public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
Node forEachInputNode = forEachNode.getInputPort(0).getFromNode();
// if input node for for-each is WSNode
Object returnValForProvenance = null;
if (forEachInputNode instanceof InputNode) {
for (DataPort dataPort : forEachNode.getInputPorts()) {
returnValForProvenance = XBayaUtil.findInputFromPort(dataPort, invokerMap);
if (null == returnValForProvenance) {
throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
}
String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
listOfValues.addAll(Arrays.asList(vals));
}
}
return returnValForProvenance;
}
use of org.apache.airavata.workflow.model.graph.Node in project airavata by apache.
the class GraphCanvas method deselectNode.
/**
* Deselects a node that is currently selected if any.
*/
private void deselectNode() {
if (this.selectedNode != null) {
NodeController.getGUI(this.selectedNode).setSelectedFlag(false);
NodeController.getGUI(this.selectedNode).setDraggedFlag(false);
setSelectedNode(null);
}
if (this.multipleSelectedNodes != null) {
for (Node node : this.multipleSelectedNodes) {
NodeController.getGUI(node).setSelectedFlag(false);
NodeController.getGUI(node).setDraggedFlag(false);
}
this.multipleSelectedNodes = null;
}
}
Aggregations