------------------------------------------------------------
revno: 1947
committer: Lars <larsh...@larshelg-laptop>
branch nick: trunk
timestamp: Fri 2010-08-20 10:03:31 +0200
message:
  Minor performance improvement
modified:
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.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/dataset/DefaultPivotDataSetAssociationTableService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.java	2010-08-20 07:54:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.java	2010-08-20 08:03:31 +0000
@@ -85,8 +85,6 @@
         List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService
             .getOrganisationUnitsAtLevel( level ) );
 
-        List<DataSet> dataSets = new ArrayList<DataSet>();
-
         List<AggregatedDataSetAssociation> associations = new ArrayList<AggregatedDataSetAssociation>();
 
         Map<Integer, Collection<DataSet>> dataSetMap = getDataSetMap( organisationUnits );
@@ -97,13 +95,14 @@
         if ( dataSetsByPeriodType.size() > 0 )
         {
             Collections.sort( dataSetsByPeriodType, new DataSetNameComparator() );
-            dataSets.addAll( dataSetsByPeriodType );
 
             for ( OrganisationUnit orgunit : organisationUnits )
             {
+                Collection<DataSet> dataSetCollection = dataSetMap.get( orgunit.getId() );
+                
                 for ( DataSet dataSet : dataSetsByPeriodType )
                 {
-                    boolean assigned = dataSetMap.get( orgunit.getId() ).contains( dataSet );
+                    boolean assigned = dataSetCollection.contains( dataSet );
 
                     AggregatedDataSetAssociation assoc = new AggregatedDataSetAssociation();
                     assoc.setOrganisationUnitId( orgunit.getId() );
@@ -118,7 +117,7 @@
 
         PivotDataSetAssociationTable table = new PivotDataSetAssociationTable();
         table.setOrganisationUnits( organisationUnits );
-        table.setDataSets( dataSets );
+        table.setDataSets( dataSetsByPeriodType );
         table.setAssociations( associations );
 
         return table;

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to