dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10994
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3040: [DHISMobile] auto update Activity Plan + auto delete overdue activity. (Work in Progress)
------------------------------------------------------------
revno: 3040
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Tue 2011-03-15 14:35:40 +0700
message:
[DHISMobile] auto update Activity Plan + auto delete overdue activity. (Work in Progress)
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.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
--
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/Activity.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java 2011-01-12 09:13:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Activity.java 2011-03-15 07:35:40 +0000
@@ -45,6 +45,8 @@
private Task task;
private Date dueDate;
+
+ private Date expireDate;
public Beneficiary getBeneficiary()
{
@@ -87,7 +89,15 @@
this.late = late;
}
- @Override
+ public Date getExpireDate() {
+ return expireDate;
+ }
+
+ public void setExpireDate(Date expireDate) {
+ this.expireDate = expireDate;
+ }
+
+ @Override
public void serialize( DataOutputStream dout )
throws IOException
{
@@ -95,6 +105,7 @@
this.getBeneficiary().serialize( dout );
dout.writeBoolean( late );
dout.writeLong( this.getDueDate().getTime() );
+ dout.writeLong(this.getExpireDate().getTime());
}
@Override
@@ -109,6 +120,7 @@
this.late = dataInputStream.readBoolean();
this.dueDate = new Date( dataInputStream.readLong() );
+ this.expireDate = new Date(dataInputStream.readLong());
}
}
=== 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-25 18:08:38 +0000
+++ 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
@@ -168,7 +168,7 @@
@POST
@Path( "activitiyplan" )
- public MobileModel updatePrograms( @HeaderParam( "accept-language" ) String locale, ModelList programsFromClient )
+ public MobileModel updatePrograms( @HeaderParam( "accept-language" ) String locale, ModelList programsFromClient)
{
MobileModel model = new MobileModel();
model.setPrograms( programService.updateProgram( programsFromClient, locale, getUnit() ) );
=== 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-02-21 06:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-03-15 07:35:40 +0000
@@ -52,6 +52,7 @@
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.web.api.model.Activity;
import org.hisp.dhis.web.api.model.ActivityPlan;
import org.hisp.dhis.web.api.model.ActivityValue;
@@ -211,6 +212,8 @@
activity.setDueDate( instance.getDueDate() );
activity.setTask( getTask( instance ) );
activity.setLate( late );
+ activity.setExpireDate(DateUtils.getDateAfterAddition(instance.getDueDate(), instance.getProgramInstance().getProgram().getMaxDaysAllowedInputData()));
+
return activity;
}