use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class ConstantNode method edgeWasAdded.
/**
* Called whan an Edge was added to the parameter port. Change the name of this node.
*
* @throws GraphException
*
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
// TODO this method can be removed.
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
DataPort toDataPort = (DataPort) toPort;
DataType toType = toDataPort.getType();
List edges = getEdges();
if (edges.size() == 1) {
// The first edge.
this.type = toType;
} else if (edges.size() > 1) {
// Not the first edge.
if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !this.type.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 DoWhileNode method getFreeInPort.
public DataPort getFreeInPort() {
List<DataPort> inputPorts = this.getInputPorts();
for (DataPort dataPort : inputPorts) {
if (null == dataPort.getFromNode()) {
return dataPort;
}
}
addOutputPort();
return addInputPortAndReturn();
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class ParameterNode method getEdges.
protected List<DataEdge> getEdges() {
DataPort port = getPort();
List<DataEdge> edges = port.getEdges();
return edges;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class S3InputNode method getParameterType.
/**
* Returns the type of the parameter
*
* @return The type of the parameter (e.g. string, int)
*/
@Override
public DataType getParameterType() {
List<DataEdge> edges = getEdges();
DataType parameterType = super.getParameterType();
if (parameterType == null && getEdges().size() > 0) {
// This happens when the graph XML doesn't have parameterType.
DataEdge edge = edges.get(0);
DataPort toPort = edge.getToPort();
parameterType = toPort.getType();
}
return parameterType;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class S3InputNode method edgeWasAdded.
/**
* Called whan an Edge was added to the parameter port. Change the name of this node.
*
* @throws GraphException
*
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.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());
}
}
}
Aggregations