Package org.jbpm.workflow.instance.node

Examples of org.jbpm.workflow.instance.node.CompositeContextNodeInstance


          if (nodeInstance instanceof DynamicNodeInstance) {
                stream.writeShort(PersisterEnums.DYNAMIC_NODE_INSTANCE);
          } else {
            stream.writeShort(PersisterEnums.COMPOSITE_NODE_INSTANCE);
          }
            CompositeContextNodeInstance compositeNodeInstance = (CompositeContextNodeInstance) nodeInstance;
            List<Long> timerInstances =
                ((CompositeContextNodeInstance) nodeInstance).getTimerInstances();
            if (timerInstances != null) {
                stream.writeInt(timerInstances.size());
                for (Long id : timerInstances) {
                    stream.writeLong(id);
                }
            } else {
                stream.writeInt(0);
            }
            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) compositeNodeInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
            if (variableScopeInstance == null) {
              stream.writeInt(0);
            } else {
              Map<String, Object> variables = variableScopeInstance.getVariables();
              List<String> keys = new ArrayList<String>(variables.keySet());
              Collections.sort(keys,
                      new Comparator<String>() {
                          public int compare(String o1,
                                  String o2) {
                              return o1.compareTo(o2);
                          }
                      });
              stream.writeInt(keys.size());
              for (String key : keys) {
                  stream.writeUTF(key);
                  stream.writeObject(variables.get(key));
              }
            }
            List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(compositeNodeInstance.getNodeInstances());
            Collections.sort(nodeInstances,
                    new Comparator<NodeInstance>() {

                        public int compare(NodeInstance o1,
                                NodeInstance o2) {
                            return (int) (o1.getId() - o2.getId());
                        }
                    });
            for (NodeInstance subNodeInstance : nodeInstances) {
                stream.writeShort(PersisterEnums.NODE_INSTANCE);
                writeNodeInstance(context,
                        subNodeInstance);
            }
            stream.writeShort(PersisterEnums.END);
            List<ContextInstance> exclusiveGroupInstances =
              compositeNodeInstance.getContextInstances(ExclusiveGroup.EXCLUSIVE_GROUP);
            if (exclusiveGroupInstances == null) {
              stream.writeInt(0);
            } else {
              stream.writeInt(exclusiveGroupInstances.size());
              for (ContextInstance contextInstance: exclusiveGroupInstances) {
View Full Code Here


                    }
                    ((JoinInstance) nodeInstance).internalSetTriggers(triggers);
                }
                break;
            case PersisterEnums.COMPOSITE_NODE_INSTANCE:
                nodeInstance = new CompositeContextNodeInstance();
                nbTimerInstances = stream.readInt();
                if (nbTimerInstances > 0) {
                    List<Long> timerInstances = new ArrayList<Long>();
                    for (int i = 0; i < nbTimerInstances; i++) {
                        timerInstances.add(stream.readLong());
View Full Code Here

TOP

Related Classes of org.jbpm.workflow.instance.node.CompositeContextNodeInstance

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.