Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

All Superinterfaces
  Serializable

    @ControlInterface
    public interface PropertyControl

extends Serializable

Control to access and modify the user profile. The methods all use the ProfileWrapper as the object for which the profile will be associated.

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

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
`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)` Get all properties for named property set for this profile, and return as an EntityPropertyCache.
`Object` | `getProperty(ProfileWrapper pw, String propertySet, String property)` Get an individual property.
`Object` | `removeProperty(ProfileWrapper pw, String propertySet, String propertyName)` Remove a property from the profile
`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.

Method Detail

### getProperties

    EntityPropertyCache getProperties(ProfileWrapper pw)
                                      throws ProfileNotFoundException,
                                             P13nControlException

  Get all properties for this profile, and return as an EntityPropertyCache.

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

### getPropertiesFromSet

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

  Get all properties for named property set for this profile, and return as an EntityPropertyCache.

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

### getPropertiesFromKeys

    EntityPropertyCache getPropertiesFromKeys(ProfileWrapper pw,
                                              Set propertyMapKeys)
                                              throws ProfileNotFoundException,
                                                     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
    `a` - Set of PropertyMapKeys for which all properties will be retrieved
  Returns
    an EntityPropertyCache of the retrieved properties or null if there are no properties
  Throws
    `P13nControlException` - if profile not found, or if remote exceptions are encounterd while trying to retrieve the properties
    `ProfileNotFoundException`

### getProperty

    Object getProperty(ProfileWrapper pw,
                       String propertySet,
                       String property)
                       throws ProfileNotFoundException,
                              P13nControlException

  Get an individual property.

  Parameters
    `pw` - The ProfileWrapper representing the user profile for which the properties are to be retrieved
    `the` - name of the property set containing the property to retrieve
    `the` - name of the property to retrieve
  Returns
    the retrieved property, or null if not found
  Throws
    `ProfileNotFoundException` - if profile not found
    `P13nControlException` - if remote exceptions are encounterd while trying to retrieve the properties

### setProperties

    void setProperties(ProfileWrapper pw,
                       EntityPropertyCache cache)
                       throws ProfileNotFoundException,
                              PropertyValidationException,
                              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
    `ProfileNotFoundException` - if profile not found
    `PropertyValidationException` - if property is invalid
    `P13nControlException` - if profile not found, or if remote exceptions are encounterd while trying to set the properties

### setProperty

    void setProperty(ProfileWrapper pw,
                     String propertySet,
                     String property,
                     Object value)
                     throws ProfileNotFoundException,
                            PropertyValidationException,
                            P13nControlException

  Set an individual property.

  Parameters
    `pw` - The ProfileWrapper representing the user profile for which the properties are to be retrieved
    `the` - name of the property set containing the property to set
    `the` - name of the property to set
    `the` - value of the property to set
  Throws
    `ProfileNotFoundException` - if profile not found
    `PropertyValidationException` - if property is invalid
    `P13nControlException` - if remote exceptions are encounterd while trying to set the property

### removeProperty

    Object removeProperty(ProfileWrapper pw,
                          String propertySet,
                          String propertyName)
                          throws ProfileNotFoundException,
                                 P13nControlException

  Remove a property from the profile

  Parameters
    `pw` - The ProfileWrapper representing the user profile for which the properties are to be retrieved
    `propertySet` - the property set containing the property
    `propertyName` - the name of the property to retrieve
  Returns
    the old value of the property
  Throws
    `ProfileNotFoundException` - if profile not found
    `P13nControlException` - if remote exceptions are encontered while trying to remove the property

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved