|
© 2001 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.user.UserHelper
Helper class to retrieve lightweight user profile objects outside of a JSP/Servlet context.
Inner Class Summary | |
static class |
UserHelper.ConfigurableEntityProfileWrapper
A ProfileWrapper for a ConfigurableEntity. |
Constructor Summary | |
UserHelper()
|
Method Summary | |
protected static ConfigurableEntity |
getEntity(java.lang.String key,
java.lang.String typeName)
Go through the DirectPropertyManager to get the entity specified by the given key and typeName |
static ProfileWrapper |
getProfile(java.lang.String profileKey)
Retrieve a profile based on the key. |
static ProfileWrapper |
getProfile(java.lang.String profileKey,
java.lang.String profileType)
Retrieve a profile based on the key and type. |
static java.lang.String |
getUserId(javax.servlet.http.HttpServletRequest req)
Get the logged in user's id from the request. |
static ProfileWrapper |
getUserProfileWrapper(javax.servlet.http.HttpServletRequest req)
Get a user profile wrapper from the given request. |
static ProfileWrapper |
getUserProfileWrapper(java.lang.String userId)
Get a user profile wrapper for the given user id. |
static ProfileWrapper |
getUserProfileWrapper(java.lang.String userId,
javax.servlet.http.HttpServletRequest req)
Get a user profile wrapper for the given user id from the given request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UserHelper()
Method Detail |
public static java.lang.String getUserId(javax.servlet.http.HttpServletRequest req)
This checks for the user principal on the request.
req
- the servlet request.public static ProfileWrapper getProfile(java.lang.String profileKey) throws UserManagementException
profileKey
- the user idUserManagementException
- if an error occurs retrieving the profilepublic static ProfileWrapper getProfile(java.lang.String profileKey, java.lang.String profileType) throws UserManagementException
profileKey
- the user idprofileType
- the user's profile typeUserManagementException
- if an error occurs retrieving the profileprotected static ConfigurableEntity getEntity(java.lang.String key, java.lang.String typeName) throws java.rmi.RemoteException, javax.ejb.CreateException, ToolkitException
key
- the profile keytypeName
- the profile typejava.rmi.RemoteException
- if an RMI error occursCreateException
- if the DirectPropertyManager cannot be createdToolkitException
- if the DirectPropertyManagerHome cannot be found in the JNDI treepublic static ProfileWrapper getUserProfileWrapper(java.lang.String userId, javax.servlet.http.HttpServletRequest req) throws UserManagementException
This will first try the profile in the request/session. If that exists and is keyed to the specified user, then it will be used. Otherwise, a profile will be retrieved for the user.
userId
- the user id.req
- the servlet request.UserManagementException
- thrown on an error getting the user.public static ProfileWrapper getUserProfileWrapper(java.lang.String userId) throws UserManagementException
This will not use the cached version of the profile, and therefore, probably won't have a successor.
userId
- the user id.UserManagementException
- thrown on an error getting the user.public static ProfileWrapper getUserProfileWrapper(javax.servlet.http.HttpServletRequest req)
This will attempt to retrieve the cached profile. Generally, the <um:getProfile> tag will populate the cached profile.
If the cached profile is not available from the request, this will use the request.getRemoteUser() method to determine the remote username, and create a lightweight profile from that username.
req
- the servlet request.
|
© 2001 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |