Package org.apache.airavata.xbaya.graph

Examples of org.apache.airavata.xbaya.graph.Port


     * @throws GraphException
     */
    private GpelAssignCopyFrom createAssignCopyFrom(Port port) throws GraphException {
        GpelAssignCopyFrom from = new GpelAssignCopyFrom(this.bpelNS);

        Port fromPort = port.getFromPort();
        Node fromNode = fromPort.getNode();
        if (fromNode instanceof InputNode) {
            from.setVariable(WORKFLOW_INPUT_NAME);
            from.setPart(WorkflowWSDL.INPUT_PART_NAME);
            from.setQuery("/" + this.typesNamespace.getPrefix() + ":"
                    + this.workflowWSDL.getWorkflowInputMessageElelmentName() + "/" + fromNode.getID());
        } else if (fromNode instanceof ConstantNode) {
            ConstantNode constNode = (ConstantNode) fromNode;
            Object value = constNode.getValue();
            // The namaspace and name of the literal element will be set
            // correctly in from.setLiteral().
            XmlElement literalElement = XMLUtil.BUILDER.newFragment(GpelAssignCopyFrom.LITERAL_EL);
            literalElement.addChild(value);
            from.setLiteral(literalElement);
        } else if (fromNode instanceof WSNode) {
            String fromID = fromNode.getID();
            WSComponent fromWsdlComponent = (WSComponent) fromNode.getComponent();

            WSComponentPort fromWsdlPort = (WSComponentPort) fromPort.getComponentPort();

            from.setVariable(fromID + OUTPUT_SUFFIX);
            from.setPart(fromWsdlComponent.getOutputPartName());

            if (fromWsdlPort.isSchemaUsed()) {
                String typesTargetNamespace = fromWsdlPort.getTargetNamespace();
                XmlNamespace namespace = XMLUtil.declareNamespaceIfNecessary(fromID.toLowerCase() + TYPENS_SUFFIX,
                        typesTargetNamespace, false, this.process.xml());

                from.setQuery("/" + namespace.getPrefix() + ":" + fromWsdlComponent.getOutputTypeName() + "/"
                        + fromWsdlPort.getName());
            } else {
                // No query needed?
            }
        } else if (fromNode instanceof ForEachNode) {
            from.setVariable(fromNode.getID() + FOREACH_VALUE_SUFFIX);
        } else if (fromNode instanceof EndForEachNode) {
            from.setVariable(fromNode.getID() + ARRAY_SUFIX);
        } else if (fromNode instanceof EndifNode) {
            // endif has multiple outputs, so we use port ID here.
            from.setVariable(fromPort.getID() + OUTPUT_SUFFIX);
        } else if (fromNode instanceof ReceiveNode) {
            if (fromPort instanceof EPRPort) {
                from.setPartnerLink(fromNode.getID() + PARTNER_LINK_NAME_SUFFIX);
                from.setEndpointReference("myRole");
            } else {
View Full Code Here


                }
            }
        }

        // Check control dependency.
        Port port = node.getControlInPort();
        if (port != null) {
            Collection<Node> fromNodes = port.getFromNodes();
            for (Node fromNode : fromNodes) {
                if (nodes.contains(fromNode)) {
                    return false;
                }
            }
View Full Code Here

        }
        // replace $1, $2,... with actual value.
        List<? extends Port> inputPorts = ifNode.getInputPorts();
        ArrayList<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        for (int i = 0; i < inputPorts.size(); i++) {
            Port port = inputPorts.get(i);
            Port fromPort = port.getFromPort();
            if (fromPort != null) {
                String variableName = port.getID() + INPUT_SUFFIX;

                GpelVariable ifVar = new GpelVariable(this.process.xml().getNamespace(), variableName);
                XmlNamespace xsdNS = process.xml().lookupNamespaceByName(WSConstants.XSD_NS_URI);
View Full Code Here

        for (int i = 0; i < outputPorts.size(); i++) {
            DataPort outputPort = outputPorts.get(i);
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            int index = ifBlock ? i : i + outputPorts.size();
            DataPort inputPort = endifNode.getInputPort(index);
            Port fromPort = inputPort.getFromPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
            GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
            to.setVariable(variable);
            GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
            copies.add(copy);
View Full Code Here

    private Set<Node> getIfBlock(Node node, boolean ifBlock) throws GraphException {
        Set<Node> block = new HashSet<Node>();

        int index = ifBlock ? 0 : 1;
        Port controlOutPort = node.getControlOutPorts().get(index);
        for (Node nextNode : controlOutPort.getToNodes()) {
            block.add(nextNode);
            getSpecialBlock(nextNode, 0, block, IfNode.class, EndifNode.class);
        }
        return block;
    }
View Full Code Here

        for (int i = 0; i < outputPorts.size(); i++) {
            DataPort outputPort = outputPorts.get(i);
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            int index = blockBlock ? i : i + outputPorts.size();
            DataPort inputPort = endBlockNode.getInputPort(index);
            Port fromPort = inputPort.getFromPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
            GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
            to.setVariable(variable);
            GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
            copies.add(copy);
View Full Code Here

    private Set<Node> getBlockBlock(Node node, boolean blockBlock) throws GraphException {
        Set<Node> block = new HashSet<Node>();

        int index = blockBlock ? 0 : 1;
        Port controlOutPort = node.getControlOutPorts().get(index);
        for (Node nextNode : controlOutPort.getToNodes()) {
            block.add(nextNode);
            getSpecialBlock(nextNode, 0, block, BlockNode.class, EndBlockNode.class);
        }
        return block;
    }
View Full Code Here

                node.getGUI().setDraggedFlag(true);
                this.panel.setCursor(SwingUtil.MOVE_CURSOR);
            }

        } else if (selected instanceof Port) {
            Port port = (Port) selected;
            port.getGUI().setSelectedFlag(true);
            switch (port.getKind()) {
            case DATA_IN:
            case CONTROL_IN:
                selectInputPort(port);
                break;
            case CONTROL_OUT:
View Full Code Here

                    connect(this.draggedPort, freePort);
                    this.dynamicNodeWithFreePort = null;
                }

            } else if (graphPiece instanceof Port) {
                Port port = (Port) graphPiece;
                if (this.draggedPort.getKind() == Kind.DATA_OUT && port.getKind() == Kind.DATA_IN) {
                    connect(this.draggedPort, port);
                } else if (port.getKind() == Kind.DATA_OUT && this.draggedPort.getKind() == Kind.DATA_IN) {
                    connect(port, this.draggedPort);
                } else if (this.draggedPort.getKind() == Kind.CONTROL_OUT && port.getKind() == Kind.CONTROL_IN) {
                    connect(this.draggedPort, port);
                } else if (this.draggedPort.getKind() == Kind.CONTROL_IN && port.getKind() == Kind.CONTROL_OUT) {
                    connect(port, this.draggedPort);
                } else if (this.draggedPort.getKind() == Kind.EPR && port.getKind() == Kind.DATA_IN) {
                    connect(this.draggedPort, port);
                } else if (this.draggedPort.getKind() == Kind.DATA_IN && port.getKind() == Kind.EPR) {
                    connect(port, this.draggedPort);
                }
            }
            this.draggedPort = null;
        }
View Full Code Here

        event.consume();
      }
      if (this.draggedPort != null) {
        GraphPiece piece = this.graph.getGUI().getGraphPieceAt(point);
        if (piece instanceof Port) {
          Port port = (Port) piece;
          // Display the information of port that is close to the mouse
          // pointer.
          if (this.draggedPort.getKind() == Kind.DATA_IN
              && port.getKind() == Kind.DATA_OUT) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectOutputPort(port);
          } else if (this.draggedPort.getKind() == Kind.DATA_OUT
              && port.getKind() == Kind.DATA_IN) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectInputPort(port);
          } else if (this.draggedPort.getKind() == Kind.DATA_IN
              && port.getKind() == Kind.EPR) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectOutputPort(port);
          } else if (this.draggedPort.getKind() == Kind.EPR
              && port.getKind() == Kind.DATA_IN) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectInputPort(port);
          } else {
            this.panel.setCursor(SwingUtil.DEFAULT_CURSOR);
          }
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.graph.Port

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.