|
© 2003 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Control to access and modify the user profile. The methods all use the ProfileWrapper as the object for which the profile will be associated.
This control is backed by three EJBs, all of which must be deployed into this application. Those EJBs are:
Using ProfileWrapper, as opposed to the user name, allows the default properties to be retrieved, if they are set. The ProfileWrapper is available in every Session, regardless of wheter the user is registered. In addition to the username, it also provides APIs for determining the user type (eg, registered, anonymous, or tracked).
Support to retrieve profile information is provided in the event that the HttpSession cannot be obtained. For example, JWS currently provides no means to get the HttpSession object. In this case, you may create the ProfileWrapper by using the ProfileFactory.
Using EntityPropertyCache as the container for the returned properties, as opposed to a Map, makes it clear to the user how the properties should be extracted from the cache. The EntityPropertyCache stores properties as a HashMap of PropertySetKey/propertyValue, where PropertySetKey is the propertySet/propertyName pair.
You may get the backing HashMap of the EntityPropertyCache by calling its getMap() method, then step through it as follows:
if ( ! cache.isEmpty()) { Iterator = cache.getMap().entrySet().iterator(); while ( iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); PropertyMapKey pmKey = (PropertyMapKey)entry.getKey(); String propertySetName = pmKey.getPropertySetName(); String propertyName = pmKey.getPropertyName(); Object value = entry.getValue(); } }
SessionHelper
,
PropertyMapKey
,
EntityPropertyCache
,
ProfileWrapper
,
ProfileFactory
Method Summary | |
String[] |
getAllProfileNames()
Get a list of all the profile names in the database |
ProfileWrapper |
getProfile(String username,
String groupname)
Create a ProfileWrapper for the given username and groupname. |
ProfileWrapper |
getProfileForGroup(String groupname)
Create a ProfileWrapper for the given username |
ProfileWrapper |
getProfileForUser(String username)
Create a ProfileWrapper for the given username, with no default explicit successor. |
ProfileWrapper |
getProfileFromRequest(HttpServletRequest request)
Get the existing ProfileWrapper from the request, or return null if none exists. |
EntityPropertyCache |
getProperties(ProfileWrapper pw)
Get all properties for this profile, and return as an EntityPropertyCache. |
EntityPropertyCache |
getPropertiesFromKeys(ProfileWrapper pw,
Set propertyMapKeys)
Get all properties that match the set of PropertyMapKeys for this profile A PropertyMapKey is a 'propertySet/propertyName' pair. |
EntityPropertyCache |
getPropertiesFromSet(ProfileWrapper pw,
String propertySetName)
|
Object |
getProperty(ProfileWrapper pw,
String propertySet,
String property)
Get an individual property. |
List |
getUserNames(String searchExpression,
int limit)
Get a list of all user names |
void |
setProperties(ProfileWrapper pw,
EntityPropertyCache cache)
Set properties in this EntityPropertyCache back into the user's profile. |
void |
setProperty(ProfileWrapper pw,
String propertySet,
String property,
Object value)
Set an individual property. |
boolean |
userExists(String username)
Determine whether a user exists |
boolean |
userProfileExists(String username)
Determine whether a user profile exists |
Method Detail |
public boolean userExists(String username) throws P13nControlException
username
- The user (login) name of the user
P13nControlException
- if a RemoteException occurs while invoking the
UserManager EJB methodspublic boolean userProfileExists(String username) throws P13nControlException
username
- The user (login) name of the user
P13nControlException
- if a RemoteException occurs while invoking the
UserProfileManager EJB methodspublic List getUserNames(String searchExpression, int limit) throws P13nControlException
searchExpression
- a wildcard search expressionlimit
- a limit of results to return
P13nControlException
- if a RemoteException occurs while invoking the
UserManager EJB methodspublic String[] getAllProfileNames() throws P13nControlException
P13nControlException
- if a RemoteException occurs while invoking the
UserProfileManager EJB methods or if user is not in the role of
'PortalSystemAdministrator' or 'Portal' public ProfileWrapper getProfileFromRequest(HttpServletRequest request) throws P13nControlException
P13nControlException
- if errors generated on the control side.public ProfileWrapper getProfileForUser(String username) throws P13nControlException
username
- the username of the profile
P13nControlException
- if the given identity(ies) do not exist
or if a remote exception is encountered while creating profile.public ProfileWrapper getProfileForGroup(String groupname) throws P13nControlException
groupname
- the groupname of the profile
P13nControlException
- if the given identity(ies) do not exist
or if a remote exception is encountered while creating profile.public ProfileWrapper getProfile(String username, String groupname) throws P13nControlException
username
- the username of the profilegroupname
- the groupname of the profile
P13nControlException
- if the given identity(ies) do not exist
or if a remote exception is encountered while creating profile.public EntityPropertyCache getProperties(ProfileWrapper pw) throws P13nControlException
pw
- The ProfileWrapper representing the user profile for which the
properties are to be retrieved
P13nControlException
- if profile not found, or if remote exceptions
are encounterd while trying to retrieve the propertiespublic EntityPropertyCache getPropertiesFromSet(ProfileWrapper pw, String propertySetName) throws P13nControlException
P13nControlException
public EntityPropertyCache getPropertiesFromKeys(ProfileWrapper pw, Set propertyMapKeys) throws P13nControlException
String propertySet = "BogusProperties"
String propertyName = "ColorPreference"
PropertyMapKey pmk = new PropertyMapKeyImpl(propertySet, propertyName);
Set set = new HashSet();
set.add(pmk);
pw
- The ProfileWrapper representing the user profile for which the
properties are to be retrieved
P13nControlException
- if profile not found, or if remote exceptions
are encounterd while trying to retrieve the propertiespublic Object getProperty(ProfileWrapper pw, String propertySet, String property) throws P13nControlException
pw
- The ProfileWrapper representing the user profile for which the
properties are to be retrieved
P13nControlException
- if profile not found, or if remote exceptions
are encounterd while trying to retrieve the propertiespublic void setProperties(ProfileWrapper pw, EntityPropertyCache cache) throws P13nControlException
pw
- The ProfileWrapper representing the user profile for which the
properties are to be retrievedcache
- the cache containing the properties to set. See javadocs at the
top of this class for more info on the EntityPropertyCache
P13nControlException
- if profile not found, or if remote exceptions
are encounterd while trying to set the propertiespublic void setProperty(ProfileWrapper pw, String propertySet, String property, Object value) throws P13nControlException
pw
- The ProfileWrapper representing the user profile for which the
properties are to be retrieved
P13nControlException
- if profile not found, or if remote exceptions
are encounterd while trying to set the property
|
© 2003 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |