← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2884: [DHISMobile]Change:

 

------------------------------------------------------------
revno: 2884
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Mon 2011-02-21 13:51:20 +0700
message:
  [DHISMobile]Change:
  - Get incomplete Activities only.
  - Merge updatePrograms and updateActivity together
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitTest.java
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitsTest.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java	2011-02-18 20:17:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java	2011-02-21 06:51:20 +0000
@@ -44,14 +44,12 @@
 
     private String downloadAllUrl;
 
-    private String downloadActivityPlanUrl;
+    private String updateActivityPlanUrl;
 
     private String uploadFacilityReportUrl;
 
     private String uploadActivityReportUrl;
 
-    private String updateProgramUrl;
-
     private String updateDataSetUrl;
 
     @XmlAttribute
@@ -86,16 +84,6 @@
         this.downloadAllUrl = downloadAllUrl;
     }
 
-    public String getDownloadActivityPlanUrl()
-    {
-        return downloadActivityPlanUrl;
-    }
-
-    public void setDownloadActivityPlanUrl( String downloadActivityPlanUrl )
-    {
-        this.downloadActivityPlanUrl = downloadActivityPlanUrl;
-    }
-
     public String getUploadFacilityReportUrl()
     {
         return uploadFacilityReportUrl;
@@ -126,26 +114,23 @@
         this.updateDataSetUrl = updateDataSetUrl;
     }
 
-    public String getUpdateProgramUrl()
-    {
-        return updateProgramUrl;
-    }
-
-    public void setUpdateProgramUrl( String updateProgramUrl )
-    {
-        this.updateProgramUrl = updateProgramUrl;
-    }
-
-    public void serialize( DataOutputStream dataOutputStream )
+    public String getUpdateActivityPlanUrl() {
+		return updateActivityPlanUrl;
+	}
+
+	public void setUpdateActivityPlanUrl(String updateActivityPlanUrl) {
+		this.updateActivityPlanUrl = updateActivityPlanUrl;
+	}
+
+	public void serialize( DataOutputStream dataOutputStream )
         throws IOException
     {
         dataOutputStream.writeInt( this.id );
         dataOutputStream.writeUTF( this.name );
         dataOutputStream.writeUTF( this.downloadAllUrl );
-        dataOutputStream.writeUTF( this.downloadActivityPlanUrl );
+        dataOutputStream.writeUTF(this.updateActivityPlanUrl);
         dataOutputStream.writeUTF( this.uploadFacilityReportUrl );
         dataOutputStream.writeUTF( this.uploadActivityReportUrl );
-        dataOutputStream.writeUTF( this.updateProgramUrl );
         dataOutputStream.writeUTF( this.updateDataSetUrl );
     }
 
@@ -155,10 +140,9 @@
         this.id = dataInputStream.readInt();
         this.name = dataInputStream.readUTF();
         this.downloadAllUrl = dataInputStream.readUTF();
-        this.downloadActivityPlanUrl = dataInputStream.readUTF();
+        this.updateActivityPlanUrl = dataInputStream.readUTF();
         this.uploadFacilityReportUrl = dataInputStream.readUTF();
         this.uploadActivityReportUrl = dataInputStream.readUTF();
-        this.updateProgramUrl = dataInputStream.readUTF();
         this.updateDataSetUrl = dataInputStream.readUTF();
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	2011-02-18 20:17:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	2011-02-21 06:51:20 +0000
@@ -177,16 +177,6 @@
     }
 
     /**
-     * Get a localized representation of the current activity plan
-     */
-    @GET
-    @Path( "activitiyplan" )
-    public ActivityPlan getCurrentActivityPlan( @HeaderParam( "accept-language" ) String locale )
-    {
-        return activityReportingService.getCurrentActivityPlan( getUnit(), locale );
-    }
-
-    /**
      * Save a facility report for unit
      * 
      * @param dataSetValue - the report to save
@@ -216,11 +206,12 @@
     }
 
     @POST
-    @Path( "programs" )
+    @Path( "activitiyplan" )
     public MobileModel updatePrograms( @HeaderParam( "accept-language" ) String locale, ModelList programsFromClient )
     {
         MobileModel model = new MobileModel();
         model.setPrograms( programService.updateProgram( programsFromClient, locale, getUnit() ) );
+		model.setActivityPlan(activityReportingService.getCurrentActivityPlan( getUnit(), locale ));
         return model;
     }
 
@@ -233,14 +224,12 @@
 
         orgUnit.setDownloadAllUrl( getOrgUnitUrlBuilder(uriInfo).path( "all" )
             .build( unit.getId() ).toString() );
-        orgUnit.setDownloadActivityPlanUrl( getOrgUnitUrlBuilder(uriInfo).path( "activitiyplan" )
+        orgUnit.setUpdateActivityPlanUrl( getOrgUnitUrlBuilder(uriInfo).path( "activitiyplan" )
             .build( unit.getId() ).toString() );
         orgUnit.setUploadFacilityReportUrl( getOrgUnitUrlBuilder(uriInfo).path( "dataSets" )
             .build( unit.getId() ).toString() );
         orgUnit.setUploadActivityReportUrl( getOrgUnitUrlBuilder(uriInfo).path( "activities" )
             .build( unit.getId() ).toString() );
-        orgUnit.setUpdateProgramUrl( getOrgUnitUrlBuilder(uriInfo).path( "programs" )
-            .build( unit.getId() ).toString() );
         orgUnit.setUpdateDataSetUrl( getOrgUnitUrlBuilder(uriInfo).path( "updateDataSets" )
             .build( unit.getId() ).toString() );
         return orgUnit;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java	2011-01-21 18:28:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java	2011-02-21 06:51:20 +0000
@@ -105,7 +105,7 @@
         DateMidnight from = dt.withDayOfMonth( 1 ).toDateMidnight();
         DateMidnight to = from.plusMonths( 1 );
 
-        List<ProgramStageInstance> instances = programStageInstanceService.get( unit, from.toDate(), to.toDate(), null );
+        List<ProgramStageInstance> instances = programStageInstanceService.get( unit, from.toDate(), to.toDate(), false );
 
         for ( ProgramStageInstance instance : instances )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitTest.java'
--- dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitTest.java	2011-01-12 09:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitTest.java	2011-02-21 06:51:20 +0000
@@ -47,12 +47,11 @@
         OrgUnit unit = new OrgUnit();
         unit.setId( 1 );
         unit.setName( "name" );
-        unit.setDownloadActivityPlanUrl( "downloadActivityPlanUrl" );
+        unit.setUpdateActivityPlanUrl("updateActivityPlanUrl");
         unit.setDownloadAllUrl( "downloadAllUrl" );
         unit.setUploadActivityReportUrl( "uploadActivityReportUrl" );
         unit.setUploadFacilityReportUrl( "uploadFacilityReportUrl" );
         unit.setUpdateDataSetUrl( "updateDataSetUrl" );
-        unit.setUpdateProgramUrl( "updateProgramUrl" );
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream( baos );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitsTest.java'
--- dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitsTest.java	2011-01-12 09:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/web/api/model/OrgUnitsTest.java	2011-02-21 06:51:20 +0000
@@ -73,12 +73,11 @@
         OrgUnit unit = new OrgUnit();
         unit.setId( 1 );
         unit.setName( "name" );
-        unit.setDownloadActivityPlanUrl( "downloadActivityPlanUrl" );
+        unit.setUpdateActivityPlanUrl("updateActivityPlanUrl");
         unit.setDownloadAllUrl( "downloadAllUrl" );
         unit.setUploadActivityReportUrl( "uploadActivityReportUrl" );
         unit.setUploadFacilityReportUrl( "uploadFacilityReportUrl" );
         unit.setUpdateDataSetUrl( "updateDataSetUrl" );
-        unit.setUpdateProgramUrl( "updateProgramUrl" );
         return unit;
     }
 }