← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21315: improve compatibility for mobile API

 

------------------------------------------------------------
revno: 21315
committer: Long Ngo Thanh <thanhlongngo1988@xxxxxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-12-04 15:18:34 +0700
message:
  improve compatibility for mobile API
added:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileOrgUnitLinks.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OrgUnits.java
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.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/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.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
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/MobileOrgUnitLinks.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/MobileOrgUnitLinks.java	2015-12-04 08:18:34 +0000
@@ -0,0 +1,694 @@
+package org.hisp.dhis.api.mobile.model.LWUITmodel;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
+
+@XmlRootElement( name = "orgUnit" )
+public class MobileOrgUnitLinks
+    implements DataStreamSerializable
+{
+    public static final double currentVersion = 2.11;
+
+    private String clientVersion;
+
+    private int id;
+
+    private String name;
+
+    private String downloadAllUrl;
+
+    private String updateActivityPlanUrl;
+
+    private String uploadFacilityReportUrl;
+
+    private String downloadFacilityReportUrl;
+
+    private String uploadActivityReportUrl;
+
+    private String updateDataSetUrl;
+
+    private String changeUpdateDataSetLangUrl;
+
+    private String searchUrl;
+
+    private String updateNewVersionUrl;
+
+    private String sendFeedbackUrl;
+
+    private String findUserUrl;
+
+    private String sendMessageUrl;
+
+    private String downloadMessageConversationUrl;
+
+    private String getMessageUrl;
+
+    private String replyMessageUrl;
+
+    private String downloadInterpretationUrl;
+
+    private String postInterpretationUrl;
+
+    private String postCommentUrl;
+
+    private String updateContactUrl;
+
+    private String findPatientUrl;
+
+    private String findPatientsUrl;
+
+    private String uploadProgramStageUrl;
+
+    private String enrollProgramUrl;
+
+    private String registerPersonUrl;
+
+    private String addRelationshipUrl;
+
+    private String downloadAnonymousProgramUrl;
+
+    private String findProgramUrl;
+
+    private String getVariesInfoUrl;
+
+    private String findPatientInAdvancedUrl;
+
+    private String findVisitScheduleUrl;
+
+    private String findLostToFollowUpUrl;
+
+    private String handleLostToFollowUpUrl;
+
+    private String generateRepeatableEventUrl;
+
+    private String uploadSingleEventWithoutRegistration;
+
+    private String completeProgramInstanceUrl;
+    
+    private String registerRelativeUrl;
+
+    @XmlAttribute
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    @XmlAttribute
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDownloadAllUrl()
+    {
+        return downloadAllUrl;
+    }
+
+    public void setDownloadAllUrl( String downloadAllUrl )
+    {
+        this.downloadAllUrl = downloadAllUrl;
+    }
+
+    public String getUploadFacilityReportUrl()
+    {
+        return uploadFacilityReportUrl;
+    }
+
+    public void setUploadFacilityReportUrl( String uploadFacilityReportUrl )
+    {
+        this.uploadFacilityReportUrl = uploadFacilityReportUrl;
+    }
+
+    public String getDownloadFacilityReportUrl()
+    {
+        return downloadFacilityReportUrl;
+    }
+
+    public void setDownloadFacilityReportUrl( String downloadFacilityReportUrl )
+    {
+        this.downloadFacilityReportUrl = downloadFacilityReportUrl;
+    }
+
+    public String getUploadActivityReportUrl()
+    {
+        return uploadActivityReportUrl;
+    }
+
+    public void setUploadActivityReportUrl( String uploadActivityReportUrl )
+    {
+        this.uploadActivityReportUrl = uploadActivityReportUrl;
+    }
+
+    public String getUpdateDataSetUrl()
+    {
+        return updateDataSetUrl;
+    }
+
+    public void setUpdateDataSetUrl( String updateDataSetUrl )
+    {
+        this.updateDataSetUrl = updateDataSetUrl;
+    }
+
+    public String getChangeUpdateDataSetLangUrl()
+    {
+        return changeUpdateDataSetLangUrl;
+    }
+
+    public void setChangeUpdateDataSetLangUrl( String changeUpdateDataSetLangUrl )
+    {
+        this.changeUpdateDataSetLangUrl = changeUpdateDataSetLangUrl;
+    }
+
+    public String getSearchUrl()
+    {
+        return searchUrl;
+    }
+
+    public void setSearchUrl( String searchUrl )
+    {
+        this.searchUrl = searchUrl;
+    }
+
+    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 String getUpdateNewVersionUrl()
+    {
+        return updateNewVersionUrl;
+    }
+
+    public void setUpdateNewVersionUrl( String updateNewVersionUrl )
+    {
+        this.updateNewVersionUrl = updateNewVersionUrl;
+    }
+
+    public String getSendFeedbackUrl()
+    {
+        return sendFeedbackUrl;
+    }
+
+    public void setSendFeedbackUrl( String sendFeedbackUrl )
+    {
+        this.sendFeedbackUrl = sendFeedbackUrl;
+    }
+
+    public String getFindUserUrl()
+    {
+        return findUserUrl;
+    }
+
+    public void setFindUserUrl( String findUserUrl )
+    {
+        this.findUserUrl = findUserUrl;
+    }
+
+    public String getSendMessageUrl()
+    {
+        return sendMessageUrl;
+    }
+
+    public void setSendMessageUrl( String sendMessageUrl )
+    {
+        this.sendMessageUrl = sendMessageUrl;
+    }
+
+    public String getDownloadMessageConversationUrl()
+    {
+        return downloadMessageConversationUrl;
+    }
+
+    public void setDownloadMessageConversationUrl( String downloadMessageConversationUrl )
+    {
+        this.downloadMessageConversationUrl = downloadMessageConversationUrl;
+    }
+
+    public String getGetMessageUrl()
+    {
+        return getMessageUrl;
+    }
+
+    public void setGetMessageUrl( String getMessageUrl )
+    {
+        this.getMessageUrl = getMessageUrl;
+    }
+
+    public String getReplyMessageUrl()
+    {
+        return replyMessageUrl;
+    }
+
+    public void setReplyMessageUrl( String replyMessageUrl )
+    {
+        this.replyMessageUrl = replyMessageUrl;
+    }
+
+    public String getDownloadInterpretationUrl()
+    {
+        return downloadInterpretationUrl;
+    }
+
+    public void setDownloadInterpretationUrl( String downloadInterpretationUrl )
+    {
+        this.downloadInterpretationUrl = downloadInterpretationUrl;
+    }
+
+    public String getPostInterpretationUrl()
+    {
+        return postInterpretationUrl;
+    }
+
+    public void setPostInterpretationUrl( String postInterpretationUrl )
+    {
+        this.postInterpretationUrl = postInterpretationUrl;
+    }
+
+  
+
+    public String getPostCommentUrl()
+    {
+        return postCommentUrl;
+    }
+
+    public void setPostCommentUrl( String postCommentUrl )
+    {
+        this.postCommentUrl = postCommentUrl;
+    }
+
+    public String getUpdateContactUrl()
+    {
+        return updateContactUrl;
+    }
+
+    public void setUpdateContactUrl( String updateContactUrl )
+    {
+        this.updateContactUrl = updateContactUrl;
+    }
+
+    public String getFindPatientUrl()
+    {
+        return findPatientUrl;
+    }
+
+    public void setFindPatientUrl( String findPatientUrl )
+    {
+        this.findPatientUrl = findPatientUrl;
+    }
+
+    public String getFindPatientsUrl()
+    {
+        return findPatientsUrl;
+    }
+
+    public void setFindPatientsUrl( String findPatientsUrl )
+    {
+        this.findPatientsUrl = findPatientsUrl;
+    }
+
+    public String getUploadProgramStageUrl()
+    {
+        return uploadProgramStageUrl;
+    }
+
+    public void setUploadProgramStageUrl( String uploadProgramStageUrl )
+    {
+        this.uploadProgramStageUrl = uploadProgramStageUrl;
+    }
+
+    public String getEnrollProgramUrl()
+    {
+        return enrollProgramUrl;
+    }
+
+    public void setEnrollProgramUrl( String enrollProgramUrl )
+    {
+        this.enrollProgramUrl = enrollProgramUrl;
+    }
+
+    public String getRegisterPersonUrl()
+    {
+        return registerPersonUrl;
+    }
+
+    public void setRegisterPersonUrl( String registerPersonUrl )
+    {
+        this.registerPersonUrl = registerPersonUrl;
+    }
+
+    public String getGetVariesInfoUrl()
+    {
+        return getVariesInfoUrl;
+    }
+
+    public void setGetVariesInfoUrl( String getVariesInfoUrl )
+    {
+        this.getVariesInfoUrl = getVariesInfoUrl;
+    }
+
+    public String getAddRelationshipUrl()
+    {
+        return addRelationshipUrl;
+    }
+
+    public void setAddRelationshipUrl( String addRelationshipUrl )
+    {
+        this.addRelationshipUrl = addRelationshipUrl;
+    }
+
+    public String getDownloadAnonymousProgramUrl()
+    {
+        return downloadAnonymousProgramUrl;
+    }
+
+    public void setDownloadAnonymousProgramUrl( String downloadAnonymousProgramUrl )
+    {
+        this.downloadAnonymousProgramUrl = downloadAnonymousProgramUrl;
+    }
+
+    public String getFindProgramUrl()
+    {
+        return findProgramUrl;
+    }
+
+    public void setFindProgramUrl( String findProgramUrl )
+    {
+        this.findProgramUrl = findProgramUrl;
+    }
+
+    public String getFindPatientInAdvancedUrl()
+    {
+        return findPatientInAdvancedUrl;
+    }
+
+    public void setFindPatientInAdvancedUrl( String findPatientInAdvancedUrl )
+    {
+        this.findPatientInAdvancedUrl = findPatientInAdvancedUrl;
+    }
+
+    public String getFindVisitScheduleUrl()
+    {
+        return findVisitScheduleUrl;
+    }
+
+    public void setFindVisitScheduleUrl( String findVisitScheduleUrl )
+    {
+        this.findVisitScheduleUrl = findVisitScheduleUrl;
+    }
+
+    public String getFindLostToFollowUpUrl()
+    {
+        return findLostToFollowUpUrl;
+    }
+
+    public void setFindLostToFollowUpUrl( String findLostToFollowUpUrl )
+    {
+        this.findLostToFollowUpUrl = findLostToFollowUpUrl;
+    }
+
+    public String getHandleLostToFollowUpUrl()
+    {
+        return handleLostToFollowUpUrl;
+    }
+
+    public void setHandleLostToFollowUpUrl( String handleLostToFollowUpUrl )
+    {
+        this.handleLostToFollowUpUrl = handleLostToFollowUpUrl;
+    }
+
+    public String getGenerateRepeatableEventUrl()
+    {
+        return generateRepeatableEventUrl;
+    }
+
+    public void setGenerateRepeatableEventUrl( String generateRepeatableEventUrl )
+    {
+        this.generateRepeatableEventUrl = generateRepeatableEventUrl;
+    }
+
+    public String getUploadSingleEventWithoutRegistration()
+    {
+        return uploadSingleEventWithoutRegistration;
+    }
+
+    public void setUploadSingleEventWithoutRegistration( String uploadSingleEventWithoutRegistration )
+    {
+        this.uploadSingleEventWithoutRegistration = uploadSingleEventWithoutRegistration;
+    }
+
+    public String getCompleteProgramInstanceUrl()
+    {
+        return completeProgramInstanceUrl;
+    }
+
+    public void setCompleteProgramInstanceUrl( String completeProgramInstanceUrl )
+    {
+        this.completeProgramInstanceUrl = completeProgramInstanceUrl;
+    }
+
+    public String getRegisterRelativeUrl()
+    {
+        return registerRelativeUrl;
+    }
+
+    public void setRegisterRelativeUrl( String registerRelativeUrl )
+    {
+        this.registerRelativeUrl = registerRelativeUrl;
+    }
+
+    @Override
+    public void serialize( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        dataOutputStream.writeInt( id );
+        dataOutputStream.writeUTF( name );
+        dataOutputStream.writeUTF( downloadAllUrl );
+        dataOutputStream.writeUTF( updateActivityPlanUrl );
+        dataOutputStream.writeUTF( uploadFacilityReportUrl );
+        dataOutputStream.writeUTF( downloadFacilityReportUrl );
+        dataOutputStream.writeUTF( uploadActivityReportUrl );
+        dataOutputStream.writeUTF( updateDataSetUrl );
+        dataOutputStream.writeUTF( changeUpdateDataSetLangUrl );
+        dataOutputStream.writeUTF( searchUrl );
+        dataOutputStream.writeUTF( updateNewVersionUrl );
+        dataOutputStream.writeUTF( sendFeedbackUrl );
+        dataOutputStream.writeUTF( findUserUrl );
+        dataOutputStream.writeUTF( sendMessageUrl );
+        dataOutputStream.writeUTF( downloadMessageConversationUrl );
+        dataOutputStream.writeUTF( getMessageUrl );
+        dataOutputStream.writeUTF( replyMessageUrl );
+        dataOutputStream.writeUTF( downloadInterpretationUrl );
+        dataOutputStream.writeUTF( postInterpretationUrl );
+        dataOutputStream.writeUTF( postCommentUrl );
+        dataOutputStream.writeUTF( updateContactUrl );
+        dataOutputStream.writeUTF( findPatientUrl );
+        dataOutputStream.writeUTF( registerPersonUrl );
+        dataOutputStream.writeUTF( uploadProgramStageUrl );
+        dataOutputStream.writeUTF( enrollProgramUrl );
+        dataOutputStream.writeUTF( getVariesInfoUrl );
+        dataOutputStream.writeUTF( addRelationshipUrl );
+        dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
+        dataOutputStream.writeUTF( findProgramUrl );
+        dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findPatientsUrl );
+        dataOutputStream.writeUTF( findVisitScheduleUrl );
+        dataOutputStream.writeUTF( findLostToFollowUpUrl );
+        dataOutputStream.writeUTF( handleLostToFollowUpUrl );
+        dataOutputStream.writeUTF( generateRepeatableEventUrl );
+        dataOutputStream.writeUTF( uploadSingleEventWithoutRegistration );
+        dataOutputStream.writeUTF( completeProgramInstanceUrl );
+        dataOutputStream.writeUTF( registerRelativeUrl );
+
+    }
+
+    @Override
+    public void deSerialize( DataInputStream dataInputStream )
+        throws IOException
+    {
+        id = dataInputStream.readInt();
+        name = dataInputStream.readUTF();
+        downloadAllUrl = dataInputStream.readUTF();
+        updateActivityPlanUrl = dataInputStream.readUTF();
+        uploadFacilityReportUrl = dataInputStream.readUTF();
+        downloadFacilityReportUrl = dataInputStream.readUTF();
+        uploadActivityReportUrl = dataInputStream.readUTF();
+        updateDataSetUrl = dataInputStream.readUTF();
+        changeUpdateDataSetLangUrl = dataInputStream.readUTF();
+        searchUrl = dataInputStream.readUTF();
+        updateNewVersionUrl = dataInputStream.readUTF();
+        sendFeedbackUrl = dataInputStream.readUTF();
+        findUserUrl = dataInputStream.readUTF();
+        sendMessageUrl = dataInputStream.readUTF();
+        downloadMessageConversationUrl = dataInputStream.readUTF();
+        getMessageUrl = dataInputStream.readUTF();
+        replyMessageUrl = dataInputStream.readUTF();
+        downloadInterpretationUrl = dataInputStream.readUTF();
+        postInterpretationUrl = dataInputStream.readUTF();
+        postCommentUrl = dataInputStream.readUTF();
+        updateContactUrl = dataInputStream.readUTF();
+        findPatientUrl = dataInputStream.readUTF();
+        registerPersonUrl = dataInputStream.readUTF();
+        uploadProgramStageUrl = dataInputStream.readUTF();
+        enrollProgramUrl = dataInputStream.readUTF();
+        getVariesInfoUrl = dataInputStream.readUTF();
+        addRelationshipUrl = dataInputStream.readUTF();
+        downloadAnonymousProgramUrl = dataInputStream.readUTF();
+        findProgramUrl = dataInputStream.readUTF();
+        findPatientInAdvancedUrl = dataInputStream.readUTF();
+        findPatientsUrl = dataInputStream.readUTF();
+        findVisitScheduleUrl = dataInputStream.readUTF();
+        findLostToFollowUpUrl = dataInputStream.readUTF();
+        handleLostToFollowUpUrl = dataInputStream.readUTF();
+        generateRepeatableEventUrl = dataInputStream.readUTF();
+        uploadSingleEventWithoutRegistration = dataInputStream.readUTF();
+        completeProgramInstanceUrl = dataInputStream.readUTF();
+        registerRelativeUrl = dataInputStream.readUTF();
+
+    }
+
+    @Override
+    public void serializeVersion2_8( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        dataOutputStream.writeInt( this.id );
+        dataOutputStream.writeUTF( this.name );
+        dataOutputStream.writeUTF( this.downloadAllUrl );
+        dataOutputStream.writeUTF( this.updateActivityPlanUrl );
+        dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
+        dataOutputStream.writeUTF( this.downloadFacilityReportUrl );
+        dataOutputStream.writeUTF( this.uploadActivityReportUrl );
+        dataOutputStream.writeUTF( this.updateDataSetUrl );
+        dataOutputStream.writeUTF( this.changeUpdateDataSetLangUrl );
+        dataOutputStream.writeUTF( this.searchUrl );
+    }
+
+    @Override
+    public void serializeVersion2_9( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        dataOutputStream.writeInt( this.id );
+        dataOutputStream.writeUTF( this.name );
+        dataOutputStream.writeUTF( this.downloadAllUrl );
+        dataOutputStream.writeUTF( this.updateActivityPlanUrl );
+        dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
+        dataOutputStream.writeUTF( this.downloadFacilityReportUrl );
+        dataOutputStream.writeUTF( this.uploadActivityReportUrl );
+        dataOutputStream.writeUTF( this.updateDataSetUrl );
+        dataOutputStream.writeUTF( this.changeUpdateDataSetLangUrl );
+        dataOutputStream.writeUTF( this.searchUrl );
+        dataOutputStream.writeUTF( this.updateNewVersionUrl );
+        dataOutputStream.writeUTF( this.sendFeedbackUrl );
+        dataOutputStream.writeUTF( this.findUserUrl );
+        dataOutputStream.writeUTF( this.sendMessageUrl );
+        dataOutputStream.writeUTF( this.downloadMessageConversationUrl );
+        dataOutputStream.writeUTF( this.getMessageUrl );
+        dataOutputStream.writeUTF( this.replyMessageUrl );
+        dataOutputStream.writeUTF( this.downloadInterpretationUrl );
+        dataOutputStream.writeUTF( this.postInterpretationUrl );
+        dataOutputStream.writeUTF( this.postCommentUrl );
+        // dataOutputStream.writeUTF( this.updateContactUrl );
+    }
+
+    @Override
+    public void serializeVersion2_10( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        dataOutputStream.writeInt( id );
+        dataOutputStream.writeUTF( name );
+        dataOutputStream.writeUTF( downloadAllUrl );
+        dataOutputStream.writeUTF( updateActivityPlanUrl );
+        dataOutputStream.writeUTF( uploadFacilityReportUrl );
+        dataOutputStream.writeUTF( downloadFacilityReportUrl );
+        dataOutputStream.writeUTF( uploadActivityReportUrl );
+        dataOutputStream.writeUTF( updateDataSetUrl );
+        dataOutputStream.writeUTF( changeUpdateDataSetLangUrl );
+        dataOutputStream.writeUTF( searchUrl );
+        dataOutputStream.writeUTF( updateNewVersionUrl );
+        dataOutputStream.writeUTF( sendFeedbackUrl );
+        dataOutputStream.writeUTF( findUserUrl );
+        dataOutputStream.writeUTF( sendMessageUrl );
+        dataOutputStream.writeUTF( downloadMessageConversationUrl );
+        dataOutputStream.writeUTF( getMessageUrl );
+        dataOutputStream.writeUTF( replyMessageUrl );
+        dataOutputStream.writeUTF( downloadInterpretationUrl );
+        dataOutputStream.writeUTF( postInterpretationUrl );
+        dataOutputStream.writeUTF( postCommentUrl );
+        dataOutputStream.writeUTF( updateContactUrl );
+        dataOutputStream.writeUTF( findPatientUrl );
+        dataOutputStream.writeUTF( registerPersonUrl );
+        dataOutputStream.writeUTF( uploadProgramStageUrl );
+        dataOutputStream.writeUTF( enrollProgramUrl );
+        dataOutputStream.writeUTF( getVariesInfoUrl );
+        dataOutputStream.writeUTF( addRelationshipUrl );
+        dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
+        dataOutputStream.writeUTF( findProgramUrl );
+        dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findPatientsUrl );
+        dataOutputStream.writeUTF( findVisitScheduleUrl );
+        dataOutputStream.writeUTF( findLostToFollowUpUrl );
+        dataOutputStream.writeUTF( handleLostToFollowUpUrl );
+        dataOutputStream.writeUTF( generateRepeatableEventUrl );
+        dataOutputStream.writeUTF( uploadSingleEventWithoutRegistration );
+        dataOutputStream.writeUTF( completeProgramInstanceUrl );
+        dataOutputStream.writeUTF( registerRelativeUrl );
+    }
+}

=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OrgUnits.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OrgUnits.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/OrgUnits.java	2015-12-04 08:18:34 +0000
@@ -0,0 +1,152 @@
+package org.hisp.dhis.api.mobile.model.LWUITmodel;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
+
+@XmlRootElement
+public class OrgUnits
+    implements DataStreamSerializable
+{
+    private String clientVersion;
+
+    private List<MobileOrgUnitLinks> orgUnits = new ArrayList<>();
+
+    public OrgUnits()
+    {
+    }
+
+    public OrgUnits( List<MobileOrgUnitLinks> unitList )
+    {
+        this.orgUnits = unitList;
+    }
+
+    @XmlElement( name = "orgUnit" )
+    public List<MobileOrgUnitLinks> getOrgUnits()
+    {
+        return orgUnits;
+    }
+
+    public void setOrgUnits( List<MobileOrgUnitLinks> orgUnits )
+    {
+        this.orgUnits = orgUnits;
+    }
+
+    public String getClientVersion()
+    {
+        return clientVersion;
+    }
+
+    public void setClientVersion( String clientVersion )
+    {
+        this.clientVersion = clientVersion;
+    }
+
+    @Override
+    public void serialize( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        if ( this.getClientVersion().equals( DataStreamSerializable.TWO_POINT_EIGHT ) )
+        {
+            this.serializeVersion2_8( dataOutputStream );
+        }
+        else if ( this.getClientVersion().equals( DataStreamSerializable.TWO_POINT_NINE ) )
+        {
+            this.serializeVersion2_9( dataOutputStream );
+        }
+        else
+        {
+            this.serializeVersion2_10( dataOutputStream );
+        }
+    }
+
+    @Override
+    public void deSerialize( DataInputStream dataInputStream )
+        throws IOException
+    {
+        orgUnits = new ArrayList<>();
+        dataInputStream.readDouble(); // TODO fix
+        int size = dataInputStream.readInt();
+
+        for ( int i = 0; i < size; i++ )
+        {
+            MobileOrgUnitLinks unit = new MobileOrgUnitLinks();
+            unit.deSerialize( dataInputStream );
+            orgUnits.add( unit );
+        }
+    }
+
+    @Override
+    public void serializeVersion2_8( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        dataOutputStream.writeInt( orgUnits.size() );
+        for ( MobileOrgUnitLinks unit : orgUnits )
+        {
+            unit.serializeVersion2_8( dataOutputStream );
+        }
+    }
+
+    @Override
+    public void serializeVersion2_9( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        // send the current version to client for updating or not
+        dataOutputStream.writeDouble( MobileOrgUnitLinks.currentVersion );
+        dataOutputStream.writeInt( orgUnits.size() );
+        for ( MobileOrgUnitLinks unit : orgUnits )
+        {
+            unit.serializeVersion2_9( dataOutputStream );
+        }
+    }
+
+    @Override
+    public void serializeVersion2_10( DataOutputStream dataOutputStream )
+        throws IOException
+    {
+        // send the current version to client for updating or not
+        dataOutputStream.writeDouble( MobileOrgUnitLinks.currentVersion );
+        dataOutputStream.writeInt( orgUnits.size() );
+        for ( MobileOrgUnitLinks unit : orgUnits )
+        {
+            unit.serializeVersion2_10( dataOutputStream );
+        }
+        
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java	2015-09-21 09:24:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java	2015-12-04 08:18:34 +0000
@@ -43,6 +43,10 @@
 public class Program
     extends Model
 {
+    public static final String WITH_REGISTRATION = "with_registration";
+
+    public static final String WITHOUT_REGISTRATION = "without_registration";
+
     // Work as Program and ProgramInstance
     private String clientVersion;
 
@@ -52,12 +56,12 @@
     // single event with registration: 2
     // single event without registration: 3
 
-    private String type;
-
-    private String dateOfEnrollmentDescription = "Date of Enrollment";
-
-    private String dateOfIncidentDescription = "Date of Incident";
-    
+    private Integer type;
+
+    private String dateOfEnrollmentDescription = "Enrollment Date";
+
+    private String dateOfIncidentDescription = "Incident Date";
+
     private String trackedEntityName = "Tracked Entity";
 
     private List<ProgramStage> programStages = new ArrayList<>();
@@ -102,14 +106,26 @@
         this.clientVersion = clientVersion;
     }
 
-    public String getType()
+    public Integer getType()
     {
         return type;
     }
 
+    public void setType( Integer type )
+    {
+        this.type = type;
+    }
+
     public void setType( String type )
     {
-        this.type = type;
+        if ( type.equalsIgnoreCase( WITH_REGISTRATION ) )
+        {
+            this.setType( 1 );
+        }
+        else
+        {
+            this.setType( 3 );
+        }
     }
 
     public String getDateOfEnrollmentDescription()
@@ -119,7 +135,10 @@
 
     public void setDateOfEnrollmentDescription( String dateOfEnrollmentDescription )
     {
-        this.dateOfEnrollmentDescription = dateOfEnrollmentDescription;
+        if ( dateOfEnrollmentDescription != null )
+        {
+            this.dateOfEnrollmentDescription = dateOfEnrollmentDescription;
+        }
     }
 
     public String getDateOfIncidentDescription()
@@ -129,14 +148,17 @@
 
     public void setDateOfIncidentDescription( String dateOfIncidentDescription )
     {
-        this.dateOfIncidentDescription = dateOfIncidentDescription;
+        if ( dateOfIncidentDescription != null )
+        {
+            this.dateOfIncidentDescription = dateOfIncidentDescription;
+        }
     }
-    
+
     public String getTrackedEntityName()
     {
         return trackedEntityName;
     }
-    
+
     public void setTrackedEntityName( String trackedEntityName )
     {
         this.trackedEntityName = trackedEntityName;
@@ -176,7 +198,7 @@
     {
         return relationshipType;
     }
-    
+
     public void setRelationshipType( int relationshipType )
     {
         this.relationshipType = relationshipType;
@@ -188,7 +210,7 @@
     {
         super.serialize( dout );
         dout.writeInt( getVersion() );
-        dout.writeUTF( this.getType() );
+        dout.writeInt( this.getType() );
         dout.writeUTF( getDateOfEnrollmentDescription() );
         dout.writeUTF( getDateOfIncidentDescription() );
         dout.writeUTF( getTrackedEntityName() );
@@ -206,9 +228,9 @@
         {
             pa.serialize( dout );
         }
-        
+
         String relationshipText = getRelationshipText();
-        if(relationshipText == null)
+        if ( relationshipText == null )
         {
             dout.writeUTF( "" );
         }
@@ -218,6 +240,7 @@
         }
         dout.writeInt( getRelatedProgramId() );
         dout.writeInt( relationshipType );
+
     }
 
     @Override
@@ -226,7 +249,7 @@
     {
         super.deSerialize( dataInputStream );
         this.setVersion( dataInputStream.readInt() );
-        this.setType( dataInputStream.readUTF() );
+        this.setType( dataInputStream.readInt() );
         this.setDateOfEnrollmentDescription( dataInputStream.readUTF() );
         this.setDateOfIncidentDescription( dataInputStream.readUTF() );
         this.setTrackedEntityName( dataInputStream.readUTF() );

=== 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	2015-01-28 10:50:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2015-12-04 08:18:34 +0000
@@ -555,7 +555,6 @@
         dataOutputStream.writeUTF( uploadSingleEventWithoutRegistration );
         dataOutputStream.writeUTF( completeProgramInstanceUrl );
         dataOutputStream.writeUTF( registerRelativeUrl );
-
     }
 
     @Override
@@ -582,25 +581,6 @@
         downloadInterpretationUrl = dataInputStream.readUTF();
         postInterpretationUrl = dataInputStream.readUTF();
         postCommentUrl = dataInputStream.readUTF();
-        updateContactUrl = dataInputStream.readUTF();
-        findPatientUrl = dataInputStream.readUTF();
-        registerPersonUrl = dataInputStream.readUTF();
-        uploadProgramStageUrl = dataInputStream.readUTF();
-        enrollProgramUrl = dataInputStream.readUTF();
-        getVariesInfoUrl = dataInputStream.readUTF();
-        addRelationshipUrl = dataInputStream.readUTF();
-        downloadAnonymousProgramUrl = dataInputStream.readUTF();
-        findProgramUrl = dataInputStream.readUTF();
-        findPatientInAdvancedUrl = dataInputStream.readUTF();
-        findPatientsUrl = dataInputStream.readUTF();
-        findVisitScheduleUrl = dataInputStream.readUTF();
-        findLostToFollowUpUrl = dataInputStream.readUTF();
-        handleLostToFollowUpUrl = dataInputStream.readUTF();
-        generateRepeatableEventUrl = dataInputStream.readUTF();
-        uploadSingleEventWithoutRegistration = dataInputStream.readUTF();
-        completeProgramInstanceUrl = dataInputStream.readUTF();
-        registerRelativeUrl = dataInputStream.readUTF();
-
     }
 
     @Override
@@ -628,22 +608,11 @@
         dataOutputStream.writeUTF( this.downloadAllUrl );
         dataOutputStream.writeUTF( this.updateActivityPlanUrl );
         dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
-        dataOutputStream.writeUTF( this.downloadFacilityReportUrl );
         dataOutputStream.writeUTF( this.uploadActivityReportUrl );
         dataOutputStream.writeUTF( this.updateDataSetUrl );
         dataOutputStream.writeUTF( this.changeUpdateDataSetLangUrl );
         dataOutputStream.writeUTF( this.searchUrl );
         dataOutputStream.writeUTF( this.updateNewVersionUrl );
-        dataOutputStream.writeUTF( this.sendFeedbackUrl );
-        dataOutputStream.writeUTF( this.findUserUrl );
-        dataOutputStream.writeUTF( this.sendMessageUrl );
-        dataOutputStream.writeUTF( this.downloadMessageConversationUrl );
-        dataOutputStream.writeUTF( this.getMessageUrl );
-        dataOutputStream.writeUTF( this.replyMessageUrl );
-        dataOutputStream.writeUTF( this.downloadInterpretationUrl );
-        dataOutputStream.writeUTF( this.postInterpretationUrl );
-        dataOutputStream.writeUTF( this.postCommentUrl );
-        // dataOutputStream.writeUTF( this.updateContactUrl );
     }
 
     @Override
@@ -670,23 +639,5 @@
         dataOutputStream.writeUTF( downloadInterpretationUrl );
         dataOutputStream.writeUTF( postInterpretationUrl );
         dataOutputStream.writeUTF( postCommentUrl );
-        dataOutputStream.writeUTF( updateContactUrl );
-        dataOutputStream.writeUTF( findPatientUrl );
-        dataOutputStream.writeUTF( registerPersonUrl );
-        dataOutputStream.writeUTF( uploadProgramStageUrl );
-        dataOutputStream.writeUTF( enrollProgramUrl );
-        dataOutputStream.writeUTF( getVariesInfoUrl );
-        dataOutputStream.writeUTF( addRelationshipUrl );
-        dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
-        dataOutputStream.writeUTF( findProgramUrl );
-        dataOutputStream.writeUTF( findPatientInAdvancedUrl );
-        dataOutputStream.writeUTF( findPatientsUrl );
-        dataOutputStream.writeUTF( findVisitScheduleUrl );
-        dataOutputStream.writeUTF( findLostToFollowUpUrl );
-        dataOutputStream.writeUTF( handleLostToFollowUpUrl );
-        dataOutputStream.writeUTF( generateRepeatableEventUrl );
-        dataOutputStream.writeUTF( uploadSingleEventWithoutRegistration );
-        dataOutputStream.writeUTF( completeProgramInstanceUrl );
-        dataOutputStream.writeUTF( registerRelativeUrl );
     }
 }

=== 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	2015-11-23 01:05:22 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-12-04 08:18:34 +0000
@@ -656,13 +656,8 @@
         TrackedEntityInstance patient = entityInstanceService.getTrackedEntityInstance( patientId );
         Program program = programService.getProgram( programId );
 
-        ProgramInstance programInstance = new ProgramInstance();
-        programInstance.setEnrollmentDate( new Date() );
-        programInstance.setIncidentDate( incidentDate );
-        programInstance.setProgram( program );
-        programInstance.setEntityInstance( patient );
-        programInstance.setStatus( ProgramStatus.ACTIVE );
-        programInstanceService.addProgramInstance( programInstance );
+        ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( patient, program,
+            new Date(), incidentDate, patient.getOrganisationUnit() );
 
         Iterator<ProgramStage> programStagesIterator = program.getProgramStages().iterator();
 
@@ -672,25 +667,10 @@
 
             if ( programStage.getAutoGenerateEvent() )
             {
-                ProgramStageInstance programStageInstance = new ProgramStageInstance();
-                programStageInstance.setProgramInstance( programInstance );
-                programStageInstance.setProgramStage( programStage );
-                Date dateCreatedEvent = new Date();
-                if ( programStage.getGeneratedByEnrollmentDate() )
-                {
-                    // dateCreatedEvent = sdf.parseDateTime( enrollmentDate
-                    // ).toDate();
-                }
-                Date dueDate = DateUtils.getDateAfterAddition( dateCreatedEvent, programStage.getMinDaysFromStart() );
-
-                programStageInstance.setDueDate( dueDate );
-
-                if ( program.isWithoutRegistration() )
-                {
-                    programStageInstance.setExecutionDate( dueDate );
-                }
-
-                int programStageInstanceId = programStageInstanceService.addProgramStageInstance( programStageInstance );
+                ProgramStageInstance programStageInstance = programStageInstanceService.createProgramStageInstance(
+                    programInstance, programStage, new Date(), incidentDate, patient.getOrganisationUnit() );
+
+                int programStageInstanceId = programStageInstance.getId();
 
                 // Inject Datavalue avaiable on-the-fly
                 if ( mobileProgramStageList != null && mobileProgramStageList.size() > 0 )
@@ -813,7 +793,7 @@
             {
                 org.hisp.dhis.api.mobile.model.PatientAttribute patientAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute(
                     value.getAttribute().getName(), value.getValue(), null, false, value.getAttribute()
-                    .getDisplayInListNoProgram(), new OptionSet() );
+                        .getDisplayInListNoProgram(), new OptionSet() );
                 patientAttribute.setType( value.getAttribute().getValueType() );
 
                 patientAtts.add( patientAttribute );
@@ -1252,8 +1232,8 @@
     // side, we only need name and id
     private org.hisp.dhis.api.mobile.model.LWUITmodel.Program getMobileProgramWithoutData( Program program )
     {
-        Comparator<ProgramStageDataElement> orderBySortOrder =
-            ( ProgramStageDataElement i1, ProgramStageDataElement i2 ) -> i1.getSortOrder().compareTo( i2.getSortOrder() );
+        Comparator<ProgramStageDataElement> orderBySortOrder = ( ProgramStageDataElement i1, ProgramStageDataElement i2 ) -> i1
+            .getSortOrder().compareTo( i2.getSortOrder() );
 
         org.hisp.dhis.api.mobile.model.LWUITmodel.Program anonymousProgramMobile = new org.hisp.dhis.api.mobile.model.LWUITmodel.Program();
 
@@ -1306,13 +1286,15 @@
                 // problem
                 mobileDataElement.setCompulsory( programStageDataElement.isCompulsory() );
 
-                // mobileDataElement.setNumberType( programStageDataElement.getDataElement().getNumberType() );
+                // mobileDataElement.setNumberType(
+                // programStageDataElement.getDataElement().getNumberType() );
 
                 mobileDataElement.setValue( "" );
 
                 if ( programStageDataElement.getDataElement().getOptionSet() != null )
                 {
-                    mobileDataElement.setOptionSet( ModelMapping.getOptionSet( programStageDataElement.getDataElement() ) );
+                    mobileDataElement
+                        .setOptionSet( ModelMapping.getOptionSet( programStageDataElement.getDataElement() ) );
                 }
                 else
                 {
@@ -1506,7 +1488,8 @@
             }
 
             Program program = programService.getProgram( Integer.parseInt( programIdText ) );
-            String[] errorCode = entityInstanceService.validateTrackedEntityInstance( newTrackedEntityInstance, program ).split( "_" );
+            String[] errorCode = entityInstanceService
+                .validateTrackedEntityInstance( newTrackedEntityInstance, program ).split( "_" );
             int code = Integer.parseInt( errorCode[0] );
 
             if ( code >= 1 )
@@ -1516,7 +1499,7 @@
                 {
                     errorMsg = "Duplicate value of "
                         + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
-                        .getDisplayName();
+                            .getDisplayName();
                 }
                 else
                 {
@@ -1949,9 +1932,7 @@
     public org.hisp.dhis.api.mobile.model.LWUITmodel.Patient generateRepeatableEvent( int orgUnitId, String eventInfo )
         throws NotAllowedException
     {
-        // OrganisationUnit orgUnit =
-        // organisationUnitService.getOrganisationUnit( orgUnitId );
-
+        OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
         String[] keys = eventInfo.split( "_" );
         ProgramStage programStage = programStageService.getProgramStage( Integer.parseInt( keys[4] ) );
         int mobileProgramStageId = Integer.parseInt( keys[3] );
@@ -1989,6 +1970,7 @@
             // newProgramStageInstance.setOrganisationUnit( orgUnit );
         }
 
+        newProgramStageInstance.setOrganisationUnit( orgUnit );
         programInstance.getProgramStageInstances().add( newProgramStageInstance );
 
         List<ProgramStageInstance> proStageInstanceList = new ArrayList<>( programInstance.getProgramStageInstances() );
@@ -2536,9 +2518,11 @@
         }
         else
         {
-            patientId = entityInstanceService.createTrackedEntityInstance( patientWeb, null, null, patientAttributeValues );
+            patientId = entityInstanceService.createTrackedEntityInstance( patientWeb, null, null,
+                patientAttributeValues );
         }
-        TrackedEntityInstance newTrackedEntityInstance = entityInstanceService.getTrackedEntityInstance( this.patientId );
+        TrackedEntityInstance newTrackedEntityInstance = entityInstanceService
+            .getTrackedEntityInstance( this.patientId );
 
         String errorMsg = null;
 
@@ -2553,7 +2537,8 @@
             }
 
             Program program = programService.getProgram( Integer.parseInt( programId ) );
-            String[] errorCode = entityInstanceService.validateTrackedEntityInstance( newTrackedEntityInstance, program ).split( "_" );
+            String[] errorCode = entityInstanceService
+                .validateTrackedEntityInstance( newTrackedEntityInstance, program ).split( "_" );
             int code = Integer.parseInt( errorCode[0] );
 
             if ( code >= 1 )
@@ -2563,7 +2548,7 @@
                 {
                     errorMsg = "Duplicate value of "
                         + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
-                        .getDisplayName();
+                            .getDisplayName();
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java	2015-07-27 04:09:19 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java	2015-12-04 08:18:34 +0000
@@ -83,8 +83,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "/{version:.+}" )
     @ResponseBody
-    public OrgUnits getOrgUnitsForUser( HttpServletRequest request, @PathVariable
-    String version )
+    public OrgUnits getOrgUnitsForUser( HttpServletRequest request, @PathVariable String version )
         throws NotAllowedException
     {
         User user = currentUserService.getCurrentUser();
@@ -108,8 +107,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "/{version}/LWUIT" )
     @ResponseBody
-    public OrgUnits getOrgUnitsForUserLWUIT( HttpServletRequest request, @PathVariable
-    String version )
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.OrgUnits getOrgUnitsForUserLWUIT( HttpServletRequest request, @PathVariable String version )
         throws NotAllowedException
     {
         User user = currentUserService.getCurrentUser();
@@ -120,17 +118,72 @@
         }
 
         Collection<OrganisationUnit> units = user.getOrganisationUnits();
-
-        List<MobileOrgUnitLinks> unitList = new ArrayList<>();
+        
+        List<org.hisp.dhis.api.mobile.model.LWUITmodel.MobileOrgUnitLinks> unitList = new ArrayList<>();
         for ( OrganisationUnit unit : units )
         {
-            unitList.add( getOrgUnit( unit, request ) );
+            unitList.add( getTrackerOrgUnit( unit, request ) );
         }
-        OrgUnits orgUnits = new OrgUnits( unitList );
+        org.hisp.dhis.api.mobile.model.LWUITmodel.OrgUnits orgUnits = new org.hisp.dhis.api.mobile.model.LWUITmodel.OrgUnits( unitList );
         orgUnits.setClientVersion( version );
         return orgUnits;
     }
 
+    private org.hisp.dhis.api.mobile.model.LWUITmodel.MobileOrgUnitLinks getTrackerOrgUnit( OrganisationUnit unit,
+        HttpServletRequest request )
+    {
+        org.hisp.dhis.api.mobile.model.LWUITmodel.MobileOrgUnitLinks orgUnit = new org.hisp.dhis.api.mobile.model.LWUITmodel.MobileOrgUnitLinks();
+
+        orgUnit.setId( unit.getId() );
+        orgUnit.setName( unit.getShortName() );
+
+        orgUnit.setDownloadAllUrl( getUrl( request, unit.getId(), "all" ) );
+        orgUnit.setUpdateActivityPlanUrl( getUrl( request, unit.getId(), "activitiyplan" ) );
+        orgUnit.setUploadFacilityReportUrl( getUrl( request, unit.getId(), "dataSets" ) );
+        orgUnit.setDownloadFacilityReportUrl( getUrl( request, unit.getId(), "dataSetValue" ) );
+        orgUnit.setUploadActivityReportUrl( getUrl( request, unit.getId(), "activities" ) );
+        orgUnit.setUpdateDataSetUrl( getUrl( request, unit.getId(), "updateDataSets" ) );
+        orgUnit.setChangeUpdateDataSetLangUrl( getUrl( request, unit.getId(), "changeLanguageDataSet" ) );
+        orgUnit.setSearchUrl( getUrl( request, unit.getId(), "search" ) );
+        orgUnit.setUpdateNewVersionUrl( getUrl( request, unit.getId(), "updateNewVersionUrl" ) );
+        orgUnit.setSendFeedbackUrl( getUrl( request, unit.getId(), "sendFeedback" ) );
+        orgUnit.setFindUserUrl( getUrl( request, unit.getId(), "findUser" ) );
+        orgUnit.setSendMessageUrl( getUrl( request, unit.getId(), "sendMessage" ) );
+        orgUnit.setDownloadMessageConversationUrl( getUrl( request, unit.getId(), "downloadMessageConversation" ) );
+        orgUnit.setGetMessageUrl( getUrl( request, unit.getId(), "getMessage" ) );
+        orgUnit.setReplyMessageUrl( getUrl( request, unit.getId(), "replyMessage" ) );
+        orgUnit.setDownloadInterpretationUrl( getUrl( request, unit.getId(), "downloadInterpretation" ) );
+        orgUnit.setPostInterpretationUrl( getUrl( request, unit.getId(), "postInterpretation" ) );
+        orgUnit.setPostCommentUrl( getUrl( request, unit.getId(), "postComment" ) );
+        orgUnit.setUpdateContactUrl( getUrl( request, unit.getId(), "updateContactForMobile" ) );
+        orgUnit.setFindPatientUrl( getUrl( request, unit.getId(), "findPatient" ) );
+        orgUnit.setRegisterPersonUrl( getUrl( request, unit.getId(), "registerPerson" ) );
+        orgUnit.setUploadProgramStageUrl( getUrl( request, unit.getId(), "uploadProgramStage" ) );
+        orgUnit.setEnrollProgramUrl( getUrl( request, unit.getId(), "enrollProgram" ) );
+        orgUnit.setGetVariesInfoUrl( getUrl( request, unit.getId(), "getVariesInfo" ) );
+        orgUnit.setAddRelationshipUrl( getUrl( request, unit.getId(), "addRelationship" ) );
+        orgUnit.setDownloadAnonymousProgramUrl( getUrl( request, unit.getId(), "downloadAnonymousProgram" ) );
+        orgUnit.setFindProgramUrl( getUrl( request, unit.getId(), "findProgram" ) );
+        orgUnit.setFindPatientInAdvancedUrl( getUrl( request, unit.getId(), "findPatientInAdvanced" ) );
+        orgUnit.setFindPatientsUrl( getUrl( request, unit.getId(), "findPatients" ) );
+        orgUnit.setFindVisitScheduleUrl( getUrl( request, unit.getId(), "findVisitSchedule" ) );
+        orgUnit.setFindLostToFollowUpUrl( getUrl( request, unit.getId(), "findLostToFollowUp" ) );
+        orgUnit.setHandleLostToFollowUpUrl( getUrl( request, unit.getId(), "handleLostToFollowUp" ) );
+        orgUnit.setGenerateRepeatableEventUrl( getUrl( request, unit.getId(), "generateRepeatableEvent" ) );
+        orgUnit.setUploadSingleEventWithoutRegistration( getUrl( request, unit.getId(),
+            "uploadSingleEventWithoutRegistration" ) );
+        orgUnit.setCompleteProgramInstanceUrl( getUrl( request, unit.getId(), "completeProgramInstance" ) );
+        orgUnit.setRegisterRelativeUrl( getUrl( request, unit.getId(), "registerRelative" ) );
+
+        // generate URL for download new version
+        String full = UrlUtils.buildFullRequestUrl( request );
+        String root = full.substring( 0, full.length() - UrlUtils.buildRequestUrl( request ).length() );
+        String updateNewVersionUrl = root + "/dhis-web-api-mobile/updateClient.action";
+        orgUnit.setUpdateNewVersionUrl( updateNewVersionUrl );
+
+        return orgUnit;
+    }
+
     private MobileOrgUnitLinks getOrgUnit( OrganisationUnit unit, HttpServletRequest request )
     {
         MobileOrgUnitLinks orgUnit = new MobileOrgUnitLinks();
@@ -153,7 +206,7 @@
         orgUnit.setDownloadMessageConversationUrl( getUrl( request, unit.getId(), "downloadMessageConversation" ) );
         orgUnit.setGetMessageUrl( getUrl( request, unit.getId(), "getMessage" ) );
         orgUnit.setReplyMessageUrl( getUrl( request, unit.getId(), "replyMessage" ) );
-        orgUnit.setDownloadInterpretationUrl(getUrl(request, unit.getId(), "downloadInterpretation" ));
+        orgUnit.setDownloadInterpretationUrl( getUrl( request, unit.getId(), "downloadInterpretation" ) );
         orgUnit.setPostInterpretationUrl( getUrl( request, unit.getId(), "postInterpretation" ) );
         orgUnit.setPostCommentUrl( getUrl( request, unit.getId(), "postComment" ) );
         orgUnit.setUpdateContactUrl( getUrl( request, unit.getId(), "updateContactForMobile" ) );
@@ -173,8 +226,8 @@
         orgUnit.setGenerateRepeatableEventUrl( getUrl( request, unit.getId(), "generateRepeatableEvent" ) );
         orgUnit.setUploadSingleEventWithoutRegistration( getUrl( request, unit.getId(),
             "uploadSingleEventWithoutRegistration" ) );
-        orgUnit.setCompleteProgramInstanceUrl(getUrl( request, unit.getId(), "completeProgramInstance" ) );
-        orgUnit.setRegisterRelativeUrl(getUrl( request, unit.getId(), "registerRelative" ));
+        orgUnit.setCompleteProgramInstanceUrl( getUrl( request, unit.getId(), "completeProgramInstance" ) );
+        orgUnit.setRegisterRelativeUrl( getUrl( request, unit.getId(), "registerRelative" ) );
 
         // generate URL for download new version
         String full = UrlUtils.buildFullRequestUrl( request );

=== 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	2015-10-08 13:50:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2015-12-04 08:18:34 +0000
@@ -315,12 +315,14 @@
     public org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel getAllDataForOrgUnitLWUIT(
         @PathVariable String clientVersion, @PathVariable int id )
     {
+		System.out.println("Start getting model");
         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() );
         mobileModel.setRelationshipTypes( programService.getAllRelationshipTypes() );
+		System.out.println("Finish all data");
         return mobileModel;
     }