[jboss-svn-commits] JBL Code SVN: r24636 - labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jan 9 08:43:36 EST 2009


Author: mfossati
Date: 2009-01-09 08:43:36 -0500 (Fri, 09 Jan 2009)
New Revision: 24636

Modified:
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java
Log:
look for null or empty properties and write a boolean to check that

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java	2009-01-09 13:39:38 UTC (rev 24635)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java	2009-01-09 13:43:36 UTC (rev 24636)
@@ -26,11 +26,8 @@
 		
 	}
 
-//	public void writeNodeInstance(MarshallerWriteContext context,
-//			NodeInstance nodeInstance) throws IOException {
-		
-//	}
 
+
 	@Override
 	protected void outputSpecificNodes(MarshallerWriteContext context,
 			NodeInstance nodeInstance) throws IOException {
@@ -38,11 +35,22 @@
 		ObjectOutputStream stream = context.stream;
 		if (nodeInstance instanceof StepNodeInstance) {
 			stream.writeShort(PersisterEnums.STEP_NODE_INSTANCE);
-			//stream.writeLong(((StepNodeInstance) nodeInstance).getEntryId()); //why this?
-			//stream.writeChars(((StepNodeInstance) nodeInstance).getOwner()); //why this? what happen if the owner is empty (like "")
 			stream.writeLong(((StepNodeInstance) nodeInstance).getNodeId());
-			stream.writeUTF(((StepNodeInstance) nodeInstance).getStatus());
-			stream.writeUTF(((StepNodeInstance) nodeInstance).getOwner());
+			String status = ((StepNodeInstance) nodeInstance).getStatus();
+			if (status == null || "".equals(status)) {
+				 stream.writeBoolean(false);
+			} else {
+				 stream.writeBoolean(true);
+				 stream.writeUTF(((StepNodeInstance) nodeInstance).getStatus());
+			}
+			String owner = ((StepNodeInstance) nodeInstance).getOwner();
+			if (owner == null || "".equals(owner)) {
+				 stream.writeBoolean(false);
+			} else {
+				 stream.writeBoolean(true);
+				 stream.writeUTF(((StepNodeInstance) nodeInstance).getOwner());
+			}
+			
 		}
 		
 	}
@@ -79,17 +87,8 @@
             }
         }
 
-//        int nbSwimlanes = stream.readInt();
-//        if ( nbSwimlanes > 0 ) {
-//            SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
-//            for ( int i = 0; i < nbSwimlanes; i++ ) {
-//                String name = stream.readUTF();
-//                String value = stream.readUTF();
-//                swimlaneContextInstance.setActorId( name,
-//                                                    value );
-//            }
-//        }
 
+
         while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
             readNodeInstance( context,
                               processInstance,
@@ -108,13 +107,14 @@
 		if (nodeType == PersisterEnums.STEP_NODE_INSTANCE) {
 			nodeInstance = new StepNodeInstance();
 			((StepNodeInstance)nodeInstance).setNodeId(stream.readLong());
-			((StepNodeInstance)nodeInstance).setStatus(stream.readUTF());
-			((StepNodeInstance)nodeInstance).setOwner(stream.readUTF());
+			if (stream.readBoolean()) {
+				 ((StepNodeInstance)nodeInstance).setStatus(stream.readUTF());
+			}
+			if (stream.readBoolean()) {
+				 ((StepNodeInstance)nodeInstance).setOwner(stream.readUTF());
+			}
 			
-			// if you make this indirection we lost the reference to nodeInstance that is used for the method that call this
-			//StepNodeInstance stepNodeInstance = (StepNodeInstance)nodeInstance; 
-			
-			//stepNodeInstance.setOwner(stream.readUTF());
+
 			return nodeInstance;
 		}
 		return null;




More information about the jboss-svn-commits mailing list