← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1958: minor fix in serialize dataset and dataelement (download all to mobile)

 

------------------------------------------------------------
revno: 1958
committer: Tran Ng Minh Luan <Luan@MinhLuan-PC>
branch nick: dhis2
timestamp: Tue 2010-10-26 01:03:14 +0700
message:
  minor fix in serialize dataset and dataelement (download all to mobile)
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileWrapper.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/MobileWrapper.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileWrapper.java	2010-10-25 12:24:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileWrapper.java	2010-10-25 18:03:14 +0000
@@ -49,31 +49,38 @@
 		ByteArrayOutputStream bout = new ByteArrayOutputStream();
         DataOutputStream dout = new DataOutputStream(bout);
         
-        dout.writeInt(programs.size());
+        if(programs != null){
+        	dout.writeInt(programs.size());
+        }else{
+        	dout.writeInt(0);
+        }
         
+        //Write ActivityPlans
         if(this.activityPlan == null){
         	dout.writeInt(0);
         }else{
         	this.activityPlan.serialize( dout );
         }
+        System.out.println("finish serialize ActivityPlan");
         
-        if(programs.size() > 0){
-        	dout.writeInt(programs.size());
-        }else{
+        //Write Programs        
 	        for(Program prog : programs){
 	        	prog.serialize( dout );
 	        }
-        }
+        System.out.println("finish serialize Programs");
         
+        //Write DataSets
         if(datasets != null){
         	dout.writeInt(datasets.size());
         }else{
         	dout.writeInt(0);
         }
         for(DataSet ds : datasets){
-        	ds.serialize();
+        	ds.serialize(dout);
         }
-        
+        System.out.println("finish serialize Datasets");
+        bout.flush();
+        bout.writeTo(out);
         
     }