← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7398: [mobile] implement the fisrt working backward compatible server side

 

------------------------------------------------------------
revno: 7398
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-06-26 14:43:35 +0700
message:
  [mobile] implement the fisrt working backward compatible server side
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/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/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/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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Activity.java	2012-06-26 07:43:35 +0000
@@ -99,7 +99,7 @@
     {
         this.expireDate = expireDate;
     }
-    
+
     public String getClientVersion()
     {
         return clientVersion;
@@ -137,7 +137,7 @@
     }
 
     @Override
-    public void serializeVerssion2_8(DataOutputStream dout)
+    public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
         this.getTask().serializeVerssion2_8( dout );
@@ -148,11 +148,15 @@
     }
 
     @Override
-    public void serializeVerssion2_9(DataOutputStream dataOutputStream)
+    public void serializeVerssion2_9( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-        
+        this.getTask().serializeVerssion2_9( dout );
+        this.getBeneficiary().serializeVerssion2_9( dout );
+        dout.writeBoolean( late );
+        dout.writeLong( this.getDueDate().getTime() );
+        dout.writeLong( this.getExpireDate().getTime() );
+
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ActivityPlan.java	2012-06-26 07:43:35 +0000
@@ -105,7 +105,6 @@
     public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
     {
-
         if ( activitiesList == null )
         {
             dout.writeInt( 0 );
@@ -121,11 +120,21 @@
     }
 
     @Override
-    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+    public void serializeVerssion2_9( 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_9( dout );
+            }
+        }
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Beneficiary.java	2012-06-26 07:43:35 +0000
@@ -424,10 +424,83 @@
     }
 
     @Override
-    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+    public void serializeVerssion2_9( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-
+        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_9( dout );
+        }
     }
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java	2012-06-26 07:43:35 +0000
@@ -87,7 +87,7 @@
     {
         this.compulsory = compulsory;
     }
-    
+
     public String getClientVersion()
     {
         return clientVersion;
@@ -122,7 +122,7 @@
             }
         }
     }
-    
+
     @Override
     public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
@@ -142,9 +142,43 @@
             dout.writeInt( cateOptCombos.size() );
             for ( Model each : cateOptCombos )
             {
-               each.serializeVerssion2_8( dout );
-            }
-        }
+                each.serializeVerssion2_8( dout );
+            }
+        }
+    }
+
+    @Override
+    public void serializeVerssion2_9( 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_9( dout );
+            }
+        }
+
+        if ( optionSet == null || optionSet.getOptions().size() <= 0 )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            optionSet.serializeVerssion2_9( 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java	2012-06-26 07:43:35 +0000
@@ -147,6 +147,29 @@
             }
         }
     }
+    
+    @Override
+    public void serializeVerssion2_9( 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_9( 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/DataSetList.java'
--- 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
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java	2012-06-26 07:43:35 +0000
@@ -38,7 +38,7 @@
     implements DataStreamSerializable
 {
     private String clientVersion;
-    
+
     private List<DataSet> addedDataSets = new ArrayList<DataSet>();
 
     private List<DataSet> deletedDataSets = new ArrayList<DataSet>();
@@ -90,7 +90,7 @@
     {
         this.currentDataSets = currentDataSets;
     }
-    
+
     public String getClientVersion()
     {
         return clientVersion;
@@ -154,7 +154,7 @@
             dout.writeInt( 0 );
         }
     }
-    
+
     @Override
     public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
@@ -210,6 +210,60 @@
     }
 
     @Override
+    public void serializeVerssion2_9( 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 )
         throws IOException
     {

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetValue.java	2012-06-26 07:43:35 +0000
@@ -103,7 +103,6 @@
     public void deSerialize( DataInputStream din )
         throws IOException
     {
-
         this.setId( din.readInt() );
         this.setName( din.readUTF() );
         this.setPeriodName( din.readUTF() );

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java	2012-06-26 07:43:35 +0000
@@ -170,14 +170,14 @@
         // dout.writeUTF( locale );
         // }
         // }
-//        if ( this.getClientVersion().equals( DataStreamSerializable.TWO_POINT_EIGHT ) )
-//        {
+        if ( this.getClientVersion().equals( DataStreamSerializable.TWO_POINT_EIGHT ) )
+        {
             this.serializeVerssion2_8( dout );
-//        }
-//        else
-//        {
-//            this.serializeVerssion2_9( dout );
-//        }
+        }
+        else
+        {
+            this.serializeVerssion2_9( dout );
+        }
     }
 
     @Override
@@ -245,15 +245,66 @@
                 dout.writeUTF( locale );
             }
         }
-
     }
 
     @Override
-    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+    public void serializeVerssion2_9( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-
+        if ( programs == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( programs.size() );
+
+            for ( Program prog : programs )
+            {
+                prog.serializeVerssion2_9( dout );
+            }
+        }
+
+        // Write ActivityPlans
+        if ( this.activityPlan == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            this.activityPlan.serializeVerssion2_9( 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.serializeVerssion2_9( dout );
+            }
+        }
+
+        // Write Locales
+        if ( locales == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( locales.size() );
+            for ( String locale : locales )
+            {
+                dout.writeUTF( locale );
+            }
+        }
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2012-06-26 07:43:35 +0000
@@ -207,8 +207,15 @@
     public void serializeVerssion2_9( 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 );
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Model.java	2012-06-26 07:43:35 +0000
@@ -99,11 +99,11 @@
     }
 
     @Override
-    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+    public void serializeVerssion2_9( DataOutputStream dout )
         throws IOException
     {
-        // TODO Auto-generated method stub
-
+        dout.writeInt( this.id );
+        dout.writeUTF( this.name );
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ModelList.java	2012-06-26 07:43:35 +0000
@@ -118,8 +118,17 @@
     public void serializeVerssion2_9( 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 ).serializeVerssion2_9( dataOutputStream );
+        }
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java	2012-06-26 07:43:35 +0000
@@ -41,7 +41,6 @@
 
         dout.writeInt( this.getId() );
         dout.writeUTF( this.getName() );
-
         dout.writeInt( this.options.size() );
 
         for ( String option : this.options )
@@ -57,6 +56,20 @@
     {
         dout.writeInt( this.getId() );
         dout.writeUTF( this.getName() );
+        dout.writeInt( this.options.size() );
+
+        for ( String option : this.options )
+        {
+            dout.writeUTF( option );
+        }
+    }
+    
+    @Override
+    public void serializeVerssion2_9( DataOutputStream dout )
+        throws IOException
+    {
+        dout.writeInt( this.getId() );
+        dout.writeUTF( this.getName() );
 
         dout.writeInt( this.options.size() );
 
@@ -70,17 +83,14 @@
     public void deSerialize( DataInputStream dataInputStream )
         throws IOException
     {
-
         this.setId( dataInputStream.readInt() );
         this.setName( dataInputStream.readUTF() );
-
         int optionSize = dataInputStream.readInt();
 
         for ( int i = 0; i < optionSize; i++ )
         {
             String option = dataInputStream.readUTF();
             options.add( option );
-
         }
 
     }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OrgUnits.java	2012-06-26 07:43:35 +0000
@@ -116,7 +116,11 @@
     public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
+        dataOutputStream.writeInt( orgUnits.size() );
+        for ( MobileOrgUnitLinks unit : orgUnits )
+        {
+            unit.serializeVerssion2_9( dataOutputStream );
+        }
 
     }
 

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java	2012-06-26 07:43:35 +0000
@@ -112,8 +112,8 @@
     public void serializeVerssion2_9( DataOutputStream dataOutputStream )
         throws IOException
     {
-        // TODO Auto-generated method stub
-
+        dataOutputStream.writeUTF( identifierType );
+        dataOutputStream.writeUTF( identifier );
     }
 
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java	2012-06-26 07:43:35 +0000
@@ -100,6 +100,21 @@
             programStage.serializeVerssion2_8( dout );
         }
     }
+    
+    @Override
+    public void serializeVerssion2_9( 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_9( 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java	2012-06-26 07:43:35 +0000
@@ -36,7 +36,7 @@
     extends Model
 {
     private String clientVersion;
-    
+
     private List<DataElement> dataElements;
 
     public List<DataElement> getDataElements()
@@ -48,7 +48,7 @@
     {
         this.dataElements = dataElements;
     }
-    
+
     public String getClientVersion()
     {
         return clientVersion;
@@ -74,7 +74,7 @@
             de.serialize( dout );
         }
     }
-    
+
     @Override
     public void serializeVerssion2_8( DataOutputStream dout )
         throws IOException
@@ -87,7 +87,24 @@
         for ( int i = 0; i < dataElements.size(); i++ )
         {
             DataElement de = (DataElement) dataElements.get( i );
-            de.serializeVerssion2_8( dout );        }
+            de.serializeVerssion2_8( dout );
+        }
+    }
+
+    @Override
+    public void serializeVerssion2_9( 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_9( dout );
+        }
     }
 
     @Override

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java	2012-06-26 07:43:35 +0000
@@ -104,5 +104,27 @@
             }
         }
     }
+    
+    @Override
+    public void serializeVerssion2_9( 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_9( 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-22 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Task.java	2012-06-26 07:43:35 +0000
@@ -123,10 +123,13 @@
     }
 
     @Override
-    public void serializeVerssion2_9( DataOutputStream dataOutputStream )
+    public void serializeVerssion2_9( 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() );
 
     }
 }

=== 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-22 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2012-06-26 07:43:35 +0000
@@ -12,6 +12,7 @@
 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;
@@ -55,10 +56,26 @@
     public MobileModel getAllDataForOrgUnit( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         MobileModel mobileModel = new MobileModel();
-        OrganisationUnit unit = getUnit( id );
-        mobileModel.setActivityPlan( activityReportingService.getCurrentActivityPlan( unit, locale ) );
-        mobileModel.setPrograms( programService.getPrograms( unit, locale ) );
-
+        mobileModel.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
+        OrganisationUnit unit = getUnit( id );
+        mobileModel.setActivityPlan( activityReportingService.getCurrentActivityPlan( unit, locale ) );
+        mobileModel.setPrograms( programService.getPrograms( unit, locale ) );
+        mobileModel.setDatasets( facilityReportingService.getMobileDataSetsForUnit( unit, locale ) );
+        mobileModel.setServerCurrentDate( new Date() );
+        mobileModel.setLocales( getLocalStrings( i18nService.getAvailableLocales() ) );
+        return mobileModel;
+    }
+    
+    @RequestMapping( method = RequestMethod.GET, value = "{id}/all/2.9" )
+    @ResponseBody
+    public MobileModel getAllDataForOrgUnit2_9( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
+    {
+        System.out.println("download all 2.9");
+        MobileModel mobileModel = new MobileModel();
+        mobileModel.setClientVersion( DataStreamSerializable.TWO_POINT_NINE );
+        OrganisationUnit unit = getUnit( id );
+        mobileModel.setActivityPlan( activityReportingService.getCurrentActivityPlan( unit, locale ) );
+        mobileModel.setPrograms( programService.getPrograms( unit, locale ) );
         mobileModel.setDatasets( facilityReportingService.getMobileDataSetsForUnit( unit, locale ) );
         mobileModel.setServerCurrentDate( new Date() );
         mobileModel.setLocales( getLocalStrings( i18nService.getAvailableLocales() ) );