← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11383: support off-line storage for LWUIT, spelling mistake fix

 

------------------------------------------------------------
revno: 11383
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-11 14:56:43 +0700
message:
  support off-line storage for LWUIT, spelling mistake fix
added:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileModel.java
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/IProgramService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java
  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-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm


--
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/IProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/IProgramService.java	2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/IProgramService.java	2013-07-11 07:56:43 +0000
@@ -38,6 +38,10 @@
     public List<Program> getPrograms( OrganisationUnit unit, String localeString );
 
     public Program getProgram( int programId, String localeString );
+    
+    public List<org.hisp.dhis.api.mobile.model.LWUITmodel.Program> getProgramsLWUIT( OrganisationUnit unit );
+    
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.Program getProgramLWUIT( int programId );
 
     public List<Program> updateProgram( ModelList programsFromClient, String localeString, OrganisationUnit unit );
 

=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileModel.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileModel.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileModel.java	2013-07-11 07:56:43 +0000
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.api.mobile.model.LWUITmodel;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
+import org.hisp.dhis.api.mobile.model.Model;
+
+/**
+ * @author Nguyen Kim Lai
+ * 
+ * @version MobileModel.java 2:57:06 PM Jul 1, 2013 $
+ */
+public class MobileModel
+    implements DataStreamSerializable
+{
+    private String clientVersion;
+
+    private List<Program> programs;
+
+    private Date serverCurrentDate;
+
+    public void serialize( DataOutputStream dout )
+        throws IOException
+    {
+        if ( programs == null )
+        {
+            dout.writeInt( 0 );
+        }
+        else
+        {
+            dout.writeInt( programs.size() );
+            System.out.println( programs.size() );
+            for ( Program prog : programs )
+            {
+                prog.setClientVersion( DataStreamSerializable.TWO_POINT_TEN );
+                prog.serialize( dout );
+            }
+        }
+        // Write current server's date
+        dout.writeLong( serverCurrentDate.getTime() );
+    }
+
+    public List<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    public void setPrograms( List<Program> programs )
+    {
+        this.programs = programs;
+    }
+
+    public Date getServerCurrentDate()
+    {
+        return serverCurrentDate;
+    }
+
+    public void setServerCurrentDate( Date serverCurrentDate )
+    {
+        this.serverCurrentDate = serverCurrentDate;
+    }
+
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
+    @Override
+    public void deSerialize( DataInputStream dataInputStream )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void serializeVersion2_8( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void serializeVersion2_9( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void serializeVersion2_10( 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/LWUITmodel/Patient.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java	2013-05-15 03:23:45 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java	2013-07-11 07:56:43 +0000
@@ -31,10 +31,10 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.net.IDN;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+
 import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
 import org.hisp.dhis.api.mobile.model.PatientAttribute;
 import org.hisp.dhis.api.mobile.model.PatientIdentifier;
@@ -59,8 +59,6 @@
 
     private List<PatientAttribute> patientAttValues;
 
-    private PatientAttribute groupAttribute;
-
     private List<PatientIdentifier> identifiers;
 
     private String gender;
@@ -72,6 +70,10 @@
     private Character dobType;
 
     private List<Program> programs;
+    
+    //private List<Integer> programsID;
+    
+    //private Map<Integer, String> patientDataValues;
 
     private List<Program> enrollmentPrograms;
 
@@ -103,6 +105,26 @@
         this.programs = programs;
     }
 
+    /*public List<Integer> getProgramsID()
+    {
+        return programsID;
+    }
+
+    public void setProgramsID( List<Integer> programsID )
+    {
+        this.programsID = programsID;
+    }
+    
+    public Map<Integer, String> getPatientDataValues()
+    {
+        return patientDataValues;
+    }
+
+    public void setPatientDataValues( Map<Integer, String> patientDataValues )
+    {
+        this.patientDataValues = patientDataValues;
+    }*/
+
     public List<Relationship> getRelationships()
     {
         return relationships;
@@ -199,16 +221,6 @@
         this.age = age;
     }
 
-    public PatientAttribute getGroupAttribute()
-    {
-        return groupAttribute;
-    }
-
-    public void setGroupAttribute( PatientAttribute groupAttribute )
-    {
-        this.groupAttribute = groupAttribute;
-    }
-
     public List<PatientAttribute> getPatientAttValues()
     {
         return patientAttValues;
@@ -310,8 +322,16 @@
         dout.writeUTF( this.getFirstName() );
         dout.writeUTF( this.getMiddleName() );
         dout.writeUTF( this.getLastName() );
-        dout.writeInt( this.getAge() );
-        dout.writeUTF( this.getOrganisationUnitName() );
+        
+        if ( organisationUnitName != null )
+        {
+            dout.writeBoolean( true );
+            dout.writeUTF( organisationUnitName );
+        }
+        else
+        {
+            dout.writeBoolean( false );
+        }
 
         if ( gender != null )
         {
@@ -365,27 +385,20 @@
             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 )
+        // Write Patient Attribute
+        if ( patientAttValues != null )
         {
-            dout.writeBoolean( true );
-            this.getGroupAttribute().serialize( dout );
+            dout.writeInt( patientAttValues.size() );
+            for ( PatientAttribute patientAtt : patientAttValues )
+            {
+                patientAtt.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() );
-        }
-
+            dout.writeInt( 0 );
+        }
+        
         // Write PatientIdentifier
         if ( identifiers != null )
         {
@@ -395,6 +408,10 @@
                 each.serialize( dout );
             }
         }
+        else
+        {
+            dout.writeInt( 0 );
+        }
 
         // Write Program
         dout.writeInt( programs.size() );
@@ -402,7 +419,20 @@
         {
             each.serialize( dout );
         }
+        /*dout.writeInt( programsID.size() );
+        for ( Integer each : programsID )
+        {
+            dout.writeInt( each );
+        }
 
+        // Write Patient Data Value
+        dout.writeInt( patientDataValues.keySet().size() );
+        for ( Integer key : patientDataValues.keySet() )
+        {
+            dout.writeInt( key );
+            dout.writeUTF( patientDataValues.get( key ) );
+        }*/
+        
         // Write Relationships
         dout.writeInt( relationships.size() );
         for ( Relationship each : relationships )
@@ -418,7 +448,7 @@
             each.serialize( dout );
         }
 
-        // Write Enrolled
+        // Write Enrolled Relationships
 
         dout.writeInt( enrollmentRelationships.size() );
         for ( Relationship each : enrollmentRelationships )
@@ -436,9 +466,30 @@
     {
         this.setId( din.readInt() );
         this.setFirstName( din.readUTF() );
-        this.setGender( din.readUTF() );
-        this.setPhoneNumber( din.readUTF() );
-
+        this.setMiddleName( din.readUTF() );
+        this.setLastName( din.readUTF() );
+        
+        // Org Name
+        if ( din.readBoolean() )
+        {
+            this.setOrganisationUnitName( din.readUTF() );
+        }
+        else
+        {
+            this.setOrganisationUnitName( null );
+        }
+        
+        // Gender
+        if ( din.readBoolean() )
+        {
+            this.setGender( din.readUTF() );
+        }
+        else
+        {
+            this.setGender( null );
+        }
+        
+        // DOB Type
         if ( din.readBoolean() )
         {
             char dobTypeDeserialized = din.readChar();
@@ -448,7 +499,8 @@
         {
             this.setDobType( null );
         }
-
+        
+        // DOB
         if ( din.readBoolean() )
         {
             this.setBirthDate( new Date( din.readLong() ) );
@@ -458,29 +510,131 @@
             this.setBirthDate( null );
         }
 
-        // atts & identifiers
+        // doesn't transfer blood group to client
+        din.readBoolean();
+        
+        // Registration Date
+        if ( din.readBoolean() )
+        {
+            this.setRegistrationDate( new Date( din.readLong() ) );
+        }
+        else
+        {
+            this.setRegistrationDate( null );
+        }
 
-        this.patientAttValues = new ArrayList<PatientAttribute>();
+        // Phone Number
+        if ( din.readBoolean() )
+        {
+            this.setPhoneNumber( din.readUTF() );
+        }
+        else
+        {
+            this.setPhoneNumber( null );
+        }
+        
+        // Patient Attribute & Identifiers
         int attsNumb = din.readInt();
-        for ( int j = 0; j < attsNumb; j++ )
-        {
-            PatientAttribute pa = new PatientAttribute();
-            pa.deSerialize( din );
-            this.patientAttValues.add( pa );
-
-        }
-
-        this.identifiers = new ArrayList<PatientIdentifier>();
+        if( attsNumb > 0 )
+        {
+            this.patientAttValues = new ArrayList<PatientAttribute>();
+            for ( int j = 0; j < attsNumb; j++ )
+            {
+                PatientAttribute pa = new PatientAttribute();
+                pa.deSerialize( din );
+                this.patientAttValues.add( pa );
+            }
+        }
+        else
+        {
+            this.patientAttValues = null;
+        }
+
         int numbIdentifiers = din.readInt();
-
-        for ( int i = 0; i < numbIdentifiers; i++ )
-        {
-            PatientIdentifier identifier = new PatientIdentifier();
-            identifier.deSerialize( din );
-            this.identifiers.add( identifier );
-
-        }
-
+        if ( numbIdentifiers > 0 )
+        {
+            this.identifiers = new ArrayList<PatientIdentifier>();
+            for ( int i = 0; i < numbIdentifiers; i++ )
+            {
+                PatientIdentifier identifier = new PatientIdentifier();
+                identifier.deSerialize( din );
+                this.identifiers.add( identifier );
+    
+            }
+        }
+        else
+        {
+            this.identifiers = null;
+        }
+        
+        // Program & Relationship
+        int numbPrograms = din.readInt();
+        if ( numbPrograms > 0 )
+        {
+            this.programs = new ArrayList<Program>();
+            for ( int i = 0; i < numbPrograms; i++ )
+            {
+                Program program = new Program();
+                program.deSerialize( din );
+                this.programs.add( program );
+    
+            }
+        }
+        else
+        {
+            this.programs = null;
+        }
+        
+        int numbRelationships = din.readInt();
+        if ( numbRelationships > 0 )
+        {
+            this.relationships = new ArrayList<Relationship>();
+            for ( int i = 0; i < numbRelationships; i++ )
+            {
+                Relationship relationship = new Relationship();
+                relationship.deSerialize( din );
+                this.relationships.add( relationship );
+    
+            }
+        }
+        else
+        {
+            this.relationships = null;
+        }
+        
+        int numbEnrollmentPrograms = din.readInt();
+        if ( numbEnrollmentPrograms > 0 )
+        {
+            this.enrollmentPrograms = new ArrayList<Program>();
+            for ( int i = 0; i < numbEnrollmentPrograms; i++ )
+            {
+                Program program = new Program();
+                program.deSerialize( din );
+                this.enrollmentPrograms.add( program );
+    
+            }
+        }
+        else
+        {
+            this.enrollmentPrograms = null;
+        }
+        
+        int numbEnrollmentRelationships = din.readInt();
+        if ( numbEnrollmentRelationships > 0 )
+        {
+            this.enrollmentRelationships = new ArrayList<Relationship>();
+            for ( int i = 0; i < numbEnrollmentRelationships; i++ )
+            {
+                Relationship relationship = new Relationship();
+                relationship.deSerialize( din );
+                this.enrollmentRelationships.add( relationship );
+    
+            }
+        }
+        else
+        {
+            this.enrollmentRelationships = null;
+        }
     }
 
     @Override
@@ -583,168 +737,14 @@
     public void serializeVersion2_8( DataOutputStream out )
         throws IOException
     {
-        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 );
-        }
-        // doesn't transfer blood group to client
-        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.serializeVersion2_8( dout );
-        }
-
-        bout.flush();
-        bout.writeTo( out );
+        // TODO Auto-generated method stub
     }
 
     @Override
     public void serializeVersion2_9( DataOutputStream dout )
         throws IOException
     {
-        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 );
-        }
-        // doesn't transfer blood group to client
-        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.serializeVersion2_9( dout );
-        }
+        // TODO Auto-generated method stub
     }
 
     @Override
@@ -752,7 +752,6 @@
         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/LWUITmodel/ProgramStageDataElement.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java	2013-03-29 07:39:49 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java	2013-07-11 07:56:43 +0000
@@ -97,7 +97,15 @@
             optionSet.serialize( dout );
         }
         
-        dout.writeUTF( this.getValue() );
+        if ( this.getValue() == null )
+        {
+            dout.writeBoolean( false );
+        }
+        else
+        {
+            dout.writeBoolean( true );
+            dout.writeUTF( this.getValue() );
+        }
     }
     
     @Override
@@ -127,7 +135,15 @@
             this.optionSet = new OptionSet();
             this.optionSet.deSerialize( dint );
         }
-        this.setValue( dint.readUTF() );
+
+        if ( dint.readBoolean() == false )
+        {
+            this.setValue( null );
+        }
+        else
+        {
+            this.setValue( dint.readUTF() );
+        }
     }
     
     public String getClientVersion()

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-05-24 06:05:04 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-07-11 07:56:43 +0000
@@ -476,10 +476,8 @@
             }
             else
             {
-                // org.hisp.dhis.api.mobile.model.LWUITmodel.Patient
-                // patientMobile = getPatientModel( orgUnitId, patients.get( 0 )
-                // );
                 org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientMobile = getPatientModel( patients.get( 0 ) );
+                
                 return patientMobile;
             }
         }
@@ -487,10 +485,8 @@
         {
             Patient patient = patientService.getPatient( Integer.parseInt( keyword ) );
 
-            // org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientMobile =
-            // getPatientModel( orgUnitId, patient );
             org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientMobile = getPatientModel( patient );
-            System.out.println( "patient mobile2: " + patientMobile.getPrograms() );
+            
             return patientMobile;
         }
 
@@ -506,9 +502,10 @@
             Patient patient = patientService.getPatient( patientId );
             ProgramStageInstance prStageInstance = programStageInstanceService
                 .getProgramStageInstance( mobileProgramStage.getId() );
+            ProgramStage programStage = programStageService.getProgramStage( prStageInstance.getProgramStage().getId() );
+            //ProgramStage programStage = programStageService.getProgramStage( mobileProgramStage.getId() );
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-            ProgramStage programStage = programStageService.getProgramStage( prStageInstance.getProgramStage().getId() );
-
+            
             // ---------------------------------------------------------------------
             // Add a new program-instance
             // ---------------------------------------------------------------------
@@ -565,7 +562,25 @@
         {
             ProgramStageInstance programStageInstance = programStageInstanceService
                 .getProgramStageInstance( mobileProgramStage.getId() );
+            
+            /*//Begin Changes
+            ProgramStage programStage = programStageService.getProgramStage( mobileProgramStage.getId() );
+            Patient patient = patientService.getPatient( patientId );
+            Program program = programStage.getProgram();
+            
+            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program );
+            ProgramStageInstance programStageInstance = null;
+            for ( ProgramInstance each : programInstances )
+            {
+                if( each.getStatus()==ProgramInstance.STATUS_ACTIVE )
+                {
+                    programStageInstance = programStageInstanceService.getProgramStageInstance( each, programStage );
+                    break;
+                }
+            }
 
+            //End Changes
+*/            
             List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement> dataElements = mobileProgramStage
                 .getDataElements();
 
@@ -608,7 +623,7 @@
                 {
                     if ( dataElements.get( i ).isCompulsory() == true )
                     {
-                        if ( dataElements.get( i ).getValue().equals( "" ) )
+                        if ( dataElements.get( i ).getValue() == null )
                         {
                             programStageInstance.setCompleted( false );
                             // break;
@@ -625,11 +640,9 @@
                     programInstance.setStatus( ProgramInstance.STATUS_COMPLETED );
                     programInstanceService.updateProgramInstance( programInstance );
                 }
-
                 return PROGRAM_STAGE_UPLOADED;
             }
         }
-
     }
 
     private boolean isAllProgramStageFinished( ProgramStageInstance programStageInstance )
@@ -699,8 +712,6 @@
             }
 
         }
-
-        // return getPatientModel( orgUnitId, patient );
         return getPatientModel( patient );
     }
 
@@ -710,6 +721,7 @@
 
     private Activity getActivity( ProgramStageInstance instance, boolean late )
     {
+        
         Activity activity = new Activity();
         Patient patient = instance.getProgramInstance().getPatient();
 
@@ -826,8 +838,6 @@
     }
 
     // get patient model for LWUIT
-    // private org.hisp.dhis.api.mobile.model.LWUITmodel.Patient
-    // getPatientModel( int orgUnitId, Patient patient )
     private org.hisp.dhis.api.mobile.model.LWUITmodel.Patient getPatientModel( Patient patient )
     {
         org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientModel = new org.hisp.dhis.api.mobile.model.LWUITmodel.Patient();
@@ -878,19 +888,6 @@
 
         }
 
-        // Set attribute which is used to group beneficiary on mobile (only if
-        // there is attribute which is set to be group factor)
-        PatientAttribute patientAttribute = null;
-
-        if ( groupByAttribute != null )
-        {
-            patientAttribute = new PatientAttribute();
-            patientAttribute.setName( groupByAttribute.getName() );
-            PatientAttributeValue value = patientAttValueService.getPatientAttributeValue( patient, groupByAttribute );
-            patientAttribute.setValue( value == null ? "Unknown" : value.getValue() );
-            patientModel.setGroupAttribute( patientAttribute );
-        }
-
         // Set all identifier
         Set<PatientIdentifier> patientIdentifiers = patient.getIdentifiers();
         List<org.hisp.dhis.api.mobile.model.PatientIdentifier> identifiers = new ArrayList<org.hisp.dhis.api.mobile.model.PatientIdentifier>();
@@ -923,6 +920,7 @@
 
         List<ProgramInstance> listOfProgramInstance = new ArrayList<ProgramInstance>(
             programInstanceService.getProgramInstances( patient ) );
+        
         if ( listOfProgramInstance.size() > 0 )
         {
             for ( ProgramInstance each : listOfProgramInstance )
@@ -932,11 +930,37 @@
         }
 
         patientModel.setPrograms( mobileProgramList );
+        /*List<Integer> mobileProgramIDList = new ArrayList<Integer>();
+        for ( Program eachProgram : patient.getPrograms())
+        {
+            mobileProgramIDList.add( eachProgram.getId() );
+        }
+        patientModel.setProgramsID( mobileProgramIDList );
+        
+        // Set patient Data value for off-line storage function
+        Map<Integer, String> patientDataValues = new HashMap<Integer, String>();
+        for ( ProgramInstance eachProgramInstance : programInstanceService.getProgramInstances( patient, ProgramInstance.STATUS_ACTIVE ) )
+        {
+            for ( ProgramStageInstance eachProgramStageInstance : eachProgramInstance.getProgramStageInstances() )
+            {
+                for ( PatientDataValue each : patientDataValueService.getPatientDataValues( eachProgramStageInstance ) )
+                {
+                    if( each.getValue() != null && !each.getValue().isEmpty())
+                    {
+                        Integer dataElementID = each.getDataElement().getId();
+                        String value = each.getValue();
+                        patientDataValues.put( dataElementID, value );
+                    }
+                }
+            }
+        }
+        patientModel.setPatientDataValues( patientDataValues );*/
 
         // Set Relationship
         List<Relationship> relationships = new ArrayList<Relationship>(
             relationshipService.getRelationshipsForPatient( patient ) );
         List<org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship> relationshipList = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship>();
+
         for ( Relationship eachRelationship : relationships )
         {
             org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship relationshipMobile = new org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship();
@@ -945,11 +969,17 @@
             {
                 relationshipMobile.setName( eachRelationship.getRelationshipType().getaIsToB() );
                 relationshipMobile.setPersonBName( eachRelationship.getPatientB().getFullName() );
+                relationshipMobile.setPersonBId( eachRelationship.getPatientB().getId() );
+                //relationshipMobile.setPersonAName( eachRelationship.getPatientA().getFullName() );
+                //relationshipMobile.setPersonAId( eachRelationship.getPatientA().getId() );
             }
             else
             {
                 relationshipMobile.setName( eachRelationship.getRelationshipType().getbIsToA() );
                 relationshipMobile.setPersonBName( eachRelationship.getPatientA().getFullName() );
+                relationshipMobile.setPersonBId( eachRelationship.getPatientA().getId() );
+                //relationshipMobile.setPersonAName( eachRelationship.getPatientB().getFullName() );
+                //relationshipMobile.setPersonAId( eachRelationship.getPatientB().getId() );
             }
             relationshipList.add( relationshipMobile );
         }
@@ -1091,6 +1121,7 @@
 
             mobileDataElement.setNumberType( programStageDataElement.getDataElement().getNumberType() );
 
+            // Value
             PatientDataValue patientDataValue = dataValueService.getPatientDataValue( programStageInstance,
                 programStageDataElement.getDataElement() );
             if ( patientDataValue != null )
@@ -1099,17 +1130,21 @@
             }
             else
             {
-                mobileDataElement.setValue( "" );
+                mobileDataElement.setValue( null );
             }
+            
+            // Option set
             if ( programStageDataElement.getDataElement().getOptionSet() != null )
             {
-                mobileDataElement.setOptionSet( modelMapping.getLWUITOptionSet( programStageDataElement
+                mobileDataElement.setOptionSet( modelMapping.getOptionSet( programStageDataElement
                     .getDataElement() ) );
             }
             else
             {
                 mobileDataElement.setOptionSet( null );
             }
+            
+            // Category Option Combo
             if ( programStageDataElement.getDataElement().getCategoryCombo() != null )
             {
                 mobileDataElement.setCategoryOptionCombos( modelMapping
@@ -1374,7 +1409,7 @@
 
             if ( programStageDataElement.getDataElement().getOptionSet() != null )
             {
-                mobileDataElement.setOptionSet( modelMapping.getLWUITOptionSet( programStageDataElement
+                mobileDataElement.setOptionSet( modelMapping.getOptionSet( programStageDataElement
                     .getDataElement() ) );
             }
             else

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2012-05-06 18:55:26 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2013-07-11 07:56:43 +0000
@@ -38,7 +38,9 @@
 import org.hisp.dhis.api.mobile.model.Program;
 import org.hisp.dhis.api.mobile.model.ProgramStage;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageSection;
 import org.springframework.beans.factory.annotation.Required;
 
 public class DefaultProgramService
@@ -67,6 +69,18 @@
 
         return programs;
     }
+    
+    public List<org.hisp.dhis.api.mobile.model.LWUITmodel.Program> getProgramsLWUIT( OrganisationUnit unit )
+    {
+        List<org.hisp.dhis.api.mobile.model.LWUITmodel.Program> programs = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Program>();
+
+        for ( org.hisp.dhis.program.Program program : programService.getPrograms( unit ) )
+        {
+            programs.add( getProgramLWUIT( program.getId()) );
+        }
+
+        return programs;
+    }
 
     public List<Program> updateProgram( ModelList programsFromClient, String localeString, OrganisationUnit unit )
     {
@@ -153,6 +167,90 @@
 
         return pr;
     }
+    
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.Program getProgramLWUIT( int programId )
+    {
+        org.hisp.dhis.program.Program program = programService.getProgram( programId );
+
+        //program = i18n( i18nService, locale, program );
+
+        org.hisp.dhis.api.mobile.model.LWUITmodel.Program pr = new org.hisp.dhis.api.mobile.model.LWUITmodel.Program();
+
+        pr.setId( program.getId() );
+        pr.setName( program.getName() );
+        pr.setVersion( program.getVersion() );
+        pr.setStatus( ProgramInstance.STATUS_ACTIVE );
+
+        List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage> prStgs = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage>();
+
+        for ( org.hisp.dhis.program.ProgramStage programStage : program.getProgramStages() )
+        {
+            //programStage = i18n( i18nService, locale, programStage );
+
+            org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage prStg = new org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage();
+
+            prStg.setId( programStage.getId() );
+
+            prStg.setName( programStage.getName() );
+            
+            prStg.setRepeatable( programStage.getIrregular() );
+            
+            prStg.setCompleted( false );
+            
+            prStg.setSingleEvent( program.isSingleEvent() );
+
+            List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement> des = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement>();
+
+            Set<ProgramStageDataElement> programStageDataElements =  programStage.getProgramStageDataElements();
+
+            for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+            {
+                //programStagedataElement = i18n( i18nService, locale, programStagedataElement );
+
+                org.hisp.dhis.dataelement.DataElement dataElement = programStageDataElement.getDataElement();
+
+                org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement de = modelMapping.getDataElementLWUIT( dataElement );
+                
+                de.setCompulsory( programStageDataElement.isCompulsory() );
+                
+                de.setNumberType( programStageDataElement.getDataElement().getNumberType() );
+
+                des.add( de );
+            }
+
+            prStg.setDataElements( des );
+            
+            // Set all program sections
+            List<org.hisp.dhis.api.mobile.model.LWUITmodel.Section> mobileSections = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Section>();
+            if ( programStage.getProgramStageSections().size() > 0 )
+            {
+                for ( ProgramStageSection eachSection : programStage.getProgramStageSections() )
+                {
+                    org.hisp.dhis.api.mobile.model.LWUITmodel.Section mobileSection = new org.hisp.dhis.api.mobile.model.LWUITmodel.Section();
+                    mobileSection.setId( eachSection.getId() );
+                    mobileSection.setName( eachSection.getName() );
+
+                    // Set all data elements' id, then we could have full from
+                    // data element list of program stage
+                    List<Integer> dataElementIds = new ArrayList<Integer>();
+                    for ( ProgramStageDataElement eachPogramStageDataElement : eachSection
+                        .getProgramStageDataElements() )
+                    {
+                        dataElementIds.add( eachPogramStageDataElement.getDataElement().getId() );
+                    }
+                    mobileSection.setDataElementIds( dataElementIds );
+                    mobileSections.add( mobileSection );
+                }
+            }
+            prStg.setSections( mobileSections );
+
+            prStgs.add( prStg );
+        }
+
+        pr.setProgramStages( prStgs );
+
+        return pr;
+    }
 
     @Required
     public void setProgramService( org.hisp.dhis.program.ProgramService programService )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java	2013-05-09 16:53:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java	2013-07-11 07:56:43 +0000
@@ -34,6 +34,7 @@
 import org.hisp.dhis.api.mobile.model.Model;
 import org.hisp.dhis.api.mobile.model.ModelList;
 import org.hisp.dhis.api.mobile.model.OptionSet;
+import org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 
@@ -52,7 +53,24 @@
         if ( dataElement.getOptionSet() != null && dataElement.getOptionSet().getOptions().size() <= 50 )
         {
             de.setOptionSet( getOptionSet( dataElement ) );
-        }
+        }        
+        return de;
+    }
+
+    public ProgramStageDataElement getDataElementLWUIT( org.hisp.dhis.dataelement.DataElement dataElement )
+    {
+        ProgramStageDataElement de = new ProgramStageDataElement();
+        de.setId( dataElement.getId() );
+        de.setName( dataElement.getFormNameFallback() );
+        de.setType( dataElement.getType() );
+
+        de.setCategoryOptionCombos( getCategoryOptionCombos( dataElement ) );
+
+        // Limit the optionset transfer to the client
+        if ( dataElement.getOptionSet() != null && dataElement.getOptionSet().getOptions().size() <= 50 )
+        {
+            de.setOptionSet( getOptionSet( dataElement ) );
+        }     
         
         return de;
     }
@@ -75,24 +93,6 @@
         return mobileOptionSet;
     }
 
-    public org.hisp.dhis.api.mobile.model.OptionSet getLWUITOptionSet( org.hisp.dhis.dataelement.DataElement dataElement )
-    {
-        org.hisp.dhis.option.OptionSet dhisOptionSet = dataElement.getOptionSet();
-        org.hisp.dhis.api.mobile.model.OptionSet mobileOptionSet = new org.hisp.dhis.api.mobile.model.OptionSet();
-        if ( dhisOptionSet != null )
-        {
-            mobileOptionSet.setId( dhisOptionSet.getId() );
-            mobileOptionSet.setName( dhisOptionSet.getName() );
-            mobileOptionSet.setOptions( dhisOptionSet.getOptions() );
-        }
-        else
-        {
-            return null;
-        }
-
-        return mobileOptionSet;
-    }
-
     public ModelList getCategoryOptionCombos( org.hisp.dhis.dataelement.DataElement dataElement )
     {
         DataElementCategoryCombo categoryCombo = dataElement.getCategoryCombo();

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java	2013-06-26 07:37:34 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java	2013-07-11 07:56:43 +0000
@@ -253,7 +253,6 @@
                 recipients.add( phoneNumber );
             }
         }
-
         return recipients;
     }
 
@@ -274,7 +273,6 @@
 
             log.warn( "Unable to send message through sms: " + sms, e );
         }
-
         return message;
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-07-11 07:56:43 +0000
@@ -362,7 +362,7 @@
                 User sender = users.iterator().next();
 
                 Set<User> receivers = new HashSet<User>( userGroup.getMembers() );
-
+                
                 // forward to user group by SMS
                 smsMessageSender.sendMessage( command.getName(), message, sender, receivers, true );
                 

=== 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	2013-05-16 08:40:58 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2013-07-11 07:56:43 +0000
@@ -80,9 +80,7 @@
     // For client version 2.8 and lower
     @RequestMapping( method = RequestMethod.GET, value = "orgUnits/{id}/all" )
     @ResponseBody
-    public MobileModel getAllDataForOrgUnit2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public MobileModel getAllDataForOrgUnit2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         MobileModel mobileModel = new MobileModel();
         mobileModel.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -97,10 +95,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/updateDataSets" )
     @ResponseBody
-    public DataSetList checkUpdatedDataSet2_8( @PathVariable
-    int id, @RequestBody
-    DataSetList dataSetList, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList checkUpdatedDataSet2_8( @PathVariable int id, @RequestBody DataSetList dataSetList,
+        @RequestHeader( "accept-language" ) String locale )
     {
         DataSetList returnList = facilityReportingService.getUpdatedDataSet( dataSetList, getUnit( id ), locale );
         returnList.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -115,9 +111,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/dataSets" )
     @ResponseBody
-    public String saveDataSetValues2_8( @PathVariable
-    int id, @RequestBody
-    DataSetValue dataSetValue )
+    public String saveDataSetValues2_8( @PathVariable int id, @RequestBody DataSetValue dataSetValue )
         throws NotAllowedException
     {
         facilityReportingService.saveDataSetValues( getUnit( id ), dataSetValue );
@@ -133,9 +127,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/activities" )
     @ResponseBody
-    public String saveActivityReport2_8( @PathVariable
-    int id, @RequestBody
-    ActivityValue activityValue )
+    public String saveActivityReport2_8( @PathVariable int id, @RequestBody ActivityValue activityValue )
         throws NotAllowedException
     {
         // FIXME set the last argument to 0 to fix compilation error
@@ -145,10 +137,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/activitiyplan" )
     @ResponseBody
-    public MobileModel updatePrograms2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale, @RequestBody
-    ModelList programsFromClient )
+    public MobileModel updatePrograms2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale,
+        @RequestBody ModelList programsFromClient )
     {
         MobileModel model = new MobileModel();
         model.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -160,9 +150,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "orgUnits/{id}/search" )
     @ResponseBody
-    public ActivityPlan search2_8( @PathVariable
-    int id, @RequestHeader( "identifier" )
-    String identifier )
+    public ActivityPlan search2_8( @PathVariable int id, @RequestHeader( "identifier" ) String identifier )
         throws NotAllowedException
     {
         ActivityPlan activityPlan = activityReportingService.getActivitiesByIdentifier( identifier );
@@ -172,9 +160,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "orgUnits/{id}/changeLanguageDataSet" )
     @ResponseBody
-    public DataSetList changeLanguageDataSet2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList changeLanguageDataSet2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         return facilityReportingService.getDataSetsForLocale( getUnit( id ), locale );
     }
@@ -183,10 +169,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/all" )
     @ResponseBody
-    public MobileModel getAllDataForOrgUnit( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public MobileModel getAllDataForOrgUnit( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale )
     {
         MobileModel mobileModel = new MobileModel();
         mobileModel.setClientVersion( clientVersion );
@@ -202,11 +186,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/updateDataSets" )
     @ResponseBody
-    public DataSetList checkUpdatedDataSet( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestBody
-    DataSetList dataSetList, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList checkUpdatedDataSet( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestBody DataSetList dataSetList, @RequestHeader( "accept-language" ) String locale )
     {
         DataSetList returnList = facilityReportingService.getUpdatedDataSet( dataSetList, getUnit( id ), locale );
         returnList.setClientVersion( clientVersion );
@@ -222,9 +203,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/dataSets" )
     @ResponseBody
-    public String saveDataSetValues( @PathVariable
-    int id, @RequestBody
-    DataSetValue dataSetValue )
+    public String saveDataSetValues( @PathVariable int id, @RequestBody DataSetValue dataSetValue )
         throws NotAllowedException
     {
         facilityReportingService.saveDataSetValues( getUnit( id ), dataSetValue );
@@ -233,11 +212,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/activitiyplan" )
     @ResponseBody
-    public MobileModel updatePrograms( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale, @RequestBody
-    ModelList programsFromClient )
+    public MobileModel updatePrograms( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale, @RequestBody ModelList programsFromClient )
     {
         MobileModel model = new MobileModel();
         model.setClientVersion( clientVersion );
@@ -249,10 +225,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/search" )
     @ResponseBody
-    public ActivityPlan search( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "identifier" )
-    String identifier )
+    public ActivityPlan search( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "identifier" ) String identifier )
         throws NotAllowedException
     {
         ActivityPlan activityPlan = activityReportingService.getActivitiesByIdentifier( identifier );
@@ -288,9 +262,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/activities" )
     @ResponseBody
-    public String saveActivityReport( @PathVariable
-    int id, @RequestBody
-    ActivityValue activityValue )
+    public String saveActivityReport( @PathVariable int id, @RequestBody ActivityValue activityValue )
         throws NotAllowedException
     {
         // FIXME set the last argument to 0 to fix compilation error
@@ -300,9 +272,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/changeLanguageDataSet" )
     @ResponseBody
-    public DataSetList changeLanguageDataSet( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList changeLanguageDataSet( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         return facilityReportingService.getDataSetsForLocale( getUnit( id ), locale );
     }
@@ -314,6 +284,19 @@
         return facilityReportingService.updateContactForMobile();
     }
 
+    @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/all" )
+    @ResponseBody
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel getAllDataForOrgUnitLWUIT(
+        @PathVariable String clientVersion, @PathVariable int id )
+    {
+        org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel mobileModel = new org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel();
+        mobileModel.setClientVersion( clientVersion );
+        OrganisationUnit unit = getUnit( id );
+        mobileModel.setPrograms( programService.getProgramsLWUIT( unit ) );
+        mobileModel.setServerCurrentDate( new Date() );
+        return mobileModel;
+    }
+
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/updateContactForMobile" )
     @ResponseBody
     public Contact updateContactForMobileLWUIT()
@@ -323,9 +306,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findPatient" )
     @ResponseBody
-    public Patient findPatientByName( @PathVariable
-    int id, @RequestHeader( "name" )
-    String keyword )
+    public Patient findPatientByName( @PathVariable int id, @RequestHeader( "name" ) String keyword )
         throws NotAllowedException
     {
         return activityReportingService.findPatient( keyword, id );
@@ -333,10 +314,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/uploadProgramStage/{patientId}" )
     @ResponseBody
-    public String saveProgramStage( @PathVariable
-    int patientId, @PathVariable
-    int id, @RequestBody
-    ProgramStage programStage )
+    public String saveProgramStage( @PathVariable int patientId, @PathVariable int id,
+        @RequestBody ProgramStage programStage )
         throws NotAllowedException
     {
         return activityReportingService.saveProgramStage( programStage, patientId, id );
@@ -344,9 +323,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/enrollProgram" )
     @ResponseBody
-    public Patient enrollProgram( @PathVariable
-    int id, @RequestHeader( "enrollInfo" )
-    String enrollInfo )
+    public Patient enrollProgram( @PathVariable int id, @RequestHeader( "enrollInfo" ) String enrollInfo )
         throws NotAllowedException
     {
         return activityReportingService.enrollProgram( enrollInfo );
@@ -354,9 +331,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/addRelationship" )
     @ResponseBody
-    public Patient addRelationship( @PathVariable
-    int id, @RequestBody
-    Relationship enrollmentRelationship )
+    public Patient addRelationship( @PathVariable int id, @RequestBody Relationship enrollmentRelationship )
         throws NotAllowedException
     {
         return activityReportingService.addRelationship( enrollmentRelationship, id );
@@ -364,9 +339,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/downloadAnonymousProgramUrl" )
     @ResponseBody
-    public Program getAnonymousProgram( @PathVariable
-    int id, @RequestHeader( "useless-part" )
-    String enrollInfo )
+    public Program getAnonymousProgram( @PathVariable int id, @RequestHeader( "useless-part" ) String enrollInfo )
         throws NotAllowedException
     {
         return activityReportingService.getAllAnonymousProgram( id );
@@ -374,9 +347,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findProgram" )
     @ResponseBody
-    public Program findProgram( @PathVariable
-    int id, @RequestHeader( "info" )
-    String programInfo )
+    public Program findProgram( @PathVariable int id, @RequestHeader( "info" ) String programInfo )
         throws NotAllowedException
     {
         return activityReportingService.findProgram( programInfo );
@@ -434,9 +405,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/registerPerson" )
     @ResponseBody
-    public String savePatient( @PathVariable
-    int id, @RequestBody
-    Patient patient )
+    public String savePatient( @PathVariable int id, @RequestBody Patient patient )
         throws NotAllowedException
     {
 
@@ -446,10 +415,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/getVariesInfo" )
     @ResponseBody
-    public PatientIdentifierAndAttribute getVariesInfo( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public PatientIdentifierAndAttribute getVariesInfo( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale )
     {
         PatientIdentifierAndAttribute patientIdentifierAndAttribute = new PatientIdentifierAndAttribute();
         patientIdentifierAndAttribute.setClientVersion( clientVersion );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm	2013-06-20 08:08:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm	2013-07-11 07:56:43 +0000
@@ -167,7 +167,7 @@
 				<option value="UNHANDLED" #if($smsStatus == 'UNHANDLED') selected='selected' #end>$i18n.getString( "unhandled" )</option>
 			</select>
 			<input type="text" name="keyword" #if($keyword) value="$keyword" #else value="" #end style="width: 150px"/>
-			<input type="submit" name="filer" value="Filer"/>
+			<input type="submit" name="filter" value="Filter"/>
 			<input type="reset" name="clear" value="Clear"/>
 		</div>
 		<div style="float: right">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2013-06-10 11:42:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2013-07-11 07:56:43 +0000
@@ -78,12 +78,12 @@
 			</td>
 		</tr>
 		<tr>
-			<td style="width:150px">Confirm Message: </td>
+			<td style="width:130px">Confirm Message: </td>
 			<td><textarea cols="35" type="text" name="receivedMessage">#if($smsCommand.receivedMessage)$smsCommand.receivedMessage#end</textarea></td>
 		</tr>
 		#end
         <tr>
-            <td style="width:150px">$i18n.getString( "no_codes_message" )</td>
+            <td style="width:130px">$i18n.getString( "no_codes_message" )</td>
             <td><textarea cols="35" type="text" name="defaultMessage">#if($smsCommand.defaultMessage)$smsCommand.defaultMessage#end</textarea></td>
         </tr>	
 	</table>