dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14182
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4709: (mobile) only display orgunits that are directly connected to a user
------------------------------------------------------------
revno: 4709
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 12:32:15 +0200
message:
(mobile) only display orgunits that are directly connected to a user
modified:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetOrganisationUnitsAction.java
dhis-2/dhis-web/dhis-web-light/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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetOrganisationUnitsAction.java 2011-09-27 07:39:54 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetOrganisationUnitsAction.java 2011-09-27 10:32:15 +0000
@@ -28,10 +28,11 @@
package org.hisp.dhis.light.action;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
@@ -54,13 +55,6 @@
this.currentUserService = currentUserService;
}
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -80,21 +74,13 @@
public String execute()
{
User user = currentUserService.getCurrentUser();
-
+
if ( user != null )
{
- List<OrganisationUnit> userOrganisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
-
- for ( OrganisationUnit unit : userOrganisationUnits )
- {
- organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( unit.getId() ) );
- }
-
- // Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
-
- organisationUnits = organisationUnits.subList( 0, 50 );
+ organisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+ Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
}
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-09-27 07:32:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-09-27 10:32:15 +0000
@@ -7,7 +7,6 @@
<bean id="org.hisp.dhis.light.action.GetOrganisationUnitsAction" class="org.hisp.dhis.light.action.GetOrganisationUnitsAction">
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<bean id="org.hisp.dhis.light.action.GetDataSetsAction" class="org.hisp.dhis.light.action.GetDataSetsAction">