← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3046: [DHISMobile] Send current Date to mobile client.

 

------------------------------------------------------------
revno: 3046
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Wed 2011-03-16 14:27:49 +0700
message:
  [DHISMobile] Send current Date to mobile client.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileModel.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.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/MobileModel.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileModel.java	2011-01-12 09:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/MobileModel.java	2011-03-16 07:27:49 +0000
@@ -30,6 +30,7 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.Date;
 import java.util.List;
 
 import javax.xml.bind.annotation.XmlRootElement;
@@ -41,6 +42,8 @@
     private ActivityPlan activityPlan;
 
     private List<Program> programs;
+    
+    private Date serverCurrentDate;
 
     private List<DataSet> datasets;
 
@@ -63,8 +66,17 @@
     {
         this.programs = programs;
     }
-
-    public List<DataSet> getDatasets()
+    
+
+    public Date getServerCurrentDate() {
+		return serverCurrentDate;
+	}
+
+	public void setServerCurrentDate(Date serverCurrentDate) {
+		this.serverCurrentDate = serverCurrentDate;
+	}
+
+	public List<DataSet> getDatasets()
     {
         return datasets;
     }
@@ -102,6 +114,8 @@
         {
             this.activityPlan.serialize( dout );
         }
+        
+        dout.writeLong(serverCurrentDate.getTime());
 
         // Write DataSets
         if ( datasets == null )

=== 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-03-15 07:35:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	2011-03-16 07:27:49 +0000
@@ -27,6 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Date;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.HeaderParam;
@@ -126,7 +128,7 @@
         mobileModel.setActivityPlan( activityReportingService.getCurrentActivityPlan( getUnit(), locale ) );
         mobileModel.setPrograms( programService.getPrograms( getUnit(), locale ) );
         mobileModel.setDatasets( facilityReportingService.getMobileDataSetsForUnit( getUnit(), locale ) );
-
+        mobileModel.setServerCurrentDate(new Date());
         return mobileModel;
     }
 
@@ -173,6 +175,7 @@
         MobileModel model = new MobileModel();
         model.setPrograms( programService.updateProgram( programsFromClient, locale, getUnit() ) );
         model.setActivityPlan( activityReportingService.getCurrentActivityPlan( getUnit(), locale ) );
+        model.setServerCurrentDate(new Date());
         return model;
     }