← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12875: PNG maps, fixed bug, user org unit not working

 

------------------------------------------------------------
revno: 12875
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-11-04 19:46:33 +0100
message:
  PNG maps, fixed bug, user org unit not working
modified:
  dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java
  dhis-2/dhis-services/dhis-service-mapgeneration/src/main/resources/META-INF/dhis/beans.xml


--
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-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2013-10-16 10:26:51 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2013-11-04 18:46:33 +0000
@@ -50,6 +50,8 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.filter.OrganisationUnitWithCoordinatesFilter;
 import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
 import org.springframework.util.Assert;
 
 /**
@@ -82,6 +84,13 @@
         this.analyticsService = analyticsService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
     // -------------------------------------------------------------------------
     // MapGenerationService implementation
     // -------------------------------------------------------------------------
@@ -114,9 +123,11 @@
         List<MapView> mapViews = new ArrayList<MapView>( map.getMapViews() );
         Collections.reverse( mapViews );
         
+        User user = currentUserService.getCurrentUser();
+        
         for ( MapView mapView : mapViews )
         {        
-            InternalMapLayer mapLayer = getSingleInternalMapLayer( mapView, date );
+            InternalMapLayer mapLayer = getSingleInternalMapLayer( mapView, user, date );
             
             if ( mapLayer != null )
             {
@@ -166,7 +177,7 @@
     private static final Integer DEFAULT_RADIUS_HIGH = 35;
     private static final Integer DEFAULT_RADIUS_LOW = 15;
 
-    private InternalMapLayer getSingleInternalMapLayer( MapView mapView, Date date )
+    private InternalMapLayer getSingleInternalMapLayer( MapView mapView, User user, Date date )
     {
         if ( mapView == null )
         {
@@ -188,7 +199,7 @@
 
         date = date != null ? date : new Date();
         
-        mapView.init( null, date, null, atLevels, inGroups, null );
+        mapView.init( user, date, null, atLevels, inGroups, null );
         
         List<OrganisationUnit> organisationUnits = mapView.getAllOrganisationUnits();
 

=== modified file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/resources/META-INF/dhis/beans.xml	2013-06-08 21:51:15 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/resources/META-INF/dhis/beans.xml	2013-11-04 18:46:33 +0000
@@ -8,6 +8,7 @@
   <bean id="org.hisp.dhis.mapgeneration.MapGenerationService" class="org.hisp.dhis.mapgeneration.GeoToolsMapGenerationService">
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     <property name="analyticsService" ref="org.hisp.dhis.analytics.AnalyticsService" />
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
 
 </beans>