← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11632: Data element aggregation levels UI, fixed elusive bug, removeAll did not work well since hibernat...

 

------------------------------------------------------------
revno: 11632
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-08-12 11:41:06 +0200
message:
  Data element aggregation levels UI, fixed elusive bug, removeAll did not work well since hibernate proxies messed up equals comparison
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.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-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2013-07-12 09:33:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2013-08-12 09:41:06 +0000
@@ -220,23 +220,22 @@
 
         dataElementGroups = dataElementService.getAllDataElementGroups();
 
+        Map<Integer, OrganisationUnitLevel> levelMap = organisationUnitService.getOrganisationUnitLevelMap();
+
         if ( id != null )
         {
             dataElement = dataElementService.getDataElement( id );
 
-            Map<Integer, OrganisationUnitLevel> levelMap = organisationUnitService.getOrganisationUnitLevelMap();
-
             for ( Integer level : dataElement.getAggregationLevels() )
             {
                 aggregationLevels.add( levelMap.get( level ) );
+                levelMap.remove( level );
             }
 
             attributeValues = AttributeUtils.getAttributeValueMap( dataElement.getAttributeValues() );
         }
 
-        organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
-
-        organisationUnitLevels.removeAll( aggregationLevels );
+        organisationUnitLevels = new ArrayList<OrganisationUnitLevel>( levelMap.values() );
 
         groupSets = new ArrayList<DataElementGroupSet>( dataElementService
             .getCompulsoryDataElementGroupSetsWithMembers() );