Package org.drools.definition.process

Examples of org.drools.definition.process.Node


                event.getProcessInstance().getProcessName(),
                event.getProcessInstance().getId()) );
    }
   
    private String createNodeId(NodeInstance nodeInstance) {
      Node node = ((org.drools.workflow.instance.NodeInstance) nodeInstance).getNode();
      if (node == null) {
        return "";
      }
      String nodeId = "" + node.getId();
      NodeContainer nodeContainer = node.getNodeContainer();
      while (nodeContainer != null) {
        if (nodeContainer instanceof CompositeNode) {
          node = (CompositeNode) nodeContainer;
          nodeContainer = node.getNodeContainer();
          // filter out hidden compositeNode inside ForEach node
          if (!(nodeContainer instanceof ForEachNode)) {
              nodeId = node.getId() + ":" + nodeId;
          }
        } else {
          break;
        }
      }
View Full Code Here


        String toId = attrs.getValue( "to" );
        emptyAttributeCheck( localName, "to", toId, parser );
        String bendpoints = attrs.getValue( "bendpoints" );
       
        NodeContainer nodeContainer = (NodeContainer) parser.getParent();
        Node fromNode = nodeContainer.getNode( new Long(fromId) );
        Node toNode = nodeContainer.getNode( new Long(toId) );
       
        if ( fromNode == null ) {
                throw new SAXParseException( "Node '" + fromId + "' cannot be found",
                                             parser.getLocator() );
        }
View Full Code Here

  public static void linkConnections(NodeContainer nodeContainer, List<SequenceFlow> connections) {
    if (connections != null) {
      for (SequenceFlow connection: connections) {
        String sourceRef = connection.getSourceRef();
        String targetRef = connection.getTargetRef();
        Node source = null;
        Node target = null;
        try {
            // remove starting _
            sourceRef = sourceRef.substring(1);
            // remove ids of parent nodes
            sourceRef = sourceRef.substring(sourceRef.lastIndexOf("-") + 1);
            source = nodeContainer.getNode(new Integer(sourceRef));
        } catch (NumberFormatException e) {
            // try looking for a node with same "UniqueId" (in metadata)
            for (Node node: nodeContainer.getNodes()) {
                if (connection.getSourceRef().equals(node.getMetaData().get("UniqueId"))) {
                    source = node;
                    break;
                }
            }
                    if (source == null) {
                        throw new IllegalArgumentException("Could not find source node for connection:" + connection.getSourceRef());
                    }
        }
        try {
            // remove starting _
            targetRef = targetRef.substring(1);
                // remove ids of parent nodes
            targetRef = targetRef.substring(targetRef.lastIndexOf("-") + 1);
            target = nodeContainer.getNode(new Integer(targetRef));
        } catch (NumberFormatException e) {
            // try looking for a node with same "UniqueId" (in metadata)
                    for (Node node: nodeContainer.getNodes()) {
                        if (connection.getTargetRef().equals(node.getMetaData().get("UniqueId"))) {
                            target = node;
                            break;
                        }
                    }
                    if (target == null) {
                        throw new IllegalArgumentException("Could not find target node for connection:" + connection.getTargetRef());
                    }
        }
        Connection result = new ConnectionImpl(
          source, NodeImpl.CONNECTION_DEFAULT_TYPE,
          target, NodeImpl.CONNECTION_DEFAULT_TYPE);
        result.setMetaData("bendpoints", connection.getBendpoints());
        if (source instanceof Split) {
          Split split = (Split) source;
          Constraint constraint = new ConstraintImpl();
          String defaultConnection = (String) split.getMetaData("Default");
          if (defaultConnection != null && defaultConnection.equals(connection.getId())) {
            constraint.setDefault(true);
          }
          if (connection.getName() != null) {
            constraint.setName(connection.getName());
          } else {
            constraint.setName("");
          }
          if (connection.getType() != null) {
            constraint.setType(connection.getType());
          } else {
            constraint.setType("code");
          }
          if (connection.getLanguage() != null) {
            constraint.setDialect(connection.getLanguage());
          }
          if (connection.getExpression() != null) {
            constraint.setConstraint(connection.getExpression());
          }
          split.addConstraint(
            new ConnectionRef(target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE),
            constraint);
        }
      }
    }
  }
View Full Code Here

            if (node instanceof EventNode) {
                String attachedTo = (String) node.getMetaData().get("AttachedTo");
                if (attachedTo != null) {
                  String type = ((EventTypeFilter)
                        ((EventNode) node).getEventFilters().get(0)).getType();
                    Node attachedNode = null;
                    try {
                        // remove starting _
                        String attachedToString = attachedTo.substring(1);
                        // remove ids of parent nodes
                        attachedToString = attachedToString.substring(attachedToString.lastIndexOf("-") + 1);
View Full Code Here

                NodeInfo targetNodeInfo = processInfo.getNodeInfo(connectionInfo.getTargetRef());
                if (targetNodeInfo == null) {
                    throw new IllegalArgumentException(
                        "Could not find sourceRef for connection info: " + connectionInfo.getTargetRef());
                }
                Node sourceNode = null;
                for (Node node: process.getNodes()) {
                    String id = (String) XmlBPMNProcessDumper.getUniqueNodeId(node);
                    if (sourceNodeInfo.getNodeRef().equals(id)) {
                        sourceNode = node;
                        break;
                    }
                }
                if (sourceNode == null) {
                    throw new IllegalArgumentException(
                        "Could not find node for nodeRef: " + sourceNodeInfo.getNodeRef());
                }
                boolean found = false;
                for (List<Connection> outgoingConnections: sourceNode.getOutgoingConnections().values()) {
                    for (Connection connection: outgoingConnections) {
                        if (targetNodeInfo.getNodeRef().equals(XmlBPMNProcessDumper.getUniqueNodeId(connection.getTo()))) {
                            ((ConnectionImpl) connection).setMetaData(
                                "bendpoints", connectionInfo.getBendpoints());
                            found = true;
View Full Code Here

                event.getProcessInstance().getProcessName(),
                event.getProcessInstance().getId()) );
    }
   
    private String createNodeId(NodeInstance nodeInstance) {
        Node node = nodeInstance.getNode();
        if (node == null) {
            return "";
        }
        String nodeId = "" + node.getId();
        NodeContainer nodeContainer = node.getNodeContainer();
        while (nodeContainer != null) {
            if (nodeContainer instanceof Node) {
                node = (Node) nodeContainer;
                nodeContainer = node.getNodeContainer();
                // TODO fix this filter out hidden compositeNode inside ForEach node
                if (!(nodeContainer.getClass().getName().endsWith("ForEachNode"))) {
                    nodeId = node.getId() + ":" + nodeId;
                }
            } else {
                break;
            }
        }
View Full Code Here

                    throw new IllegalArgumentException( "OR split could not find at least one valid outgoing connection for split " + getSplit().getName() );
                }               
                break;
            case Split.TYPE_XAND :
              ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
                Node node = getNode();
                List<Connection> connections = null;
                if (node != null) {
                  connections = node.getOutgoingConnections(type);
                }
                if (connections == null || connections.isEmpty()) {
                  ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
                    .nodeInstanceCompleted(this, type);
                } else {
View Full Code Here

            triggerCompleted(workItem);
        }
    }
   
    public String getNodeName() {
      Node node = getNode();
      if (node == null) {
        String nodeName =  "[Dynamic]";
        WorkItem workItem = getWorkItem();
        if (workItem != null) {
          nodeName += " " + workItem.getParameter("TaskName");
View Full Code Here

          }
      }
    }
   
    public String getNodeName() {
      Node node = getNode();
      if (node == null) {
        return "[Dynamic] Sub Process";
      }
      return super.getNodeName();
    }
View Full Code Here

    public long getNodeId() {
        return this.nodeId;
    }
   
    public String getNodeName() {
      Node node = getNode();
      return node == null ? "" : node.getName();
    }
View Full Code Here

TOP

Related Classes of org.drools.definition.process.Node

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.