← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 605: Implemented sorting in dhis-web-mapping. Went from throwing exceptions to logging errors in Mappi...

 

------------------------------------------------------------
revno: 605
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sun 2009-09-06 12:39:18 +0200
message:
  Implemented sorting in dhis-web-mapping. Went from throwing exceptions to logging errors in MappingService.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapNameComparator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapViewNameComparator.java
modified:
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorGroupsAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorsAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLayersAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapsAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorsByIndicatorGroupAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsAtLevelAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithCoordinatesAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithPolygonsAction.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.
=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java	2009-09-06 10:39:18 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.mapping.comparator;
+
+/*
+ * Copyright (c) 2004-2007, 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.Comparator;
+
+import org.hisp.dhis.mapping.MapLayer;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class MapLayerNameComparator
+    implements Comparator<MapLayer>
+{
+    public int compare( MapLayer mapLayer0, MapLayer mapLayer1 )
+    {
+        return mapLayer0.getName().compareTo( mapLayer1.getName() );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapNameComparator.java	2009-09-06 10:39:18 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.mapping.comparator;
+
+/*
+ * Copyright (c) 2004-2007, 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.Comparator;
+
+import org.hisp.dhis.mapping.Map;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class MapNameComparator
+    implements Comparator<Map>
+{
+    public int compare( Map map0, Map map1 )
+    {
+        return map0.getName().compareTo( map1.getName() );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapViewNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapViewNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapViewNameComparator.java	2009-09-06 10:39:18 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.mapping.comparator;
+
+/*
+ * Copyright (c) 2004-2007, 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.Comparator;
+
+import org.hisp.dhis.mapping.MapView;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class MapViewNameComparator
+    implements Comparator<MapView>
+{
+    public int compare( MapView mapView0, MapView mapView1 )
+    {
+        return mapView0.getName().compareTo( mapView1.getName() );
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-09-05 16:59:16 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-09-06 10:39:18 +0000
@@ -34,6 +34,8 @@
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -56,6 +58,8 @@
 public class DefaultMappingService
     implements MappingService
 {
+    private static final Log log = LogFactory.getLog( DefaultMappingService.class );
+    
     private static final String RELATION_SEPARATOR = ";;";
     private static final String PAIR_SEPARATOR = "::";
 
@@ -249,18 +253,22 @@
     {
         String[] rels = relations.split( RELATION_SEPARATOR );
         
-        for ( int i = 0; i < rels.length; i++ )
+        relationsLoop : for ( int i = 0; i < rels.length; i++ )
         {
             String[] rel = rels[i].split( PAIR_SEPARATOR );
 
             if ( rel.length != 2 )
             {
-                throw new IllegalArgumentException( "Pair '" + toString( rel ) + "' is invalid for input '" + rels[i] + "'" ); 
+                log.warn( "Pair '" + toString( rel ) + "' is invalid for input '" + rels[i] + "'" );
+                
+                continue relationsLoop;
             }
             
             if ( !isNumeric( rel[0]) )
             {
-                throw new IllegalArgumentException( "Organisation unit id '" + rel[0] + "' belonging to feature id '" + rel[1] + "' is not numeric" );                
+                log.warn( "Organisation unit id '" + rel[0] + "' belonging to feature id '" + rel[1] + "' is not numeric" );
+                
+                continue relationsLoop;
             }
             
             addOrUpdateMapOrganisationUnitRelation( mapLayerPath, Integer.parseInt( rel[0] ), rel[1] );

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorGroupsAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorGroupsAction.java	2009-09-06 10:39:18 +0000
@@ -28,10 +28,12 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -52,7 +54,7 @@
     {
         this.indicatorService = indicatorService;
     }
-
+    
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -62,7 +64,7 @@
     public List<IndicatorGroup> getObject()
     {
         return object;
-    }
+    }    
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -73,6 +75,8 @@
     {
         object = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() );
         
+        Collections.sort( object, new IndicatorGroupNameComparator() );
+        
         return SUCCESS;
     }    
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorsAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllIndicatorsAction.java	2009-09-06 10:39:18 +0000
@@ -28,13 +28,17 @@
  */
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -53,6 +57,20 @@
         this.indicatorService = indicatorService;
     }
 
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
+    private Comparator<Indicator> indicatorComparator;
+
+    public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
+    {
+        this.indicatorComparator = indicatorComparator;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -73,6 +91,10 @@
     {
         object = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
         
+        Collections.sort( object, indicatorComparator );
+        
+        displayPropertyHandler.handle( object );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLayersAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLayersAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLayersAction.java	2009-09-06 10:39:18 +0000
@@ -28,10 +28,12 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.mapping.MapLayer;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.mapping.comparator.MapLayerNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -72,6 +74,8 @@
     {
         object = new ArrayList<MapLayer>( mappingService.getAllMapLayers() );
         
+        Collections.sort( object, new MapLayerNameComparator() );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapViewsAction.java	2009-09-06 10:39:18 +0000
@@ -32,9 +32,12 @@
 
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.mapping.comparator.MapViewNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -72,6 +75,8 @@
     {
         object = new ArrayList<MapView>( mappingService.getAllMapViews() );
         
+        Collections.sort( object, new MapViewNameComparator() );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapsAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapsAction.java	2009-09-06 10:39:18 +0000
@@ -28,10 +28,12 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.mapping.Map;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.mapping.comparator.MapNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -73,6 +75,8 @@
     {
         object = new ArrayList<Map>( mappingService.getAllUserMaps() );
         
+        Collections.sort( object, new MapNameComparator() );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorsByIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorsByIndicatorGroupAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorsByIndicatorGroupAction.java	2009-09-06 10:39:18 +0000
@@ -28,14 +28,18 @@
  */
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -54,6 +58,20 @@
         this.indicatorService = indicatorService;
     }
 
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
+    private Comparator<Indicator> indicatorComparator;
+
+    public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
+    {
+        this.indicatorComparator = indicatorComparator;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -88,6 +106,10 @@
         if ( group != null )
         {
             object = new ArrayList<Indicator>( group.getMembers() );
+
+            Collections.sort( object, indicatorComparator );
+            
+            displayPropertyHandler.handle( object );
         }
         
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java	2009-08-31 15:37:16 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java	2009-09-06 10:39:18 +0000
@@ -27,13 +27,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.hisp.dhis.mapping.Map;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.mapping.comparator.MapNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -67,9 +72,9 @@
     // Output
     // -------------------------------------------------------------------------
 
-    private Collection<Map> object;
+    private List<Map> object;
 
-    public Collection<Map> getObject()
+    public List<Map> getObject()
     {
         return object;
     }
@@ -81,7 +86,9 @@
     public String execute()
         throws Exception
     {
-        object = mappingService.getMapsByType( type );
+        object = new ArrayList<Map>( mappingService.getMapsByType( type ) );
+        
+        Collections.sort( object, new MapNameComparator() );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsAtLevelAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsAtLevelAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsAtLevelAction.java	2009-09-06 10:39:18 +0000
@@ -28,13 +28,17 @@
  */
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -52,6 +56,20 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
+    
+    private Comparator<OrganisationUnit> organisationUnitComparator;
+
+    public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
+    {
+        this.organisationUnitComparator = organisationUnitComparator;
+    }
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
 
     // -------------------------------------------------------------------------
     // Input
@@ -84,6 +102,10 @@
     {
         object = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( level ) );
         
+        Collections.sort( object, organisationUnitComparator );
+        
+        displayPropertyHandler.handle( object );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithCoordinatesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithCoordinatesAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithCoordinatesAction.java	2009-09-06 10:39:18 +0000
@@ -28,15 +28,19 @@
  */
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -55,6 +59,20 @@
         this.organisationUnitService = organisationUnitService;
     }
 
+    private Comparator<OrganisationUnit> organisationUnitComparator;
+
+    public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
+    {
+        this.organisationUnitComparator = organisationUnitComparator;
+    }
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -93,6 +111,10 @@
                     return ((OrganisationUnit) object).hasCoordinates();
                 }
             } );
+
+        Collections.sort( object, organisationUnitComparator );
+        
+        displayPropertyHandler.handle( object );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithPolygonsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithPolygonsAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitsWithPolygonsAction.java	2009-09-06 10:39:18 +0000
@@ -28,15 +28,19 @@
  */
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -55,6 +59,20 @@
         this.organisationUnitService = organisationUnitService;
     }
 
+    private Comparator<OrganisationUnit> organisationUnitComparator;
+
+    public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
+    {
+        this.organisationUnitComparator = organisationUnitComparator;
+    }
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -93,6 +111,10 @@
                     return ((OrganisationUnit) object).hasPolygonCoordinates();
                 }
             } );
+
+        Collections.sort( object, organisationUnitComparator );
+        
+        displayPropertyHandler.handle( object );
         
         return SUCCESS;
     }