# com.bea.p13n.controls.profile
UserProfileControl Interface

public interface UserProfileControl
extends `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 deprecated as of Portal 8.1.x. It may only be used with the older UserManagerControl (which has also been deprecated).

As of 8.1 SP3, pleaseuse the UserProviderControl and GroupProviderControl in conjunction with ProfileControl and PropertyControl.

This control is backed by three EJBs, all of which must be deployed into this application. Those EJBs are:

- UserManager
- UserProfileManager
- RealmConfiguration

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

Related Topics

``SessionHelper``
``PropertyMapKey``
``EntityPropertyCache``
``ProfileWrapper``
``ProfileFactory``

All Superinterfaces
  `Control`, `Control`, `Serializable`

## Method Summary

`public `String`[]` | `getAllProfileNames`() Get a list of all the profile names in the database
`public `ProfileWrapper`` | `getProfile`(`String` username, `String` groupname) Create a ProfileWrapper for the given username and groupname.
`public `ProfileWrapper`` | `getProfileForGroup`(`String` groupname) Create a ProfileWrapper for the given username
`public `ProfileWrapper`` | `getProfileForUser`(`String` username) Create a ProfileWrapper for the given username, with no default explicit successor.
`public `ProfileWrapper`` | `getProfileFromRequest`(`HttpServletRequest` request) Get the existing ProfileWrapper from the request, or return null if none exists.
`public `EntityPropertyCache`` | `getProperties`(`ProfileWrapper` pw) Get all properties for this profile, and return as an EntityPropertyCache.
`public `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.
`public `EntityPropertyCache`` | `getPropertiesFromSet`(`ProfileWrapper` pw, `String` propertySetName)
`public `Object`` | `getProperty`(`ProfileWrapper` pw, `String` propertySet, `String` property) Get an individual property.
`public `List`` | `getUserNames`(`String` searchExpression, int limit) Get a list of all user names
`public void` | `setProperties`(`ProfileWrapper` pw, `EntityPropertyCache` cache) Set properties in this EntityPropertyCache back into the user's profile.
`public void` | `setProperty`(`ProfileWrapper` pw, `String` propertySet, `String` property, `Object` value) Set an individual property.
`public boolean` | `userExists`(`String` username) Determine whether a user exists
`public boolean` | `userProfileExists`(`String` username) Determine whether a user profile exists

## Method Detail

### getAllProfileNames() Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getUserProfileManager().getAllProfileNames() or Use ProfileControl.getGroupProfileManager().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

#### Exceptions

``P13nControlException``
  if a RemoteException occurs while invoking the UserProfileManager EJB methods or if user is not in the role of 'PortalSystemAdministrator' or 'Portal'

### getProfile(String, String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfile(username, groupname)

    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

#### Exceptions

``P13nControlException``
  if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

### getProfileForGroup(String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileForGroup(groupname)

    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

#### Exceptions

``P13nControlException``
  if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

### getProfileForUser(String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileForUser(username)

    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

#### Exceptions

``P13nControlException``
  if the given identity(ies) do not exist or if a remote exception is encountered while creating profile.

### getProfileFromRequest(HttpServletRequest) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileFromRequest(request)

    public ProfileWrapper getProfileFromRequest(HttpServletRequest request)
         throws P13nControlException

Get the existing ProfileWrapper from the request, or return null if none exists.

#### Parameters

request
  the request object

#### Returns

an initialized ProfileWrapper

#### Exceptions

``P13nControlException``
  if errors generated on the control side.

### getProperties(ProfileWrapper) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProperties(profileName)

    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

#### Exceptions

``P13nControlException``
  if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

### getPropertiesFromKeys(ProfileWrapper, Set) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileManager().getProperties(profileName, propertyMapKeys)

    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

propertyMapKeys
  Set of PropertyMapKeys for which all properties will be retrieved

#### Returns

an EntityPropertyCache of the retrieved properties

#### Exceptions

``P13nControlException``
  if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

### getPropertiesFromSet(ProfileWrapper, String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileManager().getProperties(profileName, propertySetName)

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

#### Exceptions

``P13nControlException``

### getProperty(ProfileWrapper, String, String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getProfileManager().getProperty(profileName, propertySet, property)

    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

propertySet
  name of the property set containing the property to retrieve

property
  name of the property to retrieve

#### Returns

an EntityPropertyCache of the retrieved properties

#### Exceptions

``P13nControlException``
  if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties

### getUserNames(String, int) Method

DEPRECATED as of Portal 8.1 Use UserProviderControl.getUserNames(searchExpression, limit)

    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

#### Exceptions

``P13nControlException``
  if a RemoteException occurs while invoking the UserManager EJB methods

### setProperties(ProfileWrapper, EntityPropertyCache) Method

DEPRECATED as of Portal 8.1 Use multiple invocations of ProfileControl.setProperty(profileName, propertySet, property, value)

    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

#### Exceptions

``P13nControlException``
  if profile not found, or if remote exceptions are encounterd while trying to set the properties

### setProperty(ProfileWrapper, String, String, Object) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.setProperty(profileName, propertySet, property, value)

    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

propertySet
  name of the property set containing the property to set

property
  name of the property to set

value
  value of the property to set

#### Exceptions

``P13nControlException``
  if profile not found, or if remote exceptions are encounterd while trying to set the property

### userExists(String) Method

DEPRECATED as of Portal 8.1 Use UserProviderControl.userExists(username)

    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

#### Exceptions

``P13nControlException``
  if a RemoteException occurs while invoking the UserManager EJB methods

### userProfileExists(String) Method

DEPRECATED as of Portal 8.1 Use ProfileControl.getUserProfileManager().profileExists(username)

    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

#### Exceptions

``P13nControlException``
  if a RemoteException occurs while invoking the UserProfileManager EJB methods