← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7347: [mobile] change model to support backward compatible

 

------------------------------------------------------------
revno: 7347
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-22 09:59:28 +0700
message:
  [mobile] change model to support backward compatible
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Activity.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityPlan.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityValue.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Beneficiary.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetValue.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataStreamSerializable.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataValue.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Model.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ModelList.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OrgUnits.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Task.java
  dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Activity.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Activity.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Activity.java	2012-06-22 02:59:28 +0000
@@ -137,15 +137,18 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8(DataOutputStream dout)
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        this.getTask().serializeVerssion2_8( dout );
+        this.getBeneficiary().serializeVerssion2_8( dout );
+        dout.writeBoolean( late );
+        dout.writeLong( this.getDueDate().getTime() );
+        dout.writeLong( this.getExpireDate().getTime() );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9(DataOutputStream dataOutputStream)
         throws IOException
     {
         // TODO Auto-generated method stub

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityPlan.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityPlan.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityPlan.java	2012-06-22 02:59:28 +0000
@@ -54,16 +54,15 @@
         this.activitiesList = activitiesList;
     }
 
-    public ActivityPlan( )
+    public ActivityPlan()
     {
     }
 
-    
     public ActivityPlan( List<Activity> activitiesList )
     {
         this.activitiesList = activitiesList;
     }
-    
+
     public String getClientVersion()
     {
         return clientVersion;
@@ -93,8 +92,6 @@
         }
 
     }
-    
-    
 
     @Override
     public void deSerialize( DataInputStream dataInputStream )
@@ -105,20 +102,30 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+
+        if ( activitiesList == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( activitiesList.size() );
+            for ( int i = 0; i < activitiesList.size(); i++ )
+            {
+                activitiesList.get( i ).serializeVerssion2_8( dout );
+            }
+        }
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityValue.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityValue.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityValue.java	2012-06-22 02:59:28 +0000
@@ -37,7 +37,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private int programInstanceId;
 
     private List<DataValue> dataValues = new ArrayList<DataValue>();
@@ -66,6 +66,16 @@
         return dataValues;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dataOutputStream )
         throws IOException
@@ -94,19 +104,19 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Beneficiary.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Beneficiary.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Beneficiary.java	2012-06-22 02:59:28 +0000
@@ -47,7 +47,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     @XmlAttribute
     private int id;
 
@@ -227,6 +227,16 @@
         this.lastName = lastName;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream out )
         throws IOException
@@ -316,10 +326,9 @@
     public void deSerialize( DataInputStream dataInputStream )
         throws IOException
     {
-        // FIXME: Get implementation from client
 
     }
-    
+
     @Override
     public boolean equals( Object otherObject )
     {
@@ -328,18 +337,97 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream out )
         throws IOException
     {
-        // TODO Auto-generated method stub
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        DataOutputStream dout = new DataOutputStream( bout );
+
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getFirstName() );
+        dout.writeUTF( this.getMiddleName() );
+        dout.writeUTF( this.getLastName() );
+        dout.writeInt( this.getAge() );
+
+        if ( gender != null )
+        {
+            dout.writeBoolean( true );
+            dout.writeUTF( gender );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
+
+        if ( dobType != null )
+        {
+            dout.writeBoolean( true );
+            dout.writeChar( dobType );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
+
+        if ( birthDate != null )
+        {
+            dout.writeBoolean( true );
+            dout.writeLong( birthDate.getTime() );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
         
+            dout.writeBoolean( false );
+
+        if ( registrationDate != null )
+        {
+            dout.writeBoolean( true );
+            dout.writeLong( registrationDate.getTime() );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
+
+        /*
+         * Write attribute which is used as group factor of beneficiary - false:
+         * no group factor, true: with group factor
+         */
+        if ( this.getGroupAttribute() != null )
+        {
+            dout.writeBoolean( true );
+            this.getGroupAttribute().serialize( dout );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
+
+        List<PatientAttribute> atts = this.getPatientAttValues();
+        dout.writeInt( atts.size() );
+        for ( PatientAttribute att : atts )
+        {
+            dout.writeUTF( att.getName() + ":" + att.getValue() );
+        }
+
+        // Write PatientIdentifier
+        dout.writeInt( identifiers.size() );
+        for ( PatientIdentifier each : identifiers )
+        {
+            each.serializeVerssion2_8( dout );
+        }
+
+        bout.flush();
+        bout.writeTo( out );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java	2012-06-22 02:59:28 +0000
@@ -87,6 +87,16 @@
     {
         this.compulsory = compulsory;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dout )
@@ -112,5 +122,29 @@
             }
         }
     }
+    
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
+        dout.writeUTF( this.getType() );
+        dout.writeBoolean( this.isCompulsory() );
+
+        List<Model> cateOptCombos = this.getCategoryOptionCombos().getModels();
+        if ( cateOptCombos == null || cateOptCombos.size() <= 0 )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( cateOptCombos.size() );
+            for ( Model each : cateOptCombos )
+            {
+               each.serializeVerssion2_8( dout );
+            }
+        }
+    }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java	2012-06-22 02:59:28 +0000
@@ -92,6 +92,16 @@
         this.sections = sections;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
@@ -116,6 +126,29 @@
     }
 
     @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
+        dout.writeInt( this.getVersion() );
+        dout.writeUTF( this.getPeriodType() );
+
+        if ( this.sections == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( this.sections.size() );
+            for ( Section section : this.sections )
+            {
+                section.serializeVerssion2_8( dout );
+            }
+        }
+    }
+
+    @Override
     public void deSerialize( DataInputStream dataInputStream )
         throws IOException
     {

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java	2012-06-22 02:59:28 +0000
@@ -90,6 +90,16 @@
     {
         this.currentDataSets = currentDataSets;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dout )
@@ -144,6 +154,60 @@
             dout.writeInt( 0 );
         }
     }
+    
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        if ( addedDataSets != null )
+        {
+            dout.writeInt( addedDataSets.size() );
+            for ( DataSet dataSet : addedDataSets )
+            {
+                dataSet.serialize( dout );
+            }
+        }
+        else
+        {
+            dout.writeInt( 0 );
+        }
+        if ( deletedDataSets != null )
+        {
+            dout.writeInt( deletedDataSets.size() );
+            for ( DataSet dataSet : deletedDataSets )
+            {
+                dataSet.serialize( dout );
+            }
+        }
+        else
+        {
+            dout.writeInt( 0 );
+        }
+        if ( modifiedDataSets != null )
+        {
+            dout.writeInt( modifiedDataSets.size() );
+            for ( DataSet dataSet : modifiedDataSets )
+            {
+                dataSet.serialize( dout );
+            }
+        }
+        else
+        {
+            dout.writeInt( 0 );
+        }
+        if ( currentDataSets != null )
+        {
+            dout.writeInt( currentDataSets.size() );
+            for ( DataSet dataSet : currentDataSets )
+            {
+                dataSet.serialize( dout );
+            }
+        }
+        else
+        {
+            dout.writeInt( 0 );
+        }
+    }
 
     @Override
     public void deSerialize( DataInputStream dataInputStream )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetValue.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetValue.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetValue.java	2012-06-22 02:59:28 +0000
@@ -81,6 +81,16 @@
     {
         return dataValues;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dataOutputStream )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataStreamSerializable.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataStreamSerializable.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataStreamSerializable.java	2012-06-22 02:59:28 +0000
@@ -49,10 +49,10 @@
     public void deSerialize( DataInputStream dataInputStream )
         throws IOException;
 
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException;
 
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException;
 
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataValue.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataValue.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataValue.java	2012-06-22 02:59:28 +0000
@@ -36,9 +36,9 @@
 public class DataValue
     implements DataStreamSerializable
 {
-    
+
     private int id;
-    
+
     private String clientVersion;
 
     private int categoryOptComboID;
@@ -78,6 +78,16 @@
         this.categoryOptComboID = categoryOptComboID;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dataOutputStream )
         throws IOException
@@ -96,19 +106,18 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java	2012-06-22 02:59:28 +0000
@@ -41,7 +41,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private ActivityPlan activityPlan;
 
     private List<Program> programs;
@@ -102,11 +102,95 @@
         this.locales = locales;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
     {
-
+        // if ( programs == null )
+        // {
+        // dout.writeInt( 0 );
+        // }
+        // else
+        // {
+        // dout.writeInt( programs.size() );
+        //
+        // for ( Program prog : programs )
+        // {
+        // prog.serialize( dout );
+        // }
+        // }
+        //
+        // // Write ActivityPlans
+        // if ( this.activityPlan == null )
+        // {
+        // dout.writeInt( 0 );
+        // }
+        // else
+        // {
+        // this.activityPlan.serialize( dout );
+        // }
+        //
+        // // Write current server's date
+        // dout.writeLong( serverCurrentDate.getTime() );
+        //
+        // // Write DataSets
+        // if ( datasets == null )
+        // {
+        // dout.writeInt( 0 );
+        // }
+        // else
+        // {
+        // dout.writeInt( datasets.size() );
+        // for ( DataSet ds : datasets )
+        // {
+        // ds.serialize( dout );
+        // }
+        // }
+        //
+        // // Write Locales
+        // if ( locales == null )
+        // {
+        // dout.writeInt( 0 );
+        // }
+        // else
+        // {
+        // dout.writeInt( locales.size() );
+        // for ( String locale : locales )
+        // {
+        // dout.writeUTF( locale );
+        // }
+        // }
+//        if ( this.getClientVersion().equals( DataStreamSerializable.TWO_POINT_EIGHT ) )
+//        {
+            this.serializeVerssion2_8( dout );
+//        }
+//        else
+//        {
+//            this.serializeVerssion2_9( dout );
+//        }
+    }
+
+    @Override
+    public void deSerialize( DataInputStream dataInputStream )
+        throws IOException
+    {
+
+    }
+
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
         if ( programs == null )
         {
             dout.writeInt( 0 );
@@ -117,7 +201,7 @@
 
             for ( Program prog : programs )
             {
-                prog.serialize( dout );
+                prog.serializeVerssion2_8( dout );
             }
         }
 
@@ -128,7 +212,7 @@
         }
         else
         {
-            this.activityPlan.serialize( dout );
+            this.activityPlan.serializeVerssion2_8( dout );
         }
 
         // Write current server's date
@@ -144,7 +228,7 @@
             dout.writeInt( datasets.size() );
             for ( DataSet ds : datasets )
             {
-                ds.serialize( dout );
+                ds.serializeVerssion2_8( dout );
             }
         }
 
@@ -165,27 +249,11 @@
     }
 
     @Override
-    public void deSerialize( DataInputStream dataInputStream )
-        throws IOException
-    {
-        // FIXME: Get implementation from client
-
-    }
-
-    @Override
-    public void serializeVerssion2Point8()
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-        
-    }
-
-    @Override
-    public void serializeVerssion2Point9()
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-        
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2012-06-22 02:59:28 +0000
@@ -34,12 +34,12 @@
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
-@XmlRootElement(name="orgUnit")
+@XmlRootElement( name = "orgUnit" )
 public class MobileOrgUnitLinks
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private int id;
 
     private String name;
@@ -53,9 +53,9 @@
     private String uploadActivityReportUrl;
 
     private String updateDataSetUrl;
-    
+
     private String changeUpdateDataSetLangUrl;
-    
+
     private String searchUrl;
 
     @XmlAttribute
@@ -118,7 +118,7 @@
     public void setUpdateDataSetUrl( String updateDataSetUrl )
     {
         this.updateDataSetUrl = updateDataSetUrl;
-    }    
+    }
 
     public String getChangeUpdateDataSetLangUrl()
     {
@@ -140,21 +140,33 @@
         this.searchUrl = searchUrl;
     }
 
-    public String getUpdateActivityPlanUrl() {
-		return updateActivityPlanUrl;
-	}
-
-	public void setUpdateActivityPlanUrl(String updateActivityPlanUrl) {
-		this.updateActivityPlanUrl = updateActivityPlanUrl;
-	}
-
-	public void serialize( DataOutputStream dataOutputStream )
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
+    public String getUpdateActivityPlanUrl()
+    {
+        return updateActivityPlanUrl;
+    }
+
+    public void setUpdateActivityPlanUrl( String updateActivityPlanUrl )
+    {
+        this.updateActivityPlanUrl = updateActivityPlanUrl;
+    }
+
+    public void serialize( DataOutputStream dataOutputStream )
         throws IOException
     {
         dataOutputStream.writeInt( this.id );
         dataOutputStream.writeUTF( this.name );
         dataOutputStream.writeUTF( this.downloadAllUrl );
-        dataOutputStream.writeUTF(this.updateActivityPlanUrl);
+        dataOutputStream.writeUTF( this.updateActivityPlanUrl );
         dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
         dataOutputStream.writeUTF( this.uploadActivityReportUrl );
         dataOutputStream.writeUTF( this.updateDataSetUrl );
@@ -177,19 +189,26 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dataOutputStream.writeInt( this.id );
+        dataOutputStream.writeUTF( this.name );
+        dataOutputStream.writeUTF( this.downloadAllUrl );
+        dataOutputStream.writeUTF( this.updateActivityPlanUrl );
+        dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
+        dataOutputStream.writeUTF( this.uploadActivityReportUrl );
+        dataOutputStream.writeUTF( this.updateDataSetUrl );
+        dataOutputStream.writeUTF( this.changeUpdateDataSetLangUrl );
+        dataOutputStream.writeUTF( this.searchUrl );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Model.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Model.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Model.java	2012-06-22 02:59:28 +0000
@@ -39,7 +39,7 @@
     private String clientVersion;
 
     private int id;
-    
+
     private String name;
 
     @XmlAttribute
@@ -64,6 +64,16 @@
         this.name = name;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
@@ -81,19 +91,19 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dout.writeInt( this.id );
+        dout.writeUTF( this.name );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ModelList.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ModelList.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ModelList.java	2012-06-22 02:59:28 +0000
@@ -39,7 +39,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private List<Model> models;
 
     @XmlElement( name = "model" )
@@ -53,6 +53,16 @@
         this.models = models;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dataOutputStream )
         throws IOException
@@ -68,7 +78,6 @@
         {
             models.get( i ).serialize( dataOutputStream );
         }
-
     }
 
     @Override
@@ -88,19 +97,29 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        if ( models == null )
+        {
+            dataOutputStream.writeInt( 0 );
+        }
+
+        dataOutputStream.writeInt( models.size() );
+
+        for ( int i = 0; i < models.size(); i++ )
+        {
+            models.get( i ).serialize( dataOutputStream );
+        }
+
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java	2012-06-22 02:59:28 +0000
@@ -23,6 +23,16 @@
     {
         this.options = options;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dout )
@@ -40,6 +50,21 @@
         }
 
     }
+    
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
+
+        dout.writeInt( this.options.size() );
+
+        for ( String option : this.options )
+        {
+            dout.writeUTF( option );
+        }
+    }
 
     @Override
     public void deSerialize( DataInputStream dataInputStream )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OrgUnits.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OrgUnits.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OrgUnits.java	2012-06-22 02:59:28 +0000
@@ -41,7 +41,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private List<MobileOrgUnitLinks> orgUnits = new ArrayList<MobileOrgUnitLinks>();
 
     public OrgUnits()
@@ -64,6 +64,16 @@
         this.orgUnits = orgUnits;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dataOutputStream )
         throws IOException
@@ -92,19 +102,22 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dataOutputStream.writeInt( orgUnits.size() );
+        for ( MobileOrgUnitLinks unit : orgUnits )
+        {
+            unit.serialize( dataOutputStream );
+        }
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java	2012-06-22 02:59:28 +0000
@@ -37,7 +37,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private String name;
 
     private String value;
@@ -74,6 +74,16 @@
         this.value = value;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
@@ -91,19 +101,19 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dout.writeUTF( this.name );
+        dout.writeUTF( this.value );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java	2012-06-22 02:59:28 +0000
@@ -37,7 +37,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private String identifierType;
 
     private String identifier;
@@ -74,6 +74,16 @@
         this.identifier = identifier;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dataOutputStream )
         throws IOException
@@ -91,19 +101,19 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dataOutputStream.writeUTF( identifierType );
+        dataOutputStream.writeUTF( identifier );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java	2012-06-22 02:59:28 +0000
@@ -60,6 +60,16 @@
     {
         this.programStages = programStages;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dout )
@@ -75,6 +85,21 @@
             programStage.serialize( dout );
         }
     }
+    
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
+        dout.writeInt( this.getVersion() );
+        dout.writeInt( programStages.size() );
+        for ( int i = 0; i < programStages.size(); i++ )
+        {
+            ProgramStage programStage = (ProgramStage) programStages.get( i );
+            programStage.serializeVerssion2_8( dout );
+        }
+    }
 
     @Override
     public void deSerialize( DataInputStream dataInputStream )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java	2012-06-22 02:59:28 +0000
@@ -48,12 +48,21 @@
     {
         this.dataElements = dataElements;
     }
+    
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
 
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
     {
-        // FIXME: Children should serialize themselves
         dout.writeInt( this.getId() );
         dout.writeUTF( this.getName() );
 
@@ -63,9 +72,23 @@
         {
             DataElement de = (DataElement) dataElements.get( i );
             de.serialize( dout );
-
         }
     }
+    
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
+
+        dout.writeInt( dataElements.size() );
+
+        for ( int i = 0; i < dataElements.size(); i++ )
+        {
+            DataElement de = (DataElement) dataElements.get( i );
+            de.serializeVerssion2_8( dout );        }
+    }
 
     @Override
     public void deSerialize( DataInputStream dataInputStream )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java	2012-06-22 02:59:28 +0000
@@ -37,7 +37,7 @@
     extends Model
 {
     private String clientVersion;
-    
+
     private List<DataElement> dataElements;
 
     @XmlElement( name = "dataElement" )
@@ -51,6 +51,16 @@
         this.dataElements = des;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
@@ -73,4 +83,26 @@
         }
     }
 
+    @Override
+    public void serializeVerssion2_8( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( getName() );
+
+        if ( dataElements == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( dataElements.size() );
+            for ( int i = 0; i < dataElements.size(); i++ )
+            {
+                DataElement de = (DataElement) dataElements.get( i );
+                de.serializeVerssion2_8( dout );
+            }
+        }
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Task.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Task.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Task.java	2012-06-22 02:59:28 +0000
@@ -35,7 +35,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private int id;
 
     private int programStageId;
@@ -84,6 +84,16 @@
         this.completed = completed;
     }
 
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
     @Override
     public void serialize( DataOutputStream dout )
         throws IOException
@@ -103,18 +113,20 @@
     }
 
     @Override
-    public void serializeVerssion2Point8()
+    public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        dout.writeInt( this.getId() );
+        dout.writeInt( this.getProgramStageId() );
+        dout.writeInt( this.getProgramId() );
+        dout.writeBoolean( this.isCompleted() );
     }
 
     @Override
-    public void serializeVerssion2Point9()
+    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
         // TODO Auto-generated method stub
-        
+
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2012-06-18 09:20:33 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2012-06-22 02:59:28 +0000
@@ -4,7 +4,6 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Locale;
-
 import org.hisp.dhis.api.mobile.ActivityReportingService;
 import org.hisp.dhis.api.mobile.FacilityReportingService;
 import org.hisp.dhis.api.mobile.IProgramService;
@@ -13,7 +12,6 @@
 import org.hisp.dhis.api.mobile.model.ActivityValue;
 import org.hisp.dhis.api.mobile.model.DataSetList;
 import org.hisp.dhis.api.mobile.model.DataSetValue;
-import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
 import org.hisp.dhis.api.mobile.model.MobileModel;
 import org.hisp.dhis.api.mobile.model.ModelList;
 import org.hisp.dhis.i18n.I18nService;
@@ -54,16 +52,9 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{id}/all" )
     @ResponseBody
-    public MobileModel getAllDataForOrgUnit( @PathVariable int id, @RequestHeader( "accept-language" ) String locale,
-        @RequestHeader( "client-version" ) String clientVersion )
+    public MobileModel getAllDataForOrgUnit( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
-        if ( clientVersion == null || clientVersion.equals( DataStreamSerializable.BLANK ) )
-        {
-            clientVersion = DataStreamSerializable.TWO_POINT_EIGHT;
-        }
-
         MobileModel mobileModel = new MobileModel();
-       
         OrganisationUnit unit = getUnit( id );
         mobileModel.setActivityPlan( activityReportingService.getCurrentActivityPlan( unit, locale ) );
         mobileModel.setPrograms( programService.getPrograms( unit, locale ) );