atg.security
Class GenericAccount

java.lang.Object
  extended by atg.security.GenericAccount
All Implemented Interfaces:
Account, AccountTypes, atg.security.I18nAccount

public class GenericAccount
extends java.lang.Object
implements atg.security.I18nAccount

A generic implementation of the Account interface.

See Also:
Account

Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from interface atg.security.AccountTypes
ANY_ACCOUNT, GROUP_ACCOUNT, LOGIN_ACCOUNT, PRIVILEGE_ACCOUNT
 
Constructor Summary
GenericAccount(AccountManager pAccountManager, java.lang.String pAccountName, int pType)
          Creates an account object for an account with the given name.
GenericAccount(AccountManager pAccountManager, java.lang.String pAccountName, int pType, java.util.Map pAttributes)
          Creates an account object for an account with the given name and attributes.
 
Method Summary
 void addGroup(java.lang.String pNewGroupName)
          Makes this account a member of a new group.
 AccountManager getAccountManager()
          Returns the account manager associated with this account.
 java.lang.String getAccountName()
          Returns the name of the account.
 int getAccountType()
          Returns the account type.
 java.lang.String getAttribute(java.lang.String pAttributeName)
          Retrieves the string value of a given attribute.
 java.util.Map getAttributes()
          Retrieves a mapping of all defined attributes and their values from the account.
 java.lang.String getDisplayNameForAttribute(java.lang.String pAttributeName)
          Returns the display name that should be associated with an attribute.
 Persona getPersona()
          Returns the Persona object that corresponds to this account.
 UserAuthority getUserAuthority()
          Returns the user authority that will be used for constructing a Persona object for this account.
 java.util.Iterator listGroups()
          Returns an iterator of the groups that this account is a member of.
 java.util.Iterator listMembers()
          If this Account is a group, this will return the names of the members of the group.
 void removeGroup(java.lang.String pGroupName)
          Removes a group from the set of groups that this account is a member of.
 void setAttribute(java.lang.String pAttributeName, java.lang.String pNewValue)
          Changes the value of a given attribute.
 void setAttributes(java.util.Map pNewAttributes)
          Changes the values of a set of account attributes.
 void setGroups(java.lang.String[] pNewGroups)
          Makes this account a member of a set of groups.
 void setUserAuthority(UserAuthority pUserAuthority)
          Changes the user authority used for creating Persona objects for this account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

GenericAccount

public GenericAccount(AccountManager pAccountManager,
                      java.lang.String pAccountName,
                      int pType)
Creates an account object for an account with the given name.

Parameters:
pAccountManager - The account manager that manages this account.
pAccountName - The name of the account we are creating an object for.
pType - The type of account

GenericAccount

public GenericAccount(AccountManager pAccountManager,
                      java.lang.String pAccountName,
                      int pType,
                      java.util.Map pAttributes)
Creates an account object for an account with the given name and attributes.

Parameters:
pAccountManager - The account manager that manages this account.
pAccountName - The name of the account we are creating an object for.
pType - The type of account
pAttributes - A set of attributes to assign to the account. These attributes will be copied (if not null).
Method Detail

getPersona

public Persona getPersona()
Returns the Persona object that corresponds to this account.


getUserAuthority

public UserAuthority getUserAuthority()
Returns the user authority that will be used for constructing a Persona object for this account.


setUserAuthority

public void setUserAuthority(UserAuthority pUserAuthority)
Changes the user authority used for creating Persona objects for this account. Normally this is not used; rather, the constructor notices that the AccountManager is also a UserAuthority and sets the property during object construction. This is an escape hatch for cases where that is not possible.


getAccountManager

public AccountManager getAccountManager()
Returns the account manager associated with this account.

Specified by:
getAccountManager in interface Account

getAccountName

public java.lang.String getAccountName()
Returns the name of the account. This is usually either a login name or a group name.

Specified by:
getAccountName in interface Account

getAccountType

public int getAccountType()
Returns the account type.

Specified by:
getAccountType in interface Account
See Also:
AccountTypes

getAttribute

public java.lang.String getAttribute(java.lang.String pAttributeName)
Retrieves the string value of a given attribute.

Specified by:
getAttribute in interface Account
Parameters:
pAttributeName - The name of the desired attribute.

getAttributes

public java.util.Map getAttributes()
Retrieves a mapping of all defined attributes and their values from the account.

Specified by:
getAttributes in interface Account

setAttribute

public void setAttribute(java.lang.String pAttributeName,
                         java.lang.String pNewValue)
Changes the value of a given attribute.

Specified by:
setAttribute in interface Account
Parameters:
pAttributeName - The name of the attribute to change.
pNewValue - The new value to give to the attribute. If this value is null, the attribute is removed.

setAttributes

public void setAttributes(java.util.Map pNewAttributes)
Changes the values of a set of account attributes. The mapping may contain a subset of existing attribute values; only those attributes that are present in the mapping are changed, and none are removed.

Specified by:
setAttributes in interface Account
Parameters:
newAttributes - The set of attributes to change, and their associated values.

listGroups

public java.util.Iterator listGroups()
Returns an iterator of the groups that this account is a member of.

Specified by:
listGroups in interface Account

addGroup

public void addGroup(java.lang.String pNewGroupName)
              throws NoSuchAccountException,
                     PermissionDeniedException
Makes this account a member of a new group.

Specified by:
addGroup in interface Account
Parameters:
pNewGroupName - The name of the group to add membership to.
Throws:
NoSuchAccountException - Indicates that the specified group does not exist.
PermissionDeniedException

setGroups

public void setGroups(java.lang.String[] pNewGroups)
               throws NoSuchAccountException,
                      PermissionDeniedException
Makes this account a member of a set of groups.

Specified by:
setGroups in interface Account
Parameters:
pNewGroups - An array of names of groups to remove membership from.
Throws:
NoSuchAccountException - Indicates that a specified group does not exist.
PermissionDeniedException

removeGroup

public void removeGroup(java.lang.String pGroupName)
                 throws NoSuchAccountException,
                        PermissionDeniedException
Removes a group from the set of groups that this account is a member of.

Specified by:
removeGroup in interface Account
Parameters:
pGroupName - The name of the group to remove membership from.
Throws:
NoSuchAccountException - Indicates that the account is not a member of the group.
PermissionDeniedException

listMembers

public java.util.Iterator listMembers()
If this Account is a group, this will return the names of the members of the group. If this Account is not a group, this returns null.

Specified by:
listMembers in interface Account

getDisplayNameForAttribute

public java.lang.String getDisplayNameForAttribute(java.lang.String pAttributeName)
Returns the display name that should be associated with an attribute. If the name is not available this will return null.

Specified by:
getDisplayNameForAttribute in interface atg.security.I18nAccount