← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6049: DV: retaining order of organisation units in favorites

 

------------------------------------------------------------
revno: 6049
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-20 11:36:16 +0100
message:
  DV: retaining order of organisation units in favorites
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.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-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-02-10 14:53:26 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-02-20 10:36:16 +0000
@@ -28,14 +28,12 @@
  */
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.chart.ChartService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.user.CurrentUserService;
@@ -203,9 +201,9 @@
         this.last5Years = last5Years;
     }
 
-    private Collection<Integer> organisationUnitIds;
+    private List<Integer> organisationUnitIds;
 
-    public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
+    public void setOrganisationUnitIds( List<Integer> organisationUnitIds )
     {
         this.organisationUnitIds = organisationUnitIds;
     }
@@ -354,8 +352,12 @@
 
         if ( organisationUnitIds != null )
         {
-            chart.setOrganisationUnits( new ArrayList<OrganisationUnit>( organisationUnitService
-                .getOrganisationUnits( organisationUnitIds ) ) );
+            chart.getOrganisationUnits().clear();
+            
+            for ( Integer id : organisationUnitIds )
+            {
+                chart.getOrganisationUnits().add( organisationUnitService.getOrganisationUnit( id ) );
+            }
         }
 
         if ( system == null )