Package edu.indiana.extreme.xbaya.graph.system

Examples of edu.indiana.extreme.xbaya.graph.system.EndForEachNode


        } else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
            node = new ConstantNode(nodeElement);
        } 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_MEMO.equals(type)) {
View Full Code Here


    /**
     * @see edu.indiana.extreme.xbaya.component.Component#createNode(edu.indiana.extreme.xbaya.graph.Graph)
     */
    @Override
    public Node createNode(Graph graph) {
        EndForEachNode node = new EndForEachNode(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

    node.getGUI().setBodyColor(NodeState.FINISHED.color);
  }

  private void handleForEach(Node node) throws XBayaException {
    final ForEachNode forEachNode = (ForEachNode) node;
    EndForEachNode endForEachNode = null;
    Collection<Node> repeatNodes = node.getOutputPort(0).getToNodes();
    // we will support only one for now
    if (repeatNodes.size() != 1) {
      throw new WorkFlowInterpreterException("Only one node allowed inside foreach");
    }
    Iterator<Node> iterator = repeatNodes.iterator();
    if (iterator.hasNext()) {

      Node middleNode = iterator.next();

      if (!(middleNode instanceof WSNode)) {
        throw new WorkFlowInterpreterException("Encountered Node inside foreach that is not a WSNode" + middleNode);
      }
      Iterator<Node> endForEachNodeItr = middleNode.getOutputPort(0).getToNodes().iterator();
      while (endForEachNodeItr.hasNext()) {
        Node node2 = endForEachNodeItr.next();
        if (!(node2 instanceof EndForEachNode)) {
          throw new WorkFlowInterpreterException("Found More than one node inside foreach");
        } else {
          endForEachNode = (EndForEachNode) node2;
        }

      }
      final WSNode foreachWSNode = (WSNode) middleNode;
      WorkflowInvoker workflowInvoker = this.invokerMap.get(forEachNode.getInputPort(0).getFromNode());
      final LinkedList<String> listOfValues = new LinkedList<String>();
      if (workflowInvoker != null) {
        if (workflowInvoker instanceof GenericInvoker) {
          String message = ((GenericInvoker) workflowInvoker).getOutputs().toString();
          XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString(message);
          Iterator children = msgElmt.children().iterator();
          while (children.hasNext()) {
            Object object = children.next();
            if (object instanceof XmlElement) {
              XmlElement child = (XmlElement) object;
              Iterator valItr = child.children().iterator();
              if (valItr.hasNext()) {
                Object object2 = valItr.next();
                if (object2 instanceof String) {
                  listOfValues.add(object2.toString());
                }

              }
            }

          }
        }
        if (listOfValues.size() > 0) {
          forEachNode.getGUI().setBodyColor(NodeState.EXECUTING.color);
          foreachWSNode.getGUI().setBodyColor(NodeState.EXECUTING.color);
          endForEachNode.getGUI().setBodyColor(NodeState.EXECUTING.color);
          final EndForEachNode tempendForEachNode = endForEachNode;
          final SystemComponentInvoker systemInvoker = new SystemComponentInvoker();
          this.invokerMap.put(endForEachNode, systemInvoker);
          new Thread() {
            @Override
            public void run() {
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.graph.system.EndForEachNode

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.