use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class ReceiveNode method removeOutputPort.
/**
* @throws GraphException
*/
public void removeOutputPort() throws GraphException {
List<DataPort> outputPorts = getOutputPorts();
// Remove the last one.
DataPort outputPort = outputPorts.get(outputPorts.size() - 1);
removeOutputPort(outputPort);
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class DifferedInputNode method edgeWasAdded.
/**
* Called when an Edge was added to the parameter port. Change the name of
* this node.
*
* @throws GraphException
*
* @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasAdded(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
// TODO organize this.
if (edge instanceof DataEdge) {
DataEdge dataEdge = (DataEdge) edge;
DataPort toPort = dataEdge.getToPort();
DataType toType = toPort.getType();
List<DataEdge> edges = getEdges();
if (edges.size() == 1) {
// The first edge.
setParameterType(toType);
if (!isConfigured() && toPort instanceof WSPort) {
// Copy
copyDefaultConfiguration((WSPort) toPort);
}
} else if (edges.size() > 1) {
// Not the first edge.
DataType parameterType = getParameterType();
if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !parameterType.equals(toType)) {
throw new GraphException("Cannot connect ports with different types.");
}
} else {
// Should not happen.
throw new WorkflowRuntimeException("edges.size(): " + edges.size());
}
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class SystemNode method edgeWasAdded.
/**
* @throws GraphException
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.Edge)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
GraphUtil.validateConnection(edge);
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (fromDataPort.getNode() == this) {
// setType() propagates the change to the whole workflow.
if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
fromDataPort.copyType(toDataPort);
}
} else if (toDataPort.getNode() == this) {
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
toDataPort.copyType(fromDataPort);
}
} else {
throw new WorkflowRuntimeException();
}
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class DifferedInputHandler method onlyWaitingOnIncompleteDifferedInputNode.
public static boolean onlyWaitingOnIncompleteDifferedInputNode(Node node) {
List<DataPort> inputPorts = node.getInputPorts();
boolean atleadOneDifferedInputNodeIsIncomplete = false;
for (DataPort dataPort : inputPorts) {
Node fromNode = dataPort.getFromNode();
if (NodeController.isFinished(fromNode)) {
// no op
} else if (isDifferedInputNode(fromNode)) {
// not finished
if (!((DifferedInputNode) node).isConfigured()) {
// not configured differed node this is what we are looking for
// set the flag and ensure all the rest is finished
atleadOneDifferedInputNodeIsIncomplete = true;
}
} else {
// there is a not finished non differed input node
return false;
}
}
// if not finished nodes were found we wil not be here so
return atleadOneDifferedInputNodeIsIncomplete;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class DynamicNode method removeLastDynamicallyAddedInPort.
/**
* @see org.apache.airavata.workflow.model.graph.dynamic.PortAddable#removeLastDynamicallyAddedInPort()
*/
@Override
public void removeLastDynamicallyAddedInPort() throws GraphException {
List<DataPort> inputPorts = this.getInputPorts();
if (inputPorts.size() == 1) {
// This is the initial port, so leave it alone
return;
}
DataPort portToBeRemoved = null;
for (DataPort dataPort : inputPorts) {
if (null == dataPort.getFromNode()) {
getComponent().removeInputPort((DynamicComponentPort) dataPort.getComponentPort());
portToBeRemoved = dataPort;
break;
}
}
if (null != portToBeRemoved) {
this.removeInputPort(portToBeRemoved);
}
}
Aggregations