=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-05-05 21:14:56 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-09-15 03:25:07 +0000 @@ -29,15 +29,19 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; import org.hisp.dhis.common.AbstractIdentifiableObject; +import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator; /** * @author Kristian Nordal - * @version $Id: OrganisationUnitGroupSet.java 1905 2006-09-23 14:34:55Z torgeilo $ + * @version $Id: OrganisationUnitGroupSet.java 1905 2006-09-23 14:34:55Z + * torgeilo $ */ public class OrganisationUnitGroupSet extends AbstractIdentifiableObject @@ -47,10 +51,12 @@ */ private static final long serialVersionUID = -221220579471558683L; + private static final Comparator COMPARATOR = new OrganisationUnitGroupNameComparator(); + + private Set organisationUnitGroups = new HashSet(); + private String description; - private Set organisationUnitGroups = new HashSet(); - private boolean compulsory; // ------------------------------------------------------------------------- @@ -67,7 +73,7 @@ this.description = description; this.compulsory = compulsory; } - + // ------------------------------------------------------------------------- // Logic // ------------------------------------------------------------------------- @@ -75,15 +81,15 @@ public Collection getOrganisationUnits() { List units = new ArrayList(); - + for ( OrganisationUnitGroup group : organisationUnitGroups ) { units.addAll( group.getMembers() ); } - + return units; } - + public boolean isMemberOfOrganisationUnitGroups( OrganisationUnit organisationUnit ) { for ( OrganisationUnitGroup group : organisationUnitGroups ) @@ -93,7 +99,7 @@ return true; } } - + return false; } @@ -111,10 +117,19 @@ return group; } } - + return null; } - + + public List getSortedGroups() + { + List sortedGroups = new ArrayList( organisationUnitGroups ); + + Collections.sort( sortedGroups, COMPARATOR ); + + return sortedGroups; + } + // ------------------------------------------------------------------------- // hashCode and equals // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2011-08-18 15:12:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2011-09-15 03:25:07 +0000 @@ -110,7 +110,7 @@ === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2011-08-18 15:12:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2011-09-15 03:25:07 +0000 @@ -150,7 +150,7 @@