← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4778: Removed some dashboard-specific user setting methods

 

------------------------------------------------------------
revno: 4778
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-09-30 11:50:17 +0200
message:
  Removed some dashboard-specific user setting methods
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/UserSettingManager.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  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/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-api/src/main/java/org/hisp/dhis/options/UserSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/UserSettingManager.java	2011-09-30 08:52:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/UserSettingManager.java	2011-09-30 09:50:17 +0000
@@ -28,8 +28,6 @@
  */
 
 import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
 
 /**
  * @author mortenoh
@@ -38,18 +36,9 @@
 {
     final String ID = UserSettingManager.class.getName();
 
-    final String KEY_CHARTS_IN_DASHBOARD = "keyChartsInDashboard";
     final String KEY_CURRENT_DATADICTIONARY = "currentDataDictionary";
 
-    final int DEFAULT_CHARTS_IN_DASHBOARD = 4;
-
-    final List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );
-
     public Serializable getUserSetting( String key );
 
     public void saveUserSetting( String key, Serializable value );
-
-    public List<Integer> getChartsInDashboardOptions();
-
-    public Integer getChartsInDashboard();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2011-09-30 09:19:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2011-09-30 09:50:17 +0000
@@ -28,7 +28,9 @@
  */
 
 import java.io.Serializable;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * The main interface for working with user settings. Implementation need to get
@@ -42,6 +44,10 @@
     String ID = UserSettingService.class.getName();
 
     final String AUTO_SAVE_DATA_ENTRY_FORM = "autoSaveDataEntryForm";
+    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 static final String KEY_DASHBOARD_CHARTS_TO_DISPLAY = "keyDashboardChartsToDisplay";
 

=== 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-09-30 09:19:11 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java	2011-09-30 09:50:17 +0000
@@ -28,18 +28,13 @@
  */
 
 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.UserSettingService;
 
 public class DefaultUserSettingManager
     implements UserSettingManager
 {
-    private static final Log log = LogFactory.getLog( DefaultUserSettingManager.class );
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -64,19 +59,4 @@
     {
         userSettingService.saveUserSetting( key, value );
     }
-
-    // -------------------------------------------------------------------------
-    // Specific methods
-    // -------------------------------------------------------------------------
-
-    public List<Integer> getChartsInDashboardOptions()
-    {
-        return DASHBOARD_CHARTS_TO_DISPLAY;
-    }
-
-    public Integer getChartsInDashboard()
-    {
-        return (Integer) userSettingService.getUserSetting( UserSettingManager.KEY_CHARTS_IN_DASHBOARD,
-            UserSettingManager.DEFAULT_CHARTS_IN_DASHBOARD );
-    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	2011-04-06 11:39:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	2011-09-30 09:50:17 +0000
@@ -27,10 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.user.UserSettingService.DEFAULT_CHARTS_IN_DASHBOARD;
+import static org.hisp.dhis.user.UserSettingService.KEY_CHARTS_IN_DASHBOARD;
+
 import java.util.HashMap;
 import java.util.Map;
 
-import org.hisp.dhis.options.UserSettingManager;
+import org.hisp.dhis.user.UserSettingService;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.Interceptor;
@@ -45,19 +48,17 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserSettingManager userSettingManager;
+    private UserSettingService userSettingService;
 
-    public void setUserSettingManager( UserSettingManager userSettingManager )
+    public void setUserSettingService( UserSettingService userSettingService )
     {
-        this.userSettingManager = userSettingManager;
+        this.userSettingService = userSettingService;
     }
 
     // -------------------------------------------------------------------------
     // UserSettingInterceptor implementation
     // -------------------------------------------------------------------------
 
-    private static final long serialVersionUID = -3123337448714959530L;
-
     public void destroy()
     {
     }
@@ -71,7 +72,7 @@
     {
         Map<String, Object> map = new HashMap<String, Object>();
 
-        map.put( UserSettingManager.KEY_CHARTS_IN_DASHBOARD, userSettingManager.getChartsInDashboard() );
+        map.put( KEY_CHARTS_IN_DASHBOARD, userSettingService.getUserSetting( KEY_CHARTS_IN_DASHBOARD, DEFAULT_CHARTS_IN_DASHBOARD ) );
 
         invocation.getStack().push( map );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-09-22 09:21:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-09-30 09:50:17 +0000
@@ -601,7 +601,7 @@
   </bean>
 
   <bean id="org.hisp.dhis.interceptor.UserSettingInterceptor" class="org.hisp.dhis.interceptor.UserSettingInterceptor">
-    <property name="userSettingManager" ref="org.hisp.dhis.options.UserSettingManager" />
+    <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
   </bean>
 
   <bean id="org.hisp.dhis.useraccount.action.GetCurrentUserAction" class="org.hisp.dhis.useraccount.action.GetCurrentUserAction"

=== 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-08-04 10:06:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-09-30 09:50:17 +0000
@@ -27,6 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.user.UserSettingService.DEFAULT_CHARTS_IN_DASHBOARD;
+import static org.hisp.dhis.user.UserSettingService.KEY_CHARTS_IN_DASHBOARD;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -38,7 +41,7 @@
 import org.hisp.dhis.chart.comparator.ChartTitleComparator;
 import org.hisp.dhis.dashboard.DashboardManager;
 import org.hisp.dhis.message.MessageService;
-import org.hisp.dhis.options.UserSettingManager;
+import org.hisp.dhis.user.UserSettingService;
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
@@ -68,11 +71,11 @@
         this.chartService = chartService;
     }
 
-    private UserSettingManager userSettingManager;
+    private UserSettingService userSettingService;
 
-    public void setUserSettingManager( UserSettingManager userSettingManager )
+    public void setUserSettingService( UserSettingService userSettingService )
     {
-        this.userSettingManager = userSettingManager;
+        this.userSettingService = userSettingService;
     }
 
     private MessageService messageService;
@@ -130,7 +133,7 @@
 
         Collections.sort( charts, new ChartTitleComparator() );
 
-        int chartsInDashboardCount = userSettingManager.getChartsInDashboard();
+        int chartsInDashboardCount = (Integer) userSettingService.getUserSetting( KEY_CHARTS_IN_DASHBOARD, DEFAULT_CHARTS_IN_DASHBOARD );
 
         for ( int i = 1; i <= chartsInDashboardCount; i++ )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2011-09-30 09:50:17 +0000
@@ -8,7 +8,7 @@
   <bean id="org.hisp.dhis.dashboard.action.ProvideContentAction" class="org.hisp.dhis.dashboard.action.ProvideContentAction"
     scope="prototype">
     <property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager" />
-    <property name="userSettingManager" ref="org.hisp.dhis.options.UserSettingManager" />
+    <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
     <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
     <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
   </bean>