# com.bea.p13n.usermgmt.profile
ProfileWrapper Interface

public interface ProfileWrapper
extends `Serializable`

ProfileWrapper is a lightweight object that can be used to access a user or group profile. To retrieve a ProfileWrapper, use the ProfileFactory. Once a ProfileWrapper is retrieved, it knows how to access the correct ProfileManager session bean(s) based on the identity it was initialized with. If it was initialized with both a user and group name, the group will be used as an explicit successor for all getProperty methods that do not take an explicit successor. If an explicit successor is provided to the getProperty methods, that one will override the group that this object was initialized with. When specifying a successor for user and group profiles, it will always be the name of the group; because users and groups always use groups as their successors.

Related Topics

``ProfileFactory``

All Superinterfaces
  `Serializable`

All Known Subinterfaces
  `AnonymousProfileWrapper`, `PhantomProfileWrapper`,

## Method Summary

`public `ProfileIdentity`` | `getProfileIdentity`() Get the current identity of this profile
`public `EntityPropertyCache`` | `getProperties`()
`public `EntityPropertyCache`` | `getProperties`(`String` propertySetName)
`public `EntityPropertyCache`` | `getProperties`(`Set` propertyMapKeys)
`public `Object`` | `getProperty`(`String` propertySet, `String` propertyName) Get a property from the profile.
`public `Object`` | `getProperty`(`String` propertySet, `String` propertyName, `String` successor) Get a property from the profile.
`public `String`` | `getPropertyAsString`(`String` propertySet, `String` propertyName) Get a property from the profile, converted to a String If the property is not found, the default value from the property set will be returned.
`public `String`` | `getPropertyAsString`(`String` propertySet, `String` propertyName, `String` successor) Get a property from the profile.
`public `String`` | `getSuccessor`(`String` propertySet) Retrieve the successor for the specified property set.
`public `ProfileType`` | `getType`() Get profile type.
`public `String`` | `getUsername`() Get the current username of this profile
`public boolean` | `isType`(`ProfileType` type) Compare this profile type with another.
`public `Object`` | `removeProperty`(`String` propertySet, `String` propertyName) Remove a property from the profile
`public void` | `removeSuccessor`(`String` propertySet) Remove the successor for the specified property set.
`public void` | `setProperties`(`EntityPropertyCache` cache) Set properties in the profile, taken from the input cache.
`public void` | `setProperty`(`String` propertySet, `String` propertyName, `Object` value) Set a property in the profile
`public void` | `setSuccessor`(`String` propertySet, `String` successor) Set the successor for the specified property set
`public void` | `validateProfile`() Ensure that the profile represented by this object is valid

## Method Detail

### getProfileIdentity() Method

    public ProfileIdentity getProfileIdentity()

Get the current identity of this profile

### getProperties() Method

    public EntityPropertyCache getProperties()
         throws RemoteException, ProfileNotFoundException

#### Returns

a cache of all the properties for this profile, or null if none found. The EntityPropertyCache consists of a 'PropertyMapKey/ property value' pair, where the PropertyMapKey is a simple object of the property set name and property name.

#### Exceptions

``RemoteException``
``ProfileNotFoundException``

Related Topics

``EntityPropertyCache``
``PropertyMapKey``

### getProperties(String) Method

    public EntityPropertyCache getProperties(String propertySetName)
         throws RemoteException, ProfileNotFoundException

#### Returns

a cache of all properties in the named property set for this profile, or null if none found. The EntityPropertyCache consists of a 'PropertyMapKey/ property value' pair, where the PropertyMapKey is a simple object of the property set name and property name.

#### Exceptions

``RemoteException``
``ProfileNotFoundException``

Related Topics

``EntityPropertyCache``
``PropertyMapKey``

### getProperties(Set) Method

    public EntityPropertyCache getProperties(Set propertyMapKeys)
         throws RemoteException, ProfileNotFoundException

#### Returns

a cache of all properties for the set of PropertyMapKeys for this profile, or null if none found. The EntityPropertyCache consists of a 'PropertyMapKey/ property value' pair, where the PropertyMapKey is a simple object of the property set name and property name.

#### Exceptions

``RemoteException``
``ProfileNotFoundException``

Related Topics

``EntityPropertyCache``
``PropertyMapKey``

### getProperty(String, String) Method

    public Object getProperty(String propertySet,
                              String propertyName)
         throws RemoteException, ProfileNotFoundException

Get a property from the profile. If the property is still not found, the default value from the property set will be returned.

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

#### Returns

the property's value

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

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

    public Object getProperty(String propertySet,
                              String propertyName,
                              String successor)
         throws RemoteException, ProfileNotFoundException

Get a property from the profile. If a successor is provided, it will be used instead of the profile's groupname. If the property is not found, the default value from the property set will be returned.

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

successor
  a profile to use as an explicit successor

#### Returns

the property's value

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### getPropertyAsString(String, String) Method

    public String getPropertyAsString(String propertySet,
                                      String propertyName)
         throws RemoteException, ProfileNotFoundException

Get a property from the profile, converted to a String If the property is not found, the default value from the property set will be returned.

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

#### Returns

the property's value

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### getPropertyAsString(String, String, String) Method

    public String getPropertyAsString(String propertySet,
                                      String propertyName,
                                      String successor)
         throws RemoteException, ProfileNotFoundException

Get a property from the profile. If a successor is provided, it will be used instead of the profile's groupname. If the property is not found, the default value from the property set will be returned.

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

successor
  a profile to use as an explicit successor

#### Returns

the property's value, converted to a String

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### getSuccessor(String) Method

    public String getSuccessor(String propertySet)
         throws RemoteException, ProfileNotFoundException

Retrieve the successor for the specified property set. For user and group profiles, this will always be a group name.

#### Parameters

propertySet
  The name of the property set

#### Returns

the successor's name

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### getType() Method

    public ProfileType getType()

Get profile type. There is no corresponding setter because the profile type is a static final attribute of all ProfileWrapper implementations

### getUsername() Method

    public String getUsername()

Get the current username of this profile

#### Returns

a valid username if user if registered, the trackingId if the user is not registered but is being tracked, or null if anonymous user (assumes tracking is disabled).

### isType(ProfileType) Method

    public boolean isType(ProfileType type)

Compare this profile type with another.

### removeProperty(String, String) Method

    public Object removeProperty(String propertySet,
                                 String propertyName)
         throws RemoteException, ProfileNotFoundException

Remove a property from the profile

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

#### Returns

the old value of the property

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### removeSuccessor(String) Method

    public void removeSuccessor(String propertySet)
         throws RemoteException, ProfileNotFoundException

Remove the successor for the specified property set.

#### Parameters

propertySet
  The name of the property set

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### setProperties(EntityPropertyCache) Method

    public void setProperties(EntityPropertyCache cache)
         throws RemoteException, ProfileNotFoundException

Set properties in the profile, taken from the input cache. Invalid properties are ignored.

#### Parameters

cache
  The input property cache.

#### Exceptions

``RemoteException``
  if profile is not valid
``ProfileNotFoundException``

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

    public void setProperty(String propertySet,
                            String propertyName,
                            Object value)
         throws PropertyValidationException, RemoteException, ProfileNotFoundException

Set a property in the profile

#### Parameters

propertySet
  the property set containing the property

propertyName
  the name of the property to retrieve

value
  the new value for the property

#### Exceptions

``PropertyValidationException``
  if the new value is not valid
``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid

### setSuccessor(String, String) Method

    public void setSuccessor(String propertySet,
                             String successor)
         throws RemoteException, ProfileNotFoundException

Set the successor for the specified property set

#### Parameters

propertySet
  The name of the property set

successor
  the name of the successor profile to set

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile or the successor is not valid

### validateProfile() Method

    public void validateProfile()
         throws RemoteException, ProfileNotFoundException, SuccessorNotFoundException

Ensure that the profile represented by this object is valid

#### Exceptions

``RemoteException``
``ProfileNotFoundException``
  if the profile is not valid
``SuccessorNotFoundException``
  if the successor is not valid