use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class GraphImpl method fixParameterNodes.
// private void createID() {
// Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss_S");
// String time = format.format(date);
//
// this.id = StringUtil.convertToJavaIdentifier(this.name) + "_" + time;
// }
/**
* @throws GraphException
*/
public void fixParameterNodes() {
// XXX fix the ports of parameter nodes for 2.6.3 or before.
for (InputNode node : GraphUtil.getNodes(this, InputNode.class)) {
DataPort oldPort = node.getOutputPort(0);
if (oldPort instanceof WSPort) {
node.getOutputPorts().remove(oldPort);
this.ports.remove(oldPort);
SystemDataPort newPort = new SystemDataPort();
this.ports.add(newPort);
newPort.setKind(Kind.DATA_OUT);
newPort.setName(oldPort.getName());
newPort.setGraph(this);
newPort.setNode(node);
newPort.createID();
node.getOutputPorts().add(newPort);
for (DataEdge edge : oldPort.getEdges()) {
edge.setFromPort(newPort);
newPort.getEdges().add(edge);
}
}
}
for (OutputNode node : GraphUtil.getNodes(this, OutputNode.class)) {
DataPort oldPort = node.getInputPort(0);
if (oldPort instanceof WSPort) {
node.getInputPorts().remove(oldPort);
this.ports.remove(oldPort);
SystemDataPort newPort = new SystemDataPort();
this.ports.add(newPort);
newPort.setKind(Kind.DATA_IN);
newPort.setName(oldPort.getName());
newPort.setGraph(this);
newPort.setNode(node);
newPort.createID();
node.getInputPorts().add(newPort);
for (DataEdge edge : oldPort.getEdges()) {
edge.setToPort(newPort);
newPort.getEdges().add(edge);
}
}
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class NodeGUI method setToken.
/**
* @param workflowName
* @param state
*/
public void setToken(String workflowName, NodeState state) {
List<DataPort> inputPorts = getNode().getInputPorts();
switch(state) {
case EXECUTING:
for (DataPort dataPort : inputPorts) {
NodeController.getGUI(((DataPort) dataPort.getFromPort())).removeToken(workflowName);
NodeController.getGUI(dataPort).addToken(workflowName);
}
break;
case FINISHED:
for (DataPort dataPort : inputPorts) {
NodeController.getGUI(dataPort).removeToken(workflowName);
}
List<DataPort> outputPorts = getNode().getOutputPorts();
for (DataPort dataPort : outputPorts) {
NodeController.getGUI(dataPort).addToken(workflowName);
}
break;
case FAILED:
break;
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class DifferedInputHandler method handleDifferredInputsofDependentNodes.
public static void handleDifferredInputsofDependentNodes(Node node, final XBayaGUI xbayaGUI) {
List<DataPort> inputPorts = node.getInputPorts();
for (DataPort dataPort : inputPorts) {
Node fromNode = dataPort.getFromNode();
if (isDifferedInputNode(fromNode)) {
final DifferedInputNode differedInputNode = (DifferedInputNode) fromNode;
if (!differedInputNode.isConfigured()) {
// not configured differed node this is what we are looking for
// set the flag and ensure all the rest is finished
Runnable task = new Runnable() {
@Override
public void run() {
((DifferedInputNodeGUI) NodeController.getGUI(differedInputNode)).showConfigurationDialog(xbayaGUI);
}
};
new Thread(task).start();
}
}
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class XBayaUtil method findEndForEachFor.
/**
* @param node
* @return
*/
public static Node findEndForEachFor(ForEachNode node) {
Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
if (toNodes.size() != 1) {
throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
}
Node middleNode = toNodes.iterator().next();
List<DataPort> outputPorts = middleNode.getOutputPorts();
for (DataPort dataPort : outputPorts) {
if (dataPort.getToNodes().size() == 1) {
Node possibleEndForEachNode = dataPort.getToNodes().get(0);
if (possibleEndForEachNode instanceof EndForEachNode) {
return possibleEndForEachNode;
}
}
}
throw new WorkflowRuntimeException("EndForEachNode not found");
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class GraphUtil method getEncodedInputLabels.
/**
* @param node
* @return
*/
public static String getEncodedInputLabels(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 = "";
for (DataPort dataPort : inputPorts) {
label += "#" + dataPort.getEdge(0).getLabel();
}
return label;
}
Aggregations