← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3308: Minor fix

 

------------------------------------------------------------
revno: 3308
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-04-07 09:21:11 +0200
message:
  Minor fix
modified:
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.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-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java	2011-04-06 11:39:06 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java	2011-04-07 07:21:11 +0000
@@ -38,11 +38,11 @@
 {
     final String ID = UserSettingManager.class.getName();
 
-    static String KEY_CHARTS_IN_DASHBOARD = "keyChartsInDashboard";
-
-    static int DEFAULT_CHARTS_IN_DASHBOARD = 4;
-
-    static List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );
+    final String KEY_CHARTS_IN_DASHBOARD = "keyChartsInDashboard";
+
+    final int DEFAULT_CHARTS_IN_DASHBOARD = 4;
+
+    final List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );
 
     public Serializable getUserSetting( String key );
 

=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java	2011-04-06 11:39:06 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java	2011-04-07 07:21:11 +0000
@@ -30,6 +30,8 @@
 import java.io.Serializable;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.options.UserSettingManager;
 import org.hisp.dhis.user.NoCurrentUserException;
 import org.hisp.dhis.user.UserSettingService;
@@ -37,6 +39,8 @@
 public class DefaultUserSettingManager
     implements UserSettingManager
 {
+    private static final Log log = LogFactory.getLog( DefaultUserSettingManager.class );
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -60,6 +64,7 @@
         }
         catch ( NoCurrentUserException e )
         {
+            log.warn( "No current user, could not get user setting for key " + key );
         }
 
         return null;
@@ -73,6 +78,7 @@
         }
         catch ( NoCurrentUserException e )
         {
+            log.warn( "No current user, could not save user setting for key " + key );
         }
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-04-06 11:39:06 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-04-07 07:21:11 +0000
@@ -120,12 +120,8 @@
 
         Collections.sort( charts, new ChartTitleComparator() );
 
-        Object sessionChartsInDashboard = ActionContext.getContext().getActionInvocation().getStack()
-            .findString( UserSettingManager.KEY_CHARTS_IN_DASHBOARD );
-
-        Integer chartsInDashboardCount = sessionChartsInDashboard != null ? Integer
-            .valueOf( (String) sessionChartsInDashboard ) : UserSettingManager.DEFAULT_CHARTS_IN_DASHBOARD;
-
+        int chartsInDashboardCount = userSettingManager.getChartsInDashboard();
+        
         for ( int i = 1; i <= chartsInDashboardCount; i++ )
         {
             chartAreas.add( content.get( "chartArea" + i ) );