© 2003 BEA Systems, Inc.

com.bea.p13n.controls.profile
Interface UserProfileControl

All Superinterfaces:
com.bea.control.Control, weblogic.jws.control.Control, Serializable

public interface UserProfileControl
extends weblogic.jws.control.Control

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();
		 }
 }
 

Security requirements: The caller must be in the role of "PortalSystemAdministrator" to invoke method 'getAllUserNames()

See Also:
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

userExists

public boolean userExists(String username)
                   throws P13nControlException
Determine whether a user exists

Parameters:
username - The user (login) name of the user
Returns:
true if the user exists, false if cannot find user of this name
Throws:
P13nControlException - if a RemoteException occurs while invoking the UserManager EJB methods

userProfileExists

public boolean userProfileExists(String username)
                          throws P13nControlException
Determine whether a user profile exists

Parameters:
username - The user (login) name of the user
Returns:
true if the user profile exists for this user, false if not
Throws:
P13nControlException - if a RemoteException occurs while invoking the UserProfileManager EJB methods

getUserNames

public List getUserNames(String searchExpression,
                         int limit)
                  throws P13nControlException
Get a list of all user names

Parameters:
searchExpression - a wildcard search expression
limit - a limit of results to return
Returns:
a List of all user names matching the search expression
Throws:
P13nControlException - if a RemoteException occurs while invoking the UserManager EJB methods

getAllProfileNames

public String[] getAllProfileNames()
                            throws P13nControlException
Get a list of all the profile names in the database

Returns:
a String array of all user profile names
Throws:
P13nControlException - if a RemoteException occurs while invoking the UserProfileManager EJB methods or if user is not in the role of 'PortalSystemAdministrator' or 'Portal'

getProfileFromRequest

public ProfileWrapper getProfileFromRequest(HttpServletRequest request)
                                     throws P13nControlException
Get the existing ProfileWrapper from the request, or return null if none exists.

Returns:
an initialized ProfileWrapper
Throws:
P13nControlException - if errors generated on the control side.

getProfileForUser

public ProfileWrapper getProfileForUser(String username)
                                 throws P13nControlException
Create a ProfileWrapper for the given username, with no default explicit successor.

Parameters:
username - the username of the profile
Returns:
an initialized ProfileWrapper
Throws:
P13nControlException - if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

getProfileForGroup

public ProfileWrapper getProfileForGroup(String groupname)
                                  throws P13nControlException
Create a ProfileWrapper for the given username

Parameters:
groupname - the groupname of the profile
Returns:
an initialized ProfileWrapper
Throws:
P13nControlException - if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

getProfile

public ProfileWrapper getProfile(String username,
                                 String groupname)
                          throws P13nControlException
Create a ProfileWrapper for the given username and groupname. Access the user's profile and use the provided groupname as an explicit successor when calling the ProfileManager.

Parameters:
username - the username of the profile
groupname - the groupname of the profile
Returns:
an initialized ProfileWrapper
Throws:
P13nControlException - if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

getProperties

public EntityPropertyCache getProperties(ProfileWrapper pw)
                                  throws P13nControlException
Get all properties for this profile, and return as an EntityPropertyCache. Use this API when you have access to the HttpSession; eg, in Page Groups and JSP.

Parameters:
pw - The ProfileWrapper representing the user profile for which the properties are to be retrieved
Returns:
an EntityPropertyCache of the retrieved properties
Throws:
P13nControlException - if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

getPropertiesFromSet

public EntityPropertyCache getPropertiesFromSet(ProfileWrapper pw,
                                                String propertySetName)
                                         throws P13nControlException
P13nControlException

getPropertiesFromKeys

public EntityPropertyCache getPropertiesFromKeys(ProfileWrapper pw,
                                                 Set propertyMapKeys)
                                          throws P13nControlException
Get all properties that match the set of PropertyMapKeys for this profile A PropertyMapKey is a 'propertySet/propertyName' pair. Use this API when you have access to the HttpSession; eg, in Page Groups and JSP. String propertySet = "BogusProperties" String propertyName = "ColorPreference" PropertyMapKey pmk = new PropertyMapKeyImpl(propertySet, propertyName); Set set = new HashSet(); set.add(pmk);

Parameters:
pw - The ProfileWrapper representing the user profile for which the properties are to be retrieved
Returns:
an EntityPropertyCache of the retrieved properties
Throws:
P13nControlException - if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

getProperty

public Object getProperty(ProfileWrapper pw,
                          String propertySet,
                          String property)
                   throws P13nControlException
Get an individual property.

Parameters:
pw - The ProfileWrapper representing the user profile for which the properties are to be retrieved
Returns:
an EntityPropertyCache of the retrieved properties
Throws:
P13nControlException - if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

setProperties

public void setProperties(ProfileWrapper pw,
                          EntityPropertyCache cache)
                   throws P13nControlException
Set properties in this EntityPropertyCache back into the user's profile.

Parameters:
pw - The ProfileWrapper representing the user profile for which the properties are to be retrieved
cache - the cache containing the properties to set. See javadocs at the top of this class for more info on the EntityPropertyCache
Throws:
P13nControlException - if profile not found, or if remote exceptions are encounterd while trying to set the properties

setProperty

public void setProperty(ProfileWrapper pw,
                        String propertySet,
                        String property,
                        Object value)
                 throws P13nControlException
Set an individual property.

Parameters:
pw - The ProfileWrapper representing the user profile for which the properties are to be retrieved
Throws:
P13nControlException - if profile not found, or if remote exceptions are encounterd while trying to set the property

© 2003 BEA Systems, Inc.

Copyright © 2003 BEA Systems, Inc. All Rights Reserved