use of org.apache.airavata.workflow.model.graph.DataEdge in project airavata by apache.
the class OutputNode method edgeWasRemoved.
/**
* Called whan an Edge was removed from the parameter port. Change the name of the node.
*
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasRemoved(org.apache.airavata.workflow.model.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasRemoved(Edge removedEdge) {
super.edgeWasRemoved(removedEdge);
// TODO organize
List<DataEdge> edges = getEdges();
if (edges.size() == 0) {
setParameterType(null);
if (!isConfigured()) {
// Reset
setName(OutputComponent.NAME);
setDescription("");
setMetadata(null);
}
} else if (edges.size() == 1) {
// This happens when the second edges was wrongly added and removed.
} else {
// Should not happen
throw new WorkflowRuntimeException("edges.size(): " + edges.size());
}
}
use of org.apache.airavata.workflow.model.graph.DataEdge 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.DataEdge in project airavata by apache.
the class S3InputNode method edgeWasRemoved.
/**
* Called whan an Edge was removed from the parameter port. Change the name of the node.
*
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasRemoved(org.apache.airavata.workflow.model.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasRemoved(Edge removedEdge) {
super.edgeWasRemoved(removedEdge);
// TODO organize this.
List<DataEdge> edges = getEdges();
if (edges.size() == 0) {
setParameterType(null);
if (!isConfigured()) {
// Reset
setName(getComponent().getName());
setDescription("");
setDefaultValue(null);
setMetadata(null);
}
} else {
Edge edge = edges.get(0);
Port toPort = edge.getToPort();
WSPort toWsPort = (WSPort) toPort;
DataType toType = toWsPort.getType();
setParameterType(toType);
if (!isConfigured()) {
// Copy
copyDefaultConfiguration(toWsPort);
}
}
}
use of org.apache.airavata.workflow.model.graph.DataEdge 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.DataEdge 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