[Yanel-commits] rev 58508 - public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/yaneluser

michi at wyona.com michi at wyona.com
Fri May 27 15:30:44 CEST 2011


Author: michi
Date: 2011-05-27 15:30:43 +0200 (Fri, 27 May 2011)
New Revision: 58508

Modified:
   public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/yaneluser/EditYanelUserProfileResource.java
Log:
order changed

Modified: public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/yaneluser/EditYanelUserProfileResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/yaneluser/EditYanelUserProfileResource.java	2011-05-27 12:58:57 UTC (rev 58507)
+++ public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/yaneluser/EditYanelUserProfileResource.java	2011-05-27 13:30:43 UTC (rev 58508)
@@ -86,28 +86,33 @@
      * Get user id from resource configuration
      */
     private String getUserId() throws Exception {
-        String userId = null;
 
+        // 1)
         if (getEnvironment().getRequest().getParameter("id") != null) {
             return getEnvironment().getRequest().getParameter("id");
         }
 
-        final String userName = getPath().substring(getPath().lastIndexOf("/") + 1, getPath().lastIndexOf(".html"));
-        log.debug("User name: " + userName);
-        if (userName != null && getRealm().getIdentityManager().getUserManager().existsUser(userName)) {
-            return userName;
-        } else {
-            log.warn("No such user '" + userName + "', hence try to get user ID from resource configuration");
-        }
-
+        // 2)
         ResourceConfiguration resConfig = getConfiguration();
+        String userId = null;
         if(resConfig != null) {
             userId = getConfiguration().getProperty("user");
         } else {
             log.warn("DEPRECATED: Do not use RTI but rather a resource configuration");
             userId = getRTI().getProperty("user");
         }
-        return userId;
+        if (userId != null) {
+            return userId;
+        }
+
+        // 3)
+        final String userName = getPath().substring(getPath().lastIndexOf("/") + 1, getPath().lastIndexOf(".html"));
+        log.debug("User name: " + userName);
+        if (userName != null && getRealm().getIdentityManager().getUserManager().existsUser(userName)) {
+            return userName;
+        } else {
+            throw new Exception("No such user '" + userName + "'");
+        }
     }
 
     /**



More information about the Yanel-commits mailing list