dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27663
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13772: Sorting for data elements with domain type
------------------------------------------------------------
revno: 13772
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-01-18 17:40:54 +0100
message:
Sorting for data elements with domain type
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2013-11-21 09:09:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2014-01-18 16:40:54 +0000
@@ -33,6 +33,7 @@
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.ListMap;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
@@ -146,6 +147,7 @@
criteria.setFirstResult( first );
criteria.setMaxResults( max );
+ criteria.addOrder( Order.asc( "name" ) );
return criteria.list();
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java 2013-11-21 09:09:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java 2014-01-18 16:40:54 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.api.controller.WebMetaData;
import org.hisp.dhis.api.controller.WebOptions;
import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +40,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -80,6 +82,7 @@
else
{
entityList = new ArrayList<DataElement>( dataElementService.getDataElementsByDomainType( domainType ) );
+ Collections.sort( entityList, IdentifiableObjectNameComparator.INSTANCE );
}
}
else if ( lastUpdated != null )