← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6945: [mobile] minor fix

 

------------------------------------------------------------
revno: 6945
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-05-15 16:48:47 +0700
message:
  [mobile] minor fix
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml


--
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-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2012-05-15 07:40:06 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2012-05-15 09:48:47 +0000
@@ -27,7 +27,10 @@
 
 package org.hisp.dhis.light.namebaseddataentry.action;
 
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import org.hisp.dhis.api.mobile.model.Activity;
 import org.hisp.dhis.api.mobile.model.ActivityPlan;
 import org.hisp.dhis.api.mobile.model.DataElement;
@@ -36,6 +39,8 @@
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 
 import com.opensymphony.xwork2.Action;
@@ -43,7 +48,6 @@
 public class GetProgramStageFormAction
     implements Action
 {
-    private static final String INCOMPLETE = "incomplete";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -79,6 +83,19 @@
     {
         this.programStageInstanceService = programStageInstanceService;
     }
+    
+    private PatientDataValueService patientDataValueService;
+    
+    public PatientDataValueService getPatientDataValueService()
+    {
+        return patientDataValueService;
+    }
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+    
 
     // -------------------------------------------------------------------------
     // Input & Output
@@ -204,6 +221,13 @@
     }
 
     private boolean current;
+    
+    private Map<String, String> prevDataValues = new HashMap<String, String>();
+
+    public Map<String, String> getPrevDataValues()
+    {
+        return prevDataValues;
+    }
 
     // -------------------------------------------------------------------------
     // Action Implementation
@@ -225,10 +249,14 @@
     {
         // organisationUnit = organisationUnitService.getOrganisationUnit(
         // Integer.parseInt( orgUnitId ) );
-
+        prevDataValues.clear();
         programStage = util.getProgramStage( Integer.parseInt( programId ), Integer.parseInt( programStageId ) );
         dataElements = programStage.getDataElements();
-       
+        Collection<PatientDataValue> patientDataValues =  patientDataValueService.getPatientDataValues( programStageInstanceService.getProgramStageInstance( programStageInstanceId ) );
+        for (PatientDataValue patientDataValue : patientDataValues) {
+            prevDataValues.put( "DE" + patientDataValue.getDataElement().getId() + "OC" + 4, patientDataValue.getValue() );
+        }
+        
         return SUCCESS;
 
     }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-05-15 07:40:06 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-05-15 09:48:47 +0000
@@ -176,7 +176,9 @@
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils"/>
 		<property name="programStageInstanceService"
-			ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+			ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService"/>
 	</bean>
 	
 	<bean id="org.hisp.dhis.light.utils.NamebasedUtils"