Package org.apache.airavata.workflow.model.graph.system

Examples of org.apache.airavata.workflow.model.graph.system.IfNode


    } else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
      node = new ForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
      node = new EndForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
      node = new IfNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
      node = new EndifNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
      node = new DoWhileNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
View Full Code Here


    /**
     * @see org.apache.airavata.workflow.model.component.Component#createNode(org.apache.airavata.workflow.model.graph.Graph)
     */
    @Override
    public Node createNode(Graph graph) {
        IfNode node = new IfNode(graph);

        node.setName(NAME);
        node.setComponent(this);

        // Creates a unique ID for the node. This has to be after setName().
        node.createID();

        createPorts(node);

        return node;
    }
View Full Code Here

      }
    }
  }

  private void handleIf(Node node) throws WorkflowException {
    IfNode ifNode = (IfNode) node;

    /*
     * Get all input to check condition
     */
    String booleanExpression = ifNode.getXPath();
    if (booleanExpression == null) {
      throw new WorkFlowInterpreterException("XPath for if cannot be null");
    }

    List<DataPort> inputPorts = node.getInputPorts();
View Full Code Here

      }
    }
  }

  private void handleIf(Node node) throws WorkflowException {
    IfNode ifNode = (IfNode) node;

    /*
     * Get all input to check condition
     */
    String booleanExpression = ifNode.getXPath();
    if (booleanExpression == null) {
      throw new WorkFlowInterpreterException("XPath for if cannot be null");
    }

    List<DataPort> inputPorts = node.getInputPorts();
View Full Code Here

      }
    }
  }

  private void handleIf(Node node) throws WorkflowException {
    IfNode ifNode = (IfNode) node;

    /*
     * Get all input to check condition
     */
    String booleanExpression = ifNode.getXPath();
    if (booleanExpression == null) {
      throw new WorkFlowInterpreterException("XPath for if cannot be null");
    }

    List<DataPort> inputPorts = node.getInputPorts();
View Full Code Here

      }
    }
  }

  private void handleIf(Node node) throws WorkflowException {
    IfNode ifNode = (IfNode) node;

    /*
     * Get all input to check condition
     */
    String booleanExpression = ifNode.getXPath();
    if (booleanExpression == null) {
      throw new WorkFlowInterpreterException("XPath for if cannot be null");
    }

    List<DataPort> inputPorts = node.getInputPorts();
View Full Code Here

      }
    }
  }

  private void handleIf(Node node) throws WorkflowException {
    IfNode ifNode = (IfNode) node;

    /*
     * Get all input to check condition
     */
    String booleanExpression = ifNode.getXPath();
    if (booleanExpression == null) {
      throw new WorkFlowInterpreterException("XPath for if cannot be null");
    }

    List<DataPort> inputPorts = node.getInputPorts();
View Full Code Here

        // const0
        ConstantNode const0 = (ConstantNode) workflow.addNode(this.constantComponent);
        const0.setPosition(new Point(20, 180));

        // if
        IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
        ifNode.setPosition(new Point(170, 180));

        // Adder nodes
        Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);

        Node adder = workflow.addNode(adderComp);
        adder.setPosition(new Point(400, 10));

        // Multiplier node
        Component multiComp = this.componentRegistry.getComponent(Multiplier.WSDL_PATH);

        Node multiplier = workflow.addNode(multiComp);
        multiplier.setPosition(new Point(400, 90));

        // endif
        Node endif = workflow.addNode(this.endifComponent);
        endif.setPosition(new Point(550, 40));

        // Output
        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
        output.setConfiguredName("output");
        output.setPosition(new Point(700, 40));

        // Connect ports
        graph.addEdge(x.getOutputPort(0), adder.getInputPort(0));
        graph.addEdge(x.getOutputPort(0), multiplier.getInputPort(0));
        graph.addEdge(y.getOutputPort(0), adder.getInputPort(1));
        graph.addEdge(y.getOutputPort(0), multiplier.getInputPort(1));
        graph.addEdge(const0.getOutputPort(0), ifNode.getInputPort(0));
        graph.addEdge(ifNode.getControlOutPorts().get(0), adder.getControlInPort());
        graph.addEdge(ifNode.getControlOutPorts().get(1), multiplier.getControlInPort());
        graph.addEdge(adder.getOutputPort(0), endif.getInputPort(0));
        graph.addEdge(multiplier.getOutputPort(0), endif.getInputPort(1));
        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        x.setDefaultValue("2");
        y.setDefaultValue("3");
        const0.setValue("adder");
        ifNode.setXPath("$0 = 'adder'");

        return workflow;
    }
View Full Code Here

        // amount
        InputNode amount = (InputNode) workflow.addNode(this.inputComponent);
        amount.setPosition(new Point(10, 10));

        // if
        IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
        ifNode.setPosition(new Point(200, 100));

        // Approver nodes
        Component approverComponent = this.componentRegistry.getComponent(Approver.WSDL_PATH);

        Node approver = workflow.addNode(approverComponent);
        approver.setPosition(new Point(350, 10));

        // const
        ConstantNode constYes = (ConstantNode) workflow.addNode(this.constantComponent);
        constYes.setPosition(new Point(350, 200));

        // endif
        Node endif = workflow.addNode(this.endifComponent);
        endif.setPosition(new Point(550, 100));

        // Output
        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
        output.setPosition(new Point(700, 100));

        // Connect ports
        graph.addEdge(amount.getOutputPort(0), approver.getInputPort(0));
        graph.addEdge(amount.getOutputPort(0), ifNode.getInputPort(0));
        graph.addEdge(ifNode.getControlOutPorts().get(0), approver.getControlInPort());
        graph.addEdge(ifNode.getControlOutPorts().get(1), constYes.getControlInPort());
        graph.addEdge(approver.getOutputPort(0), endif.getInputPort(0));
        graph.addEdge(constYes.getOutputPort(0), endif.getInputPort(1));
        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        amount.setDefaultValue("500");
        constYes.setValue("Yes");
        ifNode.setXPath("$0 > 1000");
        output.setConfiguredName("accept");
        output.setConfigured(true);

        return workflow;
    }
View Full Code Here

        // const0
        ConstantNode const0 = (ConstantNode) workflow.addNode(this.constantComponent);
        const0.setPosition(new Point(20, 180));

        // if
        IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
        ifNode.setPosition(new Point(170, 180));

        // Adder nodes
        Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);

        Node adder = workflow.addNode(adderComp);
        adder.setPosition(new Point(400, 10));

        // Multiplier node
        Component multiComp = this.componentRegistry.getComponent(Multiplier.WSDL_PATH);

        Node multiplier = workflow.addNode(multiComp);
        multiplier.setPosition(new Point(400, 90));

        // endif
        Node endif = workflow.addNode(this.endifComponent);
        endif.setPosition(new Point(550, 40));

        // Output
        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
        output.setConfiguredName("output");
        output.setPosition(new Point(700, 40));

        // Connect ports
        graph.addEdge(x.getOutputPort(0), adder.getInputPort(0));
        graph.addEdge(x.getOutputPort(0), multiplier.getInputPort(0));
        graph.addEdge(y.getOutputPort(0), adder.getInputPort(1));
        graph.addEdge(y.getOutputPort(0), multiplier.getInputPort(1));
        graph.addEdge(const0.getOutputPort(0), ifNode.getInputPort(0));
        graph.addEdge(ifNode.getControlOutPorts().get(0), adder.getControlInPort());
        graph.addEdge(ifNode.getControlOutPorts().get(1), multiplier.getControlInPort());
        graph.addEdge(adder.getOutputPort(0), endif.getInputPort(0));
        graph.addEdge(multiplier.getOutputPort(0), endif.getInputPort(1));
        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        x.setDefaultValue("2");
        y.setDefaultValue("3");
        const0.setValue("adder");
        ifNode.setXPath("$0 = 'adder'");

        return workflow;
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.system.IfNode

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.