← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12110: minor bugfix for assignedPrograms

 

------------------------------------------------------------
revno: 12110
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-17 11:24:47 +0200
message:
  minor bugfix for assignedPrograms
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.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/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-09-05 13:22:42 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-09-17 09:24:47 +0000
@@ -70,7 +70,6 @@
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -81,7 +80,7 @@
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping(value = CurrentUserController.RESOURCE_PATH, method = RequestMethod.GET)
+@RequestMapping(value = { CurrentUserController.RESOURCE_PATH, "/me" }, method = RequestMethod.GET)
 public class CurrentUserController
 {
     public static final String RESOURCE_PATH = "/currentUser";
@@ -371,14 +370,12 @@
                         organisationUnits.add( organisationUnit );
                         programs.add( program );
 
-                        if ( programAssociations.get( organisationUnit.getUid() ) != null )
-                        {
-                            programAssociations.get( organisationUnit.getUid() ).add( program );
-                        }
-                        else
-                        {
-                            programAssociations.put( organisationUnit.getUid(), Arrays.asList( program ) );
-                        }
+                        if ( programAssociations.get( organisationUnit.getUid() ) == null )
+                        {
+                            programAssociations.put( organisationUnit.getUid(), new ArrayList<Program>() );
+                        }
+
+                        programAssociations.get( organisationUnit.getUid() ).add( program );
                     }
                 }
             }
@@ -420,8 +417,8 @@
         JacksonUtils.toJson( response.getOutputStream(), forms );
     }
 
-    @SuppressWarnings( "unchecked" )
-    @RequestMapping( value = "/assignedDataSets", produces = { "application/json", "text/*" } )
+    @SuppressWarnings("unchecked")
+    @RequestMapping(value = "/assignedDataSets", produces = { "application/json", "text/*" })
     public void getDataSets( HttpServletResponse response, @RequestParam Map<String, String> parameters ) throws IOException, NotAuthenticatedException
     {
         User currentUser = currentUserService.getCurrentUser();