use of org.apache.airavata.workflow.model.graph.DataEdge in project airavata by apache.
the class ForEachNode method edgeWasAdded.
/**
* @param edge
* @throws GraphException
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
// XXX cannot detect if the type is array or not from WSDL at this
// point. so no check here.
// super.edgeWasAdded(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) {
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.DataEdge in project airavata by apache.
the class ConstantNode method getEdges.
private 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 SystemDataPort method copyType.
/**
* @param port
* @param arrayIncrement
* @throws GraphException
*/
public void copyType(DataPort port, int arrayIncrement) throws GraphException {
DataType newType = port.getType();
if (this.type != newType) {
this.type = newType;
if (port instanceof WSPort) {
WSPort wsPort = (WSPort) port;
this.wsComponentPort = wsPort.getComponentPort();
this.arrayDimension = 0;
} else if (port instanceof SystemDataPort) {
SystemDataPort systemPort = (SystemDataPort) port;
this.wsComponentPort = systemPort.getWSComponentPort();
this.arrayDimension = systemPort.getArrayDimension() + arrayIncrement;
}
// propagate to other ports of this node.
getNode().portTypeChanged(this);
// propagate to the connected ports.
Kind kind = getKind();
for (DataEdge edge : getEdges()) {
if (kind == Kind.DATA_IN) {
DataPort fromPort = edge.getFromPort();
fromPort.copyType(this);
} else if (kind == Kind.DATA_OUT) {
DataPort toPort = edge.getToPort();
toPort.copyType(this);
} else {
throw new WorkflowRuntimeException();
}
}
}
}
use of org.apache.airavata.workflow.model.graph.DataEdge in project airavata by apache.
the class DifferedInputNode 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;
}
Aggregations