Search in sources :

Example 26 with DataEdge

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();
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) Port(org.apache.airavata.workflow.model.graph.Port) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 27 with DataEdge

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;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge)

Example 28 with DataEdge

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();
            }
        }
    }
}
Also used : WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataType(org.apache.airavata.model.application.io.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 29 with DataEdge

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;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataType(org.apache.airavata.model.application.io.DataType)

Aggregations

DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)29 DataPort (org.apache.airavata.workflow.model.graph.DataPort)23 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)12 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)12 Port (org.apache.airavata.workflow.model.graph.Port)11 DataType (org.apache.airavata.model.application.io.DataType)10 GraphException (org.apache.airavata.workflow.model.graph.GraphException)9 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)8 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)5 WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)4 ControlEdge (org.apache.airavata.workflow.model.graph.ControlEdge)4 Edge (org.apache.airavata.workflow.model.graph.Edge)4 EdgeImpl (org.apache.airavata.workflow.model.graph.impl.EdgeImpl)4 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)3 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)2 Node (org.apache.airavata.workflow.model.graph.Node)2 SystemDataPort (org.apache.airavata.workflow.model.graph.system.SystemDataPort)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1