[jboss-svn-commits] JBL Code SVN: r33675 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jun 28 17:01:20 EDT 2010


Author: KrisVerlaenen
Date: 2010-06-28 17:01:19 -0400 (Mon, 28 Jun 2010)
New Revision: 33675

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/AbstractProcessInstanceMarshaller.java
Log:
 - timer instances not always marshalled correctly

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/AbstractProcessInstanceMarshaller.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/AbstractProcessInstanceMarshaller.java	2010-06-28 17:13:26 UTC (rev 33674)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/AbstractProcessInstanceMarshaller.java	2010-06-28 21:01:19 UTC (rev 33675)
@@ -143,15 +143,55 @@
             throws IOException {
         if (nodeInstance instanceof RuleSetNodeInstance) {
             stream.writeShort(PersisterEnums.RULE_SET_NODE_INSTANCE);
+            List<Long> timerInstances =
+                ((RuleSetNodeInstance) nodeInstance).getTimerInstances();
+	        if (timerInstances != null) {
+	            stream.writeInt(timerInstances.size());
+	            for (Long id : timerInstances) {
+	                stream.writeLong(id);
+	            }
+	        } else {
+	            stream.writeInt(0);
+	        }
         } else if (nodeInstance instanceof HumanTaskNodeInstance) {
             stream.writeShort(PersisterEnums.HUMAN_TASK_NODE_INSTANCE);
             stream.writeLong(((HumanTaskNodeInstance) nodeInstance).getWorkItemId());
+            List<Long> timerInstances =
+                ((HumanTaskNodeInstance) nodeInstance).getTimerInstances();
+	        if (timerInstances != null) {
+	            stream.writeInt(timerInstances.size());
+	            for (Long id : timerInstances) {
+	                stream.writeLong(id);
+	            }
+	        } else {
+	            stream.writeInt(0);
+	        }
         } else if (nodeInstance instanceof WorkItemNodeInstance) {
             stream.writeShort(PersisterEnums.WORK_ITEM_NODE_INSTANCE);
             stream.writeLong(((WorkItemNodeInstance) nodeInstance).getWorkItemId());
+            List<Long> timerInstances =
+                ((WorkItemNodeInstance) nodeInstance).getTimerInstances();
+	        if (timerInstances != null) {
+	            stream.writeInt(timerInstances.size());
+	            for (Long id : timerInstances) {
+	                stream.writeLong(id);
+	            }
+	        } else {
+	            stream.writeInt(0);
+	        }
         } else if (nodeInstance instanceof SubProcessNodeInstance) {
             stream.writeShort(PersisterEnums.SUB_PROCESS_NODE_INSTANCE);
             stream.writeLong(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId());
+            List<Long> timerInstances =
+                ((SubProcessNodeInstance) nodeInstance).getTimerInstances();
+	        if (timerInstances != null) {
+	            stream.writeInt(timerInstances.size());
+	            for (Long id : timerInstances) {
+	                stream.writeLong(id);
+	            }
+	        } else {
+	            stream.writeInt(0);
+	        }
         } else if (nodeInstance instanceof MilestoneNodeInstance) {
             stream.writeShort(PersisterEnums.MILESTONE_NODE_INSTANCE);
             List<Long> timerInstances =
@@ -442,22 +482,54 @@
         switch (nodeType) {
             case PersisterEnums.RULE_SET_NODE_INSTANCE:
                 nodeInstance = new RuleSetNodeInstance();
+                int nbTimerInstances = stream.readInt();
+                if (nbTimerInstances > 0) {
+                    List<Long> timerInstances = new ArrayList<Long>();
+                    for (int i = 0; i < nbTimerInstances; i++) {
+                        timerInstances.add(stream.readLong());
+                    }
+                    ((RuleSetNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+                }
                 break;
             case PersisterEnums.HUMAN_TASK_NODE_INSTANCE:
                 nodeInstance = new HumanTaskNodeInstance();
                 ((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId(stream.readLong());
+                nbTimerInstances = stream.readInt();
+                if (nbTimerInstances > 0) {
+                    List<Long> timerInstances = new ArrayList<Long>();
+                    for (int i = 0; i < nbTimerInstances; i++) {
+                        timerInstances.add(stream.readLong());
+                    }
+                    ((HumanTaskNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+                }
                 break;
             case PersisterEnums.WORK_ITEM_NODE_INSTANCE:
                 nodeInstance = new WorkItemNodeInstance();
                 ((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId(stream.readLong());
+                nbTimerInstances = stream.readInt();
+                if (nbTimerInstances > 0) {
+                    List<Long> timerInstances = new ArrayList<Long>();
+                    for (int i = 0; i < nbTimerInstances; i++) {
+                        timerInstances.add(stream.readLong());
+                    }
+                    ((WorkItemNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+                }
                 break;
             case PersisterEnums.SUB_PROCESS_NODE_INSTANCE:
                 nodeInstance = new SubProcessNodeInstance();
                 ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId(stream.readLong());
+                nbTimerInstances = stream.readInt();
+                if (nbTimerInstances > 0) {
+                    List<Long> timerInstances = new ArrayList<Long>();
+                    for (int i = 0; i < nbTimerInstances; i++) {
+                        timerInstances.add(stream.readLong());
+                    }
+                    ((SubProcessNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+                }
                 break;
             case PersisterEnums.MILESTONE_NODE_INSTANCE:
                 nodeInstance = new MilestoneNodeInstance();
-                int nbTimerInstances = stream.readInt();
+                nbTimerInstances = stream.readInt();
                 if (nbTimerInstances > 0) {
                     List<Long> timerInstances = new ArrayList<Long>();
                     for (int i = 0; i < nbTimerInstances; i++) {



More information about the jboss-svn-commits mailing list