dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19843
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8822: Sorting of option sets
------------------------------------------------------------
revno: 8822
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-01 15:01:37 +0300
message:
Sorting of option sets
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.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/option/hibernate/HibernateOptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java 2012-06-25 13:20:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java 2012-11-01 12:01:37 +0000
@@ -47,12 +47,15 @@
@Override
public List<String> getOptions( OptionSet optionSet, String key, Integer max )
{
- String hql = "select option from OptionSet as optionset inner join optionset.options as option where optionset.id = :optionSetId ";
- if( key != null )
+ String hql = "select option from OptionSet os inner join os.options as option where os.id = :optionSetId";
+
+ if ( key != null )
{
hql += " and lower(option) like lower('%" + key + "%') ";
}
+ hql += " order by option";
+
Query query = getQuery( hql );
query.setInteger( "optionSetId", optionSet.getId() );
query.setMaxResults( max );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-06-25 18:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java 2012-11-01 12:01:37 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.caseentry.action.caseentry;
+import java.util.Collections;
import java.util.List;
import org.apache.commons.lang.StringUtils;