← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2124: Fixed/changed serialization

 

------------------------------------------------------------
revno: 2124
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-11-21 17:07:49 +0530
message:
  Fixed/changed serialization
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java	2010-11-18 06:08:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java	2010-11-21 11:37:49 +0000
@@ -88,19 +88,24 @@
     public void serialize( DataOutputStream dout )
         throws IOException
     {
+        this.getTask().serialize( dout );
         this.getBeneficiary().serialize( dout );
         dout.writeBoolean( late );
-        this.getTask().serialize( dout );
         dout.writeLong( this.getDueDate().getTime() );
-
     }
-
+    
     @Override
     public void deSerialize( DataInputStream dataInputStream )
         throws IOException
     {
-        // FIXME: Get implementation from client
-
+        this.task = new Task();
+        task.deSerialize( dataInputStream );
+        
+        this.beneficiary = new Beneficiary();
+        beneficiary.deSerialize( dataInputStream );
+        
+        this.late = dataInputStream.readBoolean();
+        this.dueDate = new Date(dataInputStream.readLong());
     }
 
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java	2010-11-18 06:08:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java	2010-11-21 11:37:49 +0000
@@ -62,17 +62,7 @@
             dout.writeInt( activitiesList.size() );
             for ( int i = 0; i < activitiesList.size(); i++ )
             {
-                Activity activity = (Activity) activitiesList.get( i );
-                dout.writeLong( activity.getDueDate().getTime() );
-                dout.writeBoolean( activity.isLate() );
-
-                Beneficiary b = activity.getBeneficiary();
-                b.serialize( dout );
-
-                Task t = activity.getTask();
-                dout.writeInt( t.getId() );
-                dout.writeInt( t.getProgramStageId() );
-                dout.writeBoolean( t.isCompleted() );
+                activitiesList.get( i ).serialize( dout );
             }
         }