← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5817: Made sorting and paging work correctly with regard to database translations

 

------------------------------------------------------------
revno: 5817
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-01-28 17:24:59 +0100
message:
  Made sorting and paging work correctly with regard to database translations
removed:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/IdentifiableObjectUtils.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupSetsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupSetsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserGroupsAction.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-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java	2012-01-28 16:24:59 +0000
@@ -27,8 +27,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
 
 /**
  * @author Lars Helge Overland
@@ -36,7 +39,7 @@
 public class IdentifiableObjectUtils
 {
     private static final String SEPARATOR_JOIN = ", ";
-        
+    
     /**
      * Joins the names of the IdentifiableObjects in the given list and separates 
      * them with a comma and space. Returns null if the given list is null or has 
@@ -51,11 +54,11 @@
         {
             Iterator<? extends IdentifiableObject> iterator = objects.iterator();
             
-            StringBuilder builder = new StringBuilder( iterator.next().getName() );
+            StringBuilder builder = new StringBuilder( iterator.next().getDisplayName() );
             
             while ( iterator.hasNext() )
             {
-                builder.append( SEPARATOR_JOIN ).append( iterator.next().getName() );
+                builder.append( SEPARATOR_JOIN ).append( iterator.next().getDisplayName() );
             }
             
             return builder.toString();
@@ -63,4 +66,29 @@
         
         return null;
     }
+    
+    public static <T extends IdentifiableObject> List<T> filterNameByKey( List<T> identifiableObjects, String key,
+        boolean ignoreCase )
+    {
+        List<T> objects = new ArrayList<T>();
+        ListIterator<T> iterator = identifiableObjects.listIterator();
+
+        if ( ignoreCase )
+        {
+            key = key.toLowerCase();
+        }
+
+        while ( iterator.hasNext() )
+        {
+            T object = iterator.next();
+            String name = ignoreCase ? object.getDisplayName().toLowerCase() : object.getDisplayName();
+
+            if ( name.indexOf( key ) != -1 )
+            {
+                objects.add( object );
+            }
+        }
+
+        return objects;
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2012-01-28 10:30:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2012-01-28 16:24:59 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import static org.hisp.dhis.i18n.I18nUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -93,9 +93,7 @@
 
     public int addDataElement( DataElement dataElement )
     {
-        int id = dataElementStore.save( dataElement );
-
-        return id;
+        return dataElementStore.save( dataElement );
     }
 
     public void updateDataElement( DataElement dataElement )
@@ -302,21 +300,11 @@
         return dataElementStore.dataElementCategoryOptionComboExists( id );
     }
 
-    public Collection<DataElement> getDataElementsLikeName( String name )
+    public Collection<DataElement> getDataElementsLikeName( String name ) //TODO fix
     {
         return i18n( i18nService, dataElementStore.getLikeName( name ) );
     }
 
-    public Collection<DataElement> getDataElementsBetween( int first, int max )
-    {
-        return i18n( i18nService, dataElementStore.getBetween( first, max ) );
-    }
-
-    public Collection<DataElement> getDataElementsBetweenByName( String name, int first, int max )
-    {
-        return i18n( i18nService, dataElementStore.getBetweenByName( name, first, max ) );
-    }
-
     public int getDataElementCount()
     {
         return dataElementStore.getCount();
@@ -324,7 +312,17 @@
 
     public int getDataElementCountByName( String name )
     {
-        return dataElementStore.getCountByName( name );
+        return getCountByName( i18nService, dataElementStore, name );
+    }
+
+    public Collection<DataElement> getDataElementsBetween( int first, int max )
+    {
+        return getObjectsBetween( i18nService, dataElementStore, first, max );
+    }
+
+    public Collection<DataElement> getDataElementsBetweenByName( String name, int first, int max )
+    {
+        return getObjectsBetweenByName( i18nService, dataElementStore, name, first, max );
     }
 
     public Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets )
@@ -413,16 +411,6 @@
         return i18n( i18nService, dataElementGroupStore.get( groupId ).getMembers() );
     }
 
-    public Collection<DataElementGroup> getDataElementGroupsBetween( int first, int max )
-    {
-        return dataElementGroupStore.getBetween( first, max );
-    }
-
-    public Collection<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max )
-    {
-        return i18n( i18nService, dataElementGroupStore.getBetweenByName( name, first, max ) );
-    }
-
     public int getDataElementGroupCount()
     {
         return dataElementGroupStore.getCount();
@@ -430,7 +418,17 @@
 
     public int getDataElementGroupCountByName( String name )
     {
-        return dataElementGroupStore.getCountByName( name );
+        return getCountByName( i18nService, dataElementGroupStore, name );
+    }
+
+    public Collection<DataElementGroup> getDataElementGroupsBetween( int first, int max )
+    {
+        return getObjectsBetween( i18nService, dataElementGroupStore, first, max );
+    }
+
+    public Collection<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max )
+    {
+        return getObjectsBetweenByName( i18nService, dataElementGroupStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------
@@ -536,17 +534,17 @@
 
     public int getDataElementGroupSetCountByName( String name )
     {
-        return dataElementGroupSetStore.getCountByName( name );
+        return getCountByName( i18nService, dataElementGroupSetStore, name );
     }
 
     public Collection<DataElementGroupSet> getDataElementGroupSetsBetween( int first, int max )
     {
-        return i18n( i18nService, dataElementGroupSetStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, dataElementGroupSetStore, first, max );
     }
 
     public Collection<DataElementGroupSet> getDataElementGroupSetsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, dataElementGroupSetStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, dataElementGroupSetStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-01-27 11:40:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-01-28 16:24:59 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import static org.hisp.dhis.i18n.I18nUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -287,18 +287,18 @@
     @Override
     public int getDataSetCountByName( String name )
     {
-        return dataSetStore.getCountByName( name );
+        return getCountByName( i18nService, dataSetStore, name );
     }
 
     @Override
     public Collection<DataSet> getDataSetsBetween( int first, int max )
     {
-        return i18n( i18nService, dataSetStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, dataSetStore, first, max );
     }
 
     @Override
     public Collection<DataSet> getDataSetsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, dataSetStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, dataSetStore, name, first, max );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java	2012-01-20 10:00:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java	2012-01-28 16:24:59 +0000
@@ -30,7 +30,10 @@
 import java.util.Collection;
 import java.util.Locale;
 
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.system.paging.Paging;
 
 /**
  * @author Lars Helge Overland
@@ -60,4 +63,28 @@
         i18nService.internationalise( objects, locale );        
         return objects;
     }
+    
+    public static <T extends IdentifiableObject> int getCountByName( 
+        I18nService i18nService, GenericIdentifiableObjectStore<T> store, String name )
+    {
+        return i18nService.currentLocaleIsBase() ?
+            store.getCountByName( name ) :
+            Paging.getCountByName( i18n( i18nService, store.getAll() ), name );
+    }
+    
+    public static <T extends IdentifiableObject> Collection<T> getObjectsBetween( 
+        I18nService i18nService, GenericIdentifiableObjectStore<T> store, int first, int max )
+    {
+        return i18nService.currentLocaleIsBase() ?
+            i18n( i18nService, store.getBetween( first, max ) ) :
+            Paging.getObjectsBetween( i18n( i18nService, store.getAll() ), first, max );
+    }
+    
+    public static <T extends IdentifiableObject> Collection<T> getObjectsBetweenByName(
+        I18nService i18nService, GenericIdentifiableObjectStore<T> store, String name, int first, int max )
+    {
+        return i18nService.currentLocaleIsBase() ?
+            i18n( i18nService, store.getBetweenByName( name, first, max ) ) :
+            Paging.getObjectsBetweenByName( i18n( i18nService, store.getAll() ), name, first, max );
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2012-01-27 11:40:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2012-01-28 16:24:59 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import static org.hisp.dhis.i18n.I18nUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -168,6 +168,11 @@
         return i18n( i18nService, indicatorStore.getIndicatorsWithDataSets() );
     }
 
+    public Collection<Indicator> getIndicatorsLikeName( String name ) //TODO fix
+    {
+        return i18n( i18nService, indicatorStore.getLikeName( name ) );
+    }
+
     public int getIndicatorCount()
     {
         return indicatorStore.getCount();
@@ -175,22 +180,17 @@
 
     public int getIndicatorCountByName( String name )
     {
-        return indicatorStore.getCountByName( name );
-    }
-
-    public Collection<Indicator> getIndicatorsLikeName( String name )
-    {
-        return i18n( i18nService, indicatorStore.getLikeName( name ) );
+        return getCountByName( i18nService, indicatorStore, name );
     }
 
     public Collection<Indicator> getIndicatorsBetween( int first, int max )
     {
-        return i18n( i18nService, indicatorStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, indicatorStore, first, max );
     }
 
     public Collection<Indicator> getIndicatorsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, indicatorStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, indicatorStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------
@@ -252,17 +252,17 @@
 
     public int getIndicatorTypeCountByName( String name )
     {
-        return indicatorTypeStore.getCountByName( name );
+        return getCountByName( i18nService, indicatorTypeStore, name );
     }
 
     public Collection<IndicatorType> getIndicatorTypesBetween( int first, int max )
     {
-        return i18n( i18nService, indicatorTypeStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, indicatorTypeStore, first, max );
     }
 
     public Collection<IndicatorType> getIndicatorTypesBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, indicatorTypeStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, indicatorTypeStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------
@@ -343,17 +343,17 @@
 
     public int getIndicatorGroupCountByName( String name )
     {
-        return indicatorGroupStore.getCountByName( name );
+        return getCountByName( i18nService, indicatorGroupStore, name );
     }
 
     public Collection<IndicatorGroup> getIndicatorGroupsBetween( int first, int max )
     {
-        return i18n( i18nService, indicatorGroupStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, indicatorGroupStore, first, max );
     }
 
     public Collection<IndicatorGroup> getIndicatorGroupsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, indicatorGroupStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, indicatorGroupStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------
@@ -452,23 +452,23 @@
         } );
     }
 
-    public int getIndicatorGroupSetCountByName( String name )
-    {
-        return indicatorGroupSetStore.getCountByName( name );
-    }
-
     public int getIndicatorGroupSetCount()
     {
         return indicatorGroupSetStore.getCount();
     }
 
+    public int getIndicatorGroupSetCountByName( String name )
+    {
+        return getCountByName( i18nService, indicatorGroupSetStore, name );
+    }
+
     public Collection<IndicatorGroupSet> getIndicatorGroupSetsBetween( int first, int max )
     {
-        return i18n( i18nService, indicatorGroupSetStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, indicatorGroupSetStore, first, max );
     }
 
     public Collection<IndicatorGroupSet> getIndicatorGroupSetsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, indicatorGroupSetStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, indicatorGroupSetStore, name, first, max );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2012-01-22 08:21:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2012-01-28 16:24:59 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import static org.hisp.dhis.i18n.I18nUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -128,16 +128,6 @@
         return i18n( i18nService, organisationUnitGroupStore.getOrganisationUnitGroupsWithGroupSets() );
     }
 
-    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max )
-    {
-        return i18n( i18nService, organisationUnitGroupStore.getBetween( first, max ) );
-    }
-
-    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max )
-    {
-        return i18n( i18nService, organisationUnitGroupStore.getBetweenByName( name, first, max ) );
-    }
-
     public int getOrganisationUnitGroupCount()
     {
         return organisationUnitGroupStore.getCount();
@@ -145,9 +135,19 @@
 
     public int getOrganisationUnitGroupCountByName( String name )
     {
-        return organisationUnitGroupStore.getCountByName( name );
+        return getCountByName( i18nService, organisationUnitGroupStore, name );
     }
     
+    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max )
+    {
+        return getObjectsBetween( i18nService, organisationUnitGroupStore, first, max );
+    }
+
+    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max )
+    {
+        return getObjectsBetweenByName( i18nService, organisationUnitGroupStore, name, first, max );
+    }
+
     // -------------------------------------------------------------------------
     // OrganisationUnitGroupSet
     // -------------------------------------------------------------------------
@@ -254,16 +254,6 @@
         return groupSets;
     }
     
-    public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetween( int first, int max )
-    {
-        return i18n( i18nService, organisationUnitGroupSetStore.getBetween( first, max ) );
-    }
-    
-    public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetweenByName( String name, int first, int max )
-    {
-        return i18n( i18nService, organisationUnitGroupSetStore.getBetweenByName( name, first, max ) );
-    }
-    
     public int getOrganisationUnitGroupSetCount()
     {
         return organisationUnitGroupSetStore.getCount();
@@ -271,6 +261,16 @@
     
     public int getOrganisationUnitGroupSetCountByName( String name )
     {
-        return organisationUnitGroupSetStore.getCountByName( name );
+        return getCountByName( i18nService, organisationUnitGroupSetStore, name );
+    }
+    
+    public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetween( int first, int max )
+    {
+        return getObjectsBetween( i18nService, organisationUnitGroupSetStore, first, max );
+    }
+    
+    public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetweenByName( String name, int first, int max )
+    {
+        return getObjectsBetweenByName( i18nService, organisationUnitGroupSetStore, name, first, max );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2012-01-22 08:38:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2012-01-28 16:24:59 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import static org.hisp.dhis.i18n.I18nUtils.*;
 import static org.hisp.dhis.system.util.MathUtils.expressionIsTrue;
 import static org.hisp.dhis.system.util.MathUtils.getRounded;
 
@@ -449,17 +449,17 @@
 
     public int getValidationRuleCountByName( String name )
     {
-        return validationRuleStore.getCountByName( name );
+        return getCountByName( i18nService, validationRuleStore, name );
     }
 
     public Collection<ValidationRule> getValidationRulesBetween( int first, int max )
     {
-        return i18n( i18nService, validationRuleStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, validationRuleStore, first, max );
     }
 
     public Collection<ValidationRule> getValidationRulesBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, validationRuleStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, validationRuleStore, name, first, max );
     }
 
     // -------------------------------------------------------------------------
@@ -508,16 +508,16 @@
 
     public int getValidationRuleGroupCountByName( String name )
     {
-        return validationRuleGroupStore.getCountByName( name );
+        return getCountByName( i18nService, validationRuleGroupStore, name );
     }
 
     public Collection<ValidationRuleGroup> getValidationRuleGroupsBetween( int first, int max )
     {
-        return i18n( i18nService, validationRuleGroupStore.getBetween( first, max ) );
+        return getObjectsBetween( i18nService, validationRuleGroupStore, first, max );
     }
 
     public Collection<ValidationRuleGroup> getValidationRuleGroupsBetweenByName( String name, int first, int max )
     {
-        return i18n( i18nService, validationRuleGroupStore.getBetweenByName( name, first, max ) );
+        return getObjectsBetweenByName( i18nService, validationRuleGroupStore, name, first, max );
     }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java	2012-01-26 11:40:29 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java	2012-01-28 16:24:59 +0000
@@ -168,39 +168,6 @@
     // Paging static utility methods
     // -------------------------------------------------------------------------
 
-    public static <T extends IdentifiableObject> List<T> getObjectsBetweenByName( Collection<T> objects, String name, int first, int max )
-    {
-        final List<T> list = new ArrayList<T>();
-        
-        if ( name != null )
-        {
-            for ( T object : objects )
-            {
-                if ( object != null && object.getName() != null && object.getName().toLowerCase().contains( name.toLowerCase() ) )
-                {
-                    list.add( object );
-                }
-            }
-        }
-        
-        Collections.sort( list, IdentifiableObjectNameComparator.INSTANCE );
-
-        int last = first + max;
-        
-        return list.subList( first, last );
-    }
-    
-    public static <T extends IdentifiableObject> List<T> getObjectsBetween( Collection<T> objects, int first, int max )
-    {
-        final List<T> list = new ArrayList<T>( objects );
-
-        Collections.sort( list, IdentifiableObjectNameComparator.INSTANCE );
-        
-        int last = first + max;
-        
-        return list.subList( first, last );
-    }
-    
     public static <T extends IdentifiableObject> int getCountByName( Collection<T> objects, String name )
     {
         int count = 0;
@@ -209,7 +176,7 @@
         {
             for ( IdentifiableObject object : objects )
             {
-                if ( object != null && object.getName() != null && object.getName().toLowerCase().contains( name.toLowerCase() ) )
+                if ( object != null && object.getDisplayName() != null && object.getDisplayName().toLowerCase().contains( name.toLowerCase() ) )
                 {
                     count++;
                 }
@@ -218,4 +185,41 @@
         
         return count;
     }
+    
+    public static <T extends IdentifiableObject> List<T> getObjectsBetween( Collection<T> objects, int first, int max )
+    {
+        final List<T> list = new ArrayList<T>( objects );
+
+        Collections.sort( list, IdentifiableObjectNameComparator.INSTANCE );
+        
+        int last = first + max;
+        
+        last = last < list.size() ? last : list.size();
+        
+        return list.subList( first, last );
+    }
+
+    public static <T extends IdentifiableObject> List<T> getObjectsBetweenByName( Collection<T> objects, String name, int first, int max )
+    {
+        final List<T> list = new ArrayList<T>();
+        
+        if ( name != null )
+        {
+            for ( T object : objects )
+            {
+                if ( object != null && object.getDisplayName() != null && object.getDisplayName().toLowerCase().contains( name.toLowerCase() ) )
+                {
+                    list.add( object );
+                }
+            }
+        }
+        
+        Collections.sort( list, IdentifiableObjectNameComparator.INSTANCE );
+
+        int last = first + max;
+
+        last = last < list.size() ? last : list.size();
+        
+        return list.subList( first, last );
+    }
 }

=== removed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/IdentifiableObjectUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/IdentifiableObjectUtils.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/IdentifiableObjectUtils.java	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-package org.hisp.dhis.system.util;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.hisp.dhis.common.IdentifiableObject;
-
-/*
- * @author mortenoh
- */
-public class IdentifiableObjectUtils
-{
-    public static <T extends IdentifiableObject> List<T> filterNameByKey( List<T> identifiableObjects, String key,
-        boolean ignoreCase )
-    {
-        List<T> objects = new ArrayList<T>();
-        ListIterator<T> iterator = identifiableObjects.listIterator();
-
-        if ( ignoreCase )
-        {
-            key = key.toLowerCase();
-        }
-
-        while ( iterator.hasNext() )
-        {
-            T object = iterator.next();
-            String name = ignoreCase ? object.getName().toLowerCase() : object.getName();
-
-            if ( name.indexOf( key ) != -1 )
-            {
-                objects.add( object );
-            }
-        }
-
-        return objects;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupSetsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupSetsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupSetsAction.java	2012-01-28 16:24:59 +0000
@@ -35,7 +35,7 @@
 import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author mortenoh

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementGroupsAction.java	2012-01-28 16:24:59 +0000
@@ -37,7 +37,7 @@
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.system.filter.DataElementGroupWithoutGroupSetFilter;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author Tran Thanh Tri

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java	2012-01-20 10:38:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java	2012-01-28 16:24:59 +0000
@@ -44,7 +44,7 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author Lars Helge Overland

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupSetsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupSetsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupSetsAction.java	2012-01-28 16:24:59 +0000
@@ -35,7 +35,7 @@
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author mortenoh

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorGroupsAction.java	2012-01-28 16:24:59 +0000
@@ -37,7 +37,7 @@
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.system.filter.IndicatorGroupWIthoutGroupSetFilter;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author mortenoh

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java	2012-01-20 10:38:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java	2012-01-28 16:24:59 +0000
@@ -38,7 +38,7 @@
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author Lars Helge Overland

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java	2012-01-28 16:24:59 +0000
@@ -35,7 +35,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author Jan Henrik Overland

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsAction.java	2012-01-28 16:24:59 +0000
@@ -37,7 +37,7 @@
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.system.filter.OrganisationUnitGroupWithoutGroupSetFilter;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 
 /**
  * @author Tran Thanh Tri

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserGroupsAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserGroupsAction.java	2012-01-28 16:24:59 +0000
@@ -32,7 +32,7 @@
 import java.util.List;
 
 import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.system.util.IdentifiableObjectUtils;
+import org.hisp.dhis.common.IdentifiableObjectUtils;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 import org.hisp.dhis.user.comparator.UserGroupComparator;