dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18759
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7944: Fixed bug with loading users in web api
------------------------------------------------------------
revno: 7944
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-21 09:59:21 +0200
message:
Fixed bug with loading users in web api
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.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/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2012-08-21 07:59:21 +0000
@@ -30,7 +30,9 @@
import java.util.Collection;
import java.util.Iterator;
+import org.hibernate.Criteria;
import org.hibernate.Query;
+import org.hibernate.criterion.Order;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.user.User;
@@ -46,6 +48,17 @@
// UserStore implementation
// -------------------------------------------------------------------------
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<User> getBetween( int first, int max )
+ {
+ Criteria criteria = getCriteria();
+ criteria.addOrder( Order.asc( "surname" ) ).addOrder( Order.asc( "firstName" ) );
+ criteria.setFirstResult( first );
+ criteria.setMaxResults( max );
+ return criteria.list();
+ }
+
public Collection<User> getUsersWithoutOrganisationUnit()
{
Collection<User> users = getAll();