Package org.drools.process.instance.context.exclusive

Examples of org.drools.process.instance.context.exclusive.ExclusiveGroupInstance


        if (exclusiveGroupInstances == null) {
          stream.writeInt(0);
        } else {
          stream.writeInt(exclusiveGroupInstances.size());
          for (ContextInstance contextInstance: exclusiveGroupInstances) {
            ExclusiveGroupInstance exclusiveGroupInstance = (ExclusiveGroupInstance) contextInstance;
            Collection<NodeInstance> groupNodeInstances = exclusiveGroupInstance.getNodeInstances();
            stream.writeInt(groupNodeInstances.size());
            for (NodeInstance nodeInstance: groupNodeInstances) {
              stream.writeLong(nodeInstance.getId());
            }
          }
View Full Code Here


            if (exclusiveGroupInstances == null) {
              stream.writeInt(0);
            } else {
              stream.writeInt(exclusiveGroupInstances.size());
              for (ContextInstance contextInstance: exclusiveGroupInstances) {
                ExclusiveGroupInstance exclusiveGroupInstance = (ExclusiveGroupInstance) contextInstance;
                Collection<NodeInstance> groupNodeInstances = exclusiveGroupInstance.getNodeInstances();
                stream.writeInt(groupNodeInstances.size());
                for (NodeInstance groupNodeInstance: groupNodeInstances) {
                  stream.writeLong(groupNodeInstance.getId());
                }
              }
View Full Code Here

            readNodeInstance(context, processInstance, processInstance);
        }

        int exclusiveGroupInstances = stream.readInt();
      for (int i = 0; i < exclusiveGroupInstances; i++) {
            ExclusiveGroupInstance exclusiveGroupInstance = new ExclusiveGroupInstance();
            processInstance.addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, exclusiveGroupInstance);
            int nodeInstances = stream.readInt();
            for (int j = 0; j < nodeInstances; j++) {
                long nodeInstanceId = stream.readLong();
                NodeInstance nodeInstance = processInstance.getNodeInstance(nodeInstanceId);
                if (nodeInstance == null) {
                  throw new IllegalArgumentException("Could not find node instance when deserializing exclusive group instance: " + nodeInstanceId);
                }
                exclusiveGroupInstance.addNodeInstance(nodeInstance);
            }
      }

        processInstance.internalSetNodeInstanceCounter(nodeInstanceCounter);
        if (wm != null) {
View Full Code Here

                            processInstance);
                }
               
                int exclusiveGroupInstances = stream.readInt();
              for (int i = 0; i < exclusiveGroupInstances; i++) {
                    ExclusiveGroupInstance exclusiveGroupInstance = new ExclusiveGroupInstance();
                    processInstance.addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, exclusiveGroupInstance);
                    int nodeInstances = stream.readInt();
                    for (int j = 0; j < nodeInstances; j++) {
                        long nodeInstanceId = stream.readLong();
                        NodeInstance groupNodeInstance = processInstance.getNodeInstance(nodeInstanceId);
                        if (groupNodeInstance == null) {
                          throw new IllegalArgumentException("Could not find node instance when deserializing exclusive group instance: " + nodeInstanceId);
                        }
                        exclusiveGroupInstance.addNodeInstance(groupNodeInstance);
                    }
              }

                break;
            case PersisterEnums.FOR_EACH_NODE_INSTANCE:
View Full Code Here

                }
                if (connections == null || connections.isEmpty()) {
                  ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
                    .nodeInstanceCompleted(this, type);
                } else {
                  ExclusiveGroupInstance groupInstance = new ExclusiveGroupInstance();
                org.drools.runtime.process.NodeInstanceContainer parent = getNodeInstanceContainer();
                  if (parent instanceof ContextInstanceContainer) {
                    ((ContextInstanceContainer) parent).addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, groupInstance);
                  } else {
                    throw new IllegalArgumentException(
                    "An Exclusive AND is only possible if the parent is a context instance container");
                  }
                  Map<NodeInstance, String> nodeInstances = new HashMap<NodeInstance, String>();
                  for (Connection connection: connections) {
                    nodeInstances.put(
                      ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
                          .getNodeInstance(connection.getTo()),
                      connection.getToType());
                  }
                  for (NodeInstance nodeInstance: nodeInstances.keySet()) {
                    groupInstance.addNodeInstance(nodeInstance);
                  }
                  for (Map.Entry<NodeInstance, String> entry: nodeInstances.entrySet()) {
                    // stop if this process instance has been aborted / completed
                    if (getProcessInstance().getState() != ProcessInstance.STATE_ACTIVE) {
                      return;
View Full Code Here

      NodeInstanceContainer parent = getNodeInstanceContainer();
      if (parent instanceof ContextInstanceContainer) {
        List<ContextInstance> contextInstances = ((ContextInstanceContainer) parent).getContextInstances(ExclusiveGroup.EXCLUSIVE_GROUP);
        if (contextInstances != null) {
          for (ContextInstance contextInstance: new ArrayList<ContextInstance>(contextInstances)) {
            ExclusiveGroupInstance groupInstance = (ExclusiveGroupInstance) contextInstance;
            if (groupInstance.containsNodeInstance(this)) {
              for (NodeInstance nodeInstance: groupInstance.getNodeInstances()) {
                if (nodeInstance != this) {
                  ((org.drools.workflow.instance.NodeInstance) nodeInstance).cancel();
                }
              }
              ((ContextInstanceContainer) parent).removeContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, contextInstance);
View Full Code Here

        if (exclusiveGroupInstances == null) {
          stream.writeInt(0);
        } else {
          stream.writeInt(exclusiveGroupInstances.size());
          for (ContextInstance contextInstance: exclusiveGroupInstances) {
            ExclusiveGroupInstance exclusiveGroupInstance = (ExclusiveGroupInstance) contextInstance;
            Collection<NodeInstance> groupNodeInstances = exclusiveGroupInstance.getNodeInstances();
            stream.writeInt(groupNodeInstances.size());
            for (NodeInstance nodeInstance: groupNodeInstances) {
              stream.writeLong(nodeInstance.getId());
            }
          }
View Full Code Here

            if (exclusiveGroupInstances == null) {
              stream.writeInt(0);
            } else {
              stream.writeInt(exclusiveGroupInstances.size());
              for (ContextInstance contextInstance: exclusiveGroupInstances) {
                ExclusiveGroupInstance exclusiveGroupInstance = (ExclusiveGroupInstance) contextInstance;
                Collection<NodeInstance> groupNodeInstances = exclusiveGroupInstance.getNodeInstances();
                stream.writeInt(groupNodeInstances.size());
                for (NodeInstance groupNodeInstance: groupNodeInstances) {
                  stream.writeLong(groupNodeInstance.getId());
                }
              }
View Full Code Here

            readNodeInstance(context, processInstance, processInstance);
        }

        int exclusiveGroupInstances = stream.readInt();
      for (int i = 0; i < exclusiveGroupInstances; i++) {
            ExclusiveGroupInstance exclusiveGroupInstance = new ExclusiveGroupInstance();
            processInstance.addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, exclusiveGroupInstance);
            int nodeInstances = stream.readInt();
            for (int j = 0; j < nodeInstances; j++) {
                long nodeInstanceId = stream.readLong();
                NodeInstance nodeInstance = processInstance.getNodeInstance(nodeInstanceId);
                if (nodeInstance == null) {
                  throw new IllegalArgumentException("Could not find node instance when deserializing exclusive group instance: " + nodeInstanceId);
                }
                exclusiveGroupInstance.addNodeInstance(nodeInstance);
            }
      }

        processInstance.internalSetNodeInstanceCounter(nodeInstanceCounter);
        if (wm != null) {
View Full Code Here

                            processInstance);
                }
               
                int exclusiveGroupInstances = stream.readInt();
              for (int i = 0; i < exclusiveGroupInstances; i++) {
                    ExclusiveGroupInstance exclusiveGroupInstance = new ExclusiveGroupInstance();
                    processInstance.addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, exclusiveGroupInstance);
                    int nodeInstances = stream.readInt();
                    for (int j = 0; j < nodeInstances; j++) {
                        long nodeInstanceId = stream.readLong();
                        NodeInstance groupNodeInstance = processInstance.getNodeInstance(nodeInstanceId);
                        if (groupNodeInstance == null) {
                          throw new IllegalArgumentException("Could not find node instance when deserializing exclusive group instance: " + nodeInstanceId);
                        }
                        exclusiveGroupInstance.addNodeInstance(groupNodeInstance);
                    }
              }

                break;
            case PersisterEnums.FOR_EACH_NODE_INSTANCE:
View Full Code Here

TOP

Related Classes of org.drools.process.instance.context.exclusive.ExclusiveGroupInstance

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.