dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21287
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10028: [mobile] minor fix on uri mapping
------------------------------------------------------------
revno: 10028
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Thu 2013-03-07 14:59:41 +0700
message:
[mobile] minor fix on uri mapping
modified:
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.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-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2013-03-06 04:25:38 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2013-03-07 07:59:41 +0000
@@ -51,9 +51,33 @@
return orgUnits;
}
+ @RequestMapping( method = RequestMethod.GET, value = "/{version}" )
+ @ResponseBody
+ public OrgUnits getOrgUnitsForUser( HttpServletRequest request, @PathVariable String version )
+ throws NotAllowedException
+ {
+ User user = currentUserService.getCurrentUser();
+
+ if ( user == null )
+ {
+ throw NotAllowedException.NO_USER;
+ }
+
+ Collection<OrganisationUnit> units = user.getOrganisationUnits();
+
+ List<MobileOrgUnitLinks> unitList = new ArrayList<MobileOrgUnitLinks>();
+ for ( OrganisationUnit unit : units )
+ {
+ unitList.add( getOrgUnit( unit, request ) );
+ }
+ OrgUnits orgUnits = new OrgUnits( unitList );
+ orgUnits.setClientVersion( version );
+ return orgUnits;
+ }
+
@RequestMapping( method = RequestMethod.GET, value = "/{version}/" )
@ResponseBody
- public OrgUnits getOrgUnitsForUser( HttpServletRequest request, @PathVariable String version )
+ public OrgUnits getOrgUnitsForUserLWUIT( HttpServletRequest request, @PathVariable String version )
throws NotAllowedException
{
User user = currentUserService.getCurrentUser();