← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7909: Aggregate data element list in query builder should be sorted.

 

------------------------------------------------------------
revno: 7909
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-14 14:27:41 +0700
message:
  Aggregate data element list in query builder should be sorted.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetDataElementsByDataSetAction.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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetDataElementsByDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetDataElementsByDataSetAction.java	2012-07-07 10:29:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetDataElementsByDataSetAction.java	2012-08-14 07:27:41 +0000
@@ -27,9 +27,13 @@
 
 package org.hisp.dhis.patient.action.caseaggregation;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
@@ -87,9 +91,9 @@
     // Output
     // -------------------------------------------------------------------------
 
-    private Collection<DataElement> dataElements;
+    private List<DataElement> dataElements;
 
-    public Collection<DataElement> getDataElements()
+    public List<DataElement> getDataElements()
     {
         return dataElements;
     }
@@ -104,7 +108,10 @@
 
         query = StringUtils.trimToNull( query );
 
-        dataElements = dataElementService.getDataElements( dataSet, query, MAX_DATAELEMENTS_DISPLAYED );
+        dataElements = new ArrayList<DataElement>( dataElementService.getDataElements( dataSet, query,
+            MAX_DATAELEMENTS_DISPLAYED ) );
+
+        Collections.sort( dataElements, new IdentifiableObjectNameComparator() );
 
         return SUCCESS;
     }