com.iplanet.portalserver.profile
Class Profile

java.lang.Object
  |
  +--com.iplanet.portalserver.profile.Profile

public class Profile
extends java.lang.Object

Profile class provides common methods to get/set/delete profile attributes. This class also provides methods to verify user access privileges.


Field Summary
static int ALL
          All profile types
static int APPEND
          Append attribute value
static int APPLICATION
          Application profile type
static int DELETE
          Delete attribute value
static int DOMAIN
          Domain profile type
static int NEW
          New attribute value i.e replace old value
static int PREFIX
          Prefix matching
static int REGULAR
          Regular matching i.e match all
static int ROLE
          Rrole profile type
static int SUFFIX
          Suffix matching
static int USER
          User profile type
 
Method Summary
 void addProfileListener(ProfileListener l)
          Adds specified profile listener to receive any profile change events from this profile.
 void delAttribute(java.lang.String name)
          Deletes attribute from profile.
 void delAttributes(java.lang.String wildchar)
          Deletes attributes which match wildchar expression from profile.
 java.util.Enumeration getAttribute(java.lang.String name)
          Gets attribute value.
 java.util.Hashtable getAttributes()
          Gets hashtable of profile attributes.
 java.util.Hashtable getAttributes(java.lang.String wildchar)
          Gets hashtable of profile attributes.
 java.lang.String getAttributeString(java.lang.String name)
          Gets string type attribute value.
 java.util.Enumeration getPrivilegeNames()
          Gets privilege names belong to this profile .
 java.util.Enumeration getPrivilegeNames(java.lang.String wildchar)
          Gets privilege names which match wildchar expression.
 java.lang.String getProfileName()
          Gets Profile name.
 int getProfileType()
          Gets Profile type.
 boolean isAllowed(java.lang.String privilege)
          Checks user privilege.
 boolean isAllowed(java.lang.String privilege, java.lang.String value, int match)
          Checks user privilege.
 boolean isAllowedIgnoreCase(java.lang.String privilege, java.lang.String value, int match)
          Checks user privilege.
 void loadAttributes(java.util.Set attributeNames)
          Load attribute values based on attribute names.
 void loadPrivileges(java.util.Set privilegeNames)
          Load privilege values based on privilege names.
 void removeProfileListener(ProfileListener l)
          Removes specified profile listener so that it doesn't receive profile change events from this profile.
 void setAttribute(java.lang.String name, java.util.Enumeration value, int operation)
          Sets attribute value based on operation.
 void setAttributeString(java.lang.String name, java.lang.String value, int operation)
          Sets value of string type attribute.
 void store(boolean force)
          Stores profile data in the profile database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGULAR

public static final int REGULAR
Regular matching i.e match all

SUFFIX

public static final int SUFFIX
Suffix matching

PREFIX

public static final int PREFIX
Prefix matching

DELETE

public static final int DELETE
Delete attribute value

APPEND

public static final int APPEND
Append attribute value

NEW

public static final int NEW
New attribute value i.e replace old value

APPLICATION

public static final int APPLICATION
Application profile type

DOMAIN

public static final int DOMAIN
Domain profile type

USER

public static final int USER
User profile type

ROLE

public static final int ROLE
Rrole profile type

ALL

public static final int ALL
All profile types
Method Detail

getAttributeString

public java.lang.String getAttributeString(java.lang.String name)
                                    throws ProfileException
Gets string type attribute value.
Parameters:
name - Attribute name
Returns:
String value of attribute
Throws:
ProfileException - if requested attribute is not found in profile or it is not string type or if user doesnot have read permission on attribute
See Also:
getAttribute(java.lang.String)

getAttribute

public java.util.Enumeration getAttribute(java.lang.String name)
                                   throws ProfileException
Gets attribute value.
Parameters:
name - Attribute name
Returns:
Enumeration of attribute values. Returns empty enumeration if attribute value is empty string.
Throws:
ProfileException - if requested attribute is not found in profile or if user doesnot have read permission on attribute
See Also:
getAttributeString(java.lang.String)

getAttributes

public java.util.Hashtable getAttributes()
                                  throws ProfileException
Gets hashtable of profile attributes. Hashtable key is the attribute name and value is the attribute value.
Returns:
Hashtable of attributes
Throws:
ProfileException -  

getAttributes

public java.util.Hashtable getAttributes(java.lang.String wildchar)
                                  throws ProfileException
Gets hashtable of profile attributes. Hashtable key is the attribute name and value is the attribute value.
Parameters:
wildchar - Wildchar expression
Returns:
Hashtable of attributes which match wildchar expression
Throws:
ProfileException - if wildchar expression is not valid

setAttributeString

public void setAttributeString(java.lang.String name,
                               java.lang.String value,
                               int operation)
                        throws ProfileException
Sets value of string type attribute. If operation is
  • Profile.NEW - replaces the present value with specified value
  • Profile.APPEND - appends specified value to present value
  • Profile.DELETE - deletes specified value from present value
    Parameters:
    name - Attribute name
    value - Attribute value
    operation - Profile.NEW or Profile.APPEND or Profile.DELETE
    Throws:
    ProfileException - if user doesnot have write permission on attribute
    See Also:
    setAttribute(java.lang.String, java.util.Enumeration, int)

  • setAttribute

    public void setAttribute(java.lang.String name,
                             java.util.Enumeration value,
                             int operation)
                      throws ProfileException
    Sets attribute value based on operation. If operation is
  • Profile.NEW - replaces the present value with specified value
  • Profile.APPEND - appends specified value to present value
  • Profile.DELETE - deletes specified value from present value
    Parameters:
    name - Attribute name
    value - Attribute value
    operation - Profile.NEW or Profile.APPEND or Profile.DELETE
    Throws:
    ProfileException - if user doesnot have write permission on attribute
    See Also:
    setAttributeString(java.lang.String, java.lang.String, int)

  • delAttribute

    public void delAttribute(java.lang.String name)
                      throws ProfileException
    Deletes attribute from profile.
    Parameters:
    name - Attribute name
    Throws:
    ProfileException - if requested attribute is not found in profile or if user doesnot have write permission on attribute

    delAttributes

    public void delAttributes(java.lang.String wildchar)
                       throws ProfileException
    Deletes attributes which match wildchar expression from profile.
    Parameters:
    wildchar - Wildchar expression
    Throws:
    ProfileException - if wildchar expression is not valid

    addProfileListener

    public void addProfileListener(ProfileListener l)
    Adds specified profile listener to receive any profile change events from this profile.
    Parameters:
    l - The profile listener to be added.

    removeProfileListener

    public void removeProfileListener(ProfileListener l)
    Removes specified profile listener so that it doesn't receive profile change events from this profile.
    Parameters:
    l - The profile listener to be removed.

    store

    public void store(boolean force)
               throws ProfileException
    Stores profile data in the profile database.
    Parameters:
    force - If true profile changes are propagated to child profiles which inherit this profile. If false profile changes are not propagated.
    Throws:
    ProfileException - if store operation fails.

    isAllowed

    public boolean isAllowed(java.lang.String privilege)
                      throws ProfileException
    Checks user privilege. This method is used to check boolean value privilges(or simple privileges).
    Parameters:
    privilege - Privilege name
    Returns:
    Returns true or false based on privilege value.
    Throws:
    ProfileException - if privilege is not found in profile

    isAllowed

    public boolean isAllowed(java.lang.String privilege,
                             java.lang.String value,
                             int match)
                      throws ProfileException
    Checks user privilege. Compares passed value with privilege value and returns true or false. Does suffix or prefix or regular wildchar match depending on match value.
    Parameters:
    privilege - Privilege name
    value - Privilege value
    match - Profile.REGULAR or Profile.SUFFIX or Profile.PREFIX
    Returns:
    boolean value
    Throws:
    ProfileException - if privilege is not found in profile or if value specified is not valid or illegal match specified

    isAllowedIgnoreCase

    public boolean isAllowedIgnoreCase(java.lang.String privilege,
                                       java.lang.String value,
                                       int match)
                                throws ProfileException
    Checks user privilege. Compares passed value with privilege value and returns true or false. The comparison is done in case-insensitive way. Does suffix or prefix or regular wildchar match depending on match value.
    Parameters:
    privilege - Privilege name
    value - Privilege value
    match - Profile.REGULAR or Profile.SUFFIX or Profile.PREFIX
    Returns:
    boolean value
    Throws:
    ProfileException - if privilege is not found in profile or if value specified is not valid or illegal match specified

    loadPrivileges

    public void loadPrivileges(java.util.Set privilegeNames)
                        throws ProfileException
    Load privilege values based on privilege names.
    Parameters:
    privilegeNames - A set of privilege names
    Returns:
    None
    Throws:
    ProfileException -  

    loadAttributes

    public void loadAttributes(java.util.Set attributeNames)
                        throws ProfileException
    Load attribute values based on attribute names.
    Parameters:
    attributeNames - A set of attribute names, may contain wildchar
    Returns:
    None
    Throws:
    ProfileException -  

    getPrivilegeNames

    public java.util.Enumeration getPrivilegeNames()
                                            throws ProfileException
    Gets privilege names belong to this profile .
    Returns:
    Enumeration of privilege names
    Throws:
    ProfileException -  

    getPrivilegeNames

    public java.util.Enumeration getPrivilegeNames(java.lang.String wildchar)
                                            throws ProfileException
    Gets privilege names which match wildchar expression.
    Parameters:
    wildchar - Wildchar expression
    Returns:
    Enumeration of privilege names which match wildchar
    Throws:
    ProfileException - if wildchar expression is not valid

    getProfileName

    public java.lang.String getProfileName()
    Gets Profile name.
    Returns:
    Profile name

    getProfileType

    public int getProfileType()
    Gets Profile type.
    Returns:
    Profile type - Profile.ROLE or Profile.USER or Profile.DOMAIN or Profile.APPLICATION