← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 14692
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-05 22:24:59 +0200
message:
  Minor
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.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-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java	2014-04-05 20:08:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java	2014-04-05 20:24:59 +0000
@@ -204,20 +204,6 @@
         setSelectedOrganisationUnits( set );
     }
 
-    //TODO remove?
-    public boolean setCurrentUserOrganisationUnitAsSelected()
-    {
-        User user = currentUserService.getCurrentUser();
-
-        if ( user != null && user.getOrganisationUnit() != null )
-        {
-            setSelectedOrganisationUnit( user.getOrganisationUnit() );
-            return true;
-        }
-
-        return false;
-    }
-
     // -------------------------------------------------------------------------
     // Session methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java	2014-04-05 20:08:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java	2014-04-05 20:24:59 +0000
@@ -150,14 +150,4 @@
      *             if the argument is null
      */
     void setSelectedOrganisationUnit( OrganisationUnit unit );
-    
-    /**
-     * Sets the current user's organisation unit as selected. If the user is
-     * associated with more than one organisation unit, it is undefined which one
-     * is selected.
-     * 
-     * @return true if the operation was successful, ie. if a current users exists
-     * and if the current user is associated with one or more organisation units.
-     */
-    boolean setCurrentUserOrganisationUnitAsSelected();
 }

=== 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	2014-03-24 21:39:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2014-04-05 20:24:59 +0000
@@ -191,7 +191,6 @@
 
   <bean id="org.hisp.dhis.oust.manager.SelectionTreeManager" class="org.hisp.dhis.oust.manager.DefaultSelectionTreeManager">
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
 
   <bean id="org.hisp.dhis.oust.action.ExpandSubtreeAction" class="org.hisp.dhis.oust.action.ExpandSubtreeAction"

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java	2014-04-05 20:24:59 +0000
@@ -41,6 +41,9 @@
 import org.hisp.dhis.reporttable.ReportTableService;
 import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
 import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
@@ -68,6 +71,9 @@
         this.selectionTreeManager = selectionTreeManager;
     }
 
+    @Autowired
+    private CurrentUserService currentUserService;
+    
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -115,7 +121,9 @@
 
     public String execute()
     {
-        selectionTreeManager.setCurrentUserOrganisationUnitAsSelected();
+        User user = currentUserService.getCurrentUser();
+        
+        selectionTreeManager.setSelectedOrganisationUnit( user.getOrganisationUnit() );
         
         if ( uid != null )
         {