← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3973: Fix bug: Data elements list doesn't show dataelements.

 

------------------------------------------------------------
revno: 3973
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 09:51:13 +0700
message:
  Fix bug: Data elements list doesn't show dataelements.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java	2011-05-30 04:34:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java	2011-06-22 02:51:13 +0000
@@ -29,12 +29,16 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 import org.hisp.dhis.program.ProgramDataEntryService;
 import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.program.comparator.ProgramStageNameComparator;
 
@@ -61,7 +65,7 @@
     }
 
     private ProgramDataEntryService programDataEntryService;
-    
+
     public void setProgramDataEntryService( ProgramDataEntryService programDataEntryService )
     {
         this.programDataEntryService = programDataEntryService;
@@ -74,6 +78,35 @@
         this.programStageService = programStageService;
     }
 
+    private ProgramStageDataElementService programStageDataElementService;
+
+    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+    {
+        this.programStageDataElementService = programStageDataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+
+    private Comparator<DataElement> dataElementComparator;
+
+    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+    {
+        this.dataElementComparator = dataElementComparator;
+    }
+
+    // -------------------------------------------------------------------------
+    // DisplayPropertyHandler
+    // -------------------------------------------------------------------------
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
     // -------------------------------------------------------------------------
     // Getters & Setters
     // -------------------------------------------------------------------------
@@ -119,7 +152,14 @@
     {
         return dataEntryValue;
     }
-    
+
+    private List<DataElement> dataElements;
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -143,7 +183,7 @@
         {
             dataEntryValue = "";
         }
-        
+
         // ---------------------------------------------------------------------
         // Get existing Data Entry Forms
         // ---------------------------------------------------------------------
@@ -158,8 +198,8 @@
         existingDataEntryForms = new ArrayList<DataEntryForm>( dataEntryFormService
             .listDisctinctDataEntryFormByProgramStageIds( listAssociationIds ) );
 
-        existingDataEntryForms.remove( dataEntryForm );     
-        
+        existingDataEntryForms.remove( dataEntryForm );
+
         // ---------------------------------------------------------------------
         // Get other program-stages into the program
         // ---------------------------------------------------------------------
@@ -170,6 +210,16 @@
 
         Collections.sort( programStages, new ProgramStageNameComparator() );
 
+        // ---------------------------------------------------------------------
+        // Get selected program-stage
+        // ---------------------------------------------------------------------
+
+        dataElements = new ArrayList<DataElement>( programStageDataElementService.getListDataElement( programStage ) );
+        
+        Collections.sort( dataElements, dataElementComparator );
+        
+        displayPropertyHandler.handle( dataElements );
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-06-02 04:24:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-06-22 02:51:13 +0000
@@ -811,6 +811,8 @@
 		</property>
 		<property name="programDataEntryService"
 			ref="org.hisp.dhis.program.ProgramDataEntryService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
 
 	<bean