atg.userdirectory.repository
Interface RepositoryUserDirectory

All Superinterfaces:
UserDirectory

public interface RepositoryUserDirectory
extends UserDirectory

A RepositoryUserDirectory is a UserDirectory which is backed by a data store in an ATG repository. It permits conversion between RepositoryItems and the Principals that they represent. It also associates each PrincipalType with a corresponding RepositoryView in the repository, which allows one to perform queries against these views, obtaining sets of principals that satisfy some condition. The RepositoryViews can also be used for adding and removing items that correspond to principals of different types.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from interface atg.userdirectory.UserDirectory
SORT_ASCENDING, SORT_DESCENDING
 
Method Summary
 Organization createOrganization(java.lang.String orgName, java.lang.String orgDescription, java.lang.Object parentOrgPrimaryKey)
          Create a new Organization.
 Organization createOrganization(java.lang.String orgName, java.lang.String orgDescription, Organization parentOrg)
          Create a new Organization.
 User createUser(java.lang.String pLogin, java.lang.String pPassword, boolean pHashPassword, java.util.Map pProperties)
          Create a new User.
 User createUser(java.lang.String pLogin, java.lang.String pPassword, boolean pHashPassword, java.util.Map pProperties, java.lang.Object pParentOrgPrimaryKey)
          Create a new User.
 User createUser(java.lang.String pLogin, java.lang.String pClearTextPassword, java.util.Map pProperties)
          Create a new User.
 User createUser(java.lang.String pLogin, java.lang.String pClearTextPassword, java.util.Map pProperties, java.lang.Object pParentOrgPrimaryKey)
          Create a new User.
 void deleteOrganization(Organization pOrganization)
          Given an Organization, delete it from this UserDirectory's repository.
 void deleteUser(User pUser)
          Given a User, delete it from this UserDirectory's repository.
 RepositoryItem getItem(java.security.Principal pPrincipal)
          Given a principal that is backed by a persistent repository item in the directory, return the item.
 RepositoryItem getItem(RoleFolder pFolder)
          Given a RoleFolder that is backed by a persistent repository item in the directory, return the item.
 MutableRepositoryItem getItemForUpdate(java.security.Principal pPrincipal)
          Given a principal that is backed by a persistent repository item in the directory, return a mutable repository item that can be used to update this principal.
 java.security.Principal getPrincipalForItem(RepositoryItem pItem)
          Given a persistent item in the repository used by this directory, return a Principal corresponding to that persistent item.
 RepositoryView getView(java.lang.Class pType)
          Return the RepositoryView whose items are used by this directory to store all principals of a given principal type.
 
Methods inherited from interface atg.userdirectory.UserDirectory
findOrganizationByPrimaryKey, findRoleByPrimaryKey, findUserByLogin, findUserByPrimaryKey, getOrganizationByPath, getRoleByPath, getRoleFolderByPath, getRoles, getRolesSortByName, getRootOrganization, getRootRoleFolder, getUserDirectoryName
 

Field Detail

CLASS_VERSION

static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Method Detail

createUser

User createUser(java.lang.String pLogin,
                java.lang.String pClearTextPassword,
                java.util.Map pProperties)
                throws RepositoryException,
                       DirectoryModificationException
Create a new User.

Parameters:
pLogin - The login.
pClearTextPassword - The clear text password.
pProperties - The map of properties to set in the User.
Returns:
The new User.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

createUser

User createUser(java.lang.String pLogin,
                java.lang.String pPassword,
                boolean pHashPassword,
                java.util.Map pProperties)
                throws RepositoryException,
                       DirectoryModificationException
Create a new User.

Parameters:
pLogin - The login.
pPassword - The password.
pHashPassword - If true, hash the password.
pProperties - The map of properties to set in the User.
Returns:
The new User.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

createUser

User createUser(java.lang.String pLogin,
                java.lang.String pClearTextPassword,
                java.util.Map pProperties,
                java.lang.Object pParentOrgPrimaryKey)
                throws RepositoryException,
                       DirectoryModificationException
Create a new User.

Parameters:
pLogin - The login.
pClearTextPassword - The clear text password.
pProperties - The map of properties to set in the User.
pParentOrgPrimaryKey - The primary key of the user's parent organization. If this is null, the user has no parent organization.
Returns:
The new User.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

createUser

User createUser(java.lang.String pLogin,
                java.lang.String pPassword,
                boolean pHashPassword,
                java.util.Map pProperties,
                java.lang.Object pParentOrgPrimaryKey)
                throws RepositoryException,
                       DirectoryModificationException
Create a new User.

Parameters:
pLogin - The login.
pPassword - The password.
pHashPassword - If true, hash the password.
pProperties - The map of properties to set in the User.
pParentOrgPrimaryKey - The primary key of the user's parent organization. If this is null, the user has no parent organization.
Returns:
The new User.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

createOrganization

Organization createOrganization(java.lang.String orgName,
                                java.lang.String orgDescription,
                                java.lang.Object parentOrgPrimaryKey)
                                throws RepositoryException,
                                       DirectoryModificationException
Create a new Organization.

Parameters:
orgName - The name of the new Organization.
orgDescription - The description of the new Organization.
parentOrgPrimaryKey - The primary key of the parent organization. If this is null, the root Organization will be the parent.
Returns:
The new Organization.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

createOrganization

Organization createOrganization(java.lang.String orgName,
                                java.lang.String orgDescription,
                                Organization parentOrg)
                                throws RepositoryException,
                                       DirectoryModificationException
Create a new Organization.

Parameters:
orgName - The name of the new Organization.
orgDescription - The description of the new Organization.
parentOrg - The parent organization. If this is null, the root Organization will be the parent.
Returns:
The new Organization.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

getView

RepositoryView getView(java.lang.Class pType)
                       throws RepositoryException
Return the RepositoryView whose items are used by this directory to store all principals of a given principal type. If multiple views are associated with the principal type, the returned vies will be a common supertype view of these item types.

Note that such a view may be of an abstract, non-instantiable item type, in which case one may not be able to create items in the view directly - one may need to decide on a concrete subtype to use for new items.

Parameters:
pType - the Class corresponding to the interface (User, Organization, Role etc.) for the principal type in question.
Returns:
the RepositoryView used by this directory which stores all principals of that type
Throws:
RepositoryException - if there was an error while attempting to return the RepositoryView

getItem

RepositoryItem getItem(java.security.Principal pPrincipal)
Given a principal that is backed by a persistent repository item in the directory, return the item. The item is read-only since it may be shared with other threads; use getItemForUpdate() to obtain a private, modifiable copy of a principal's item.

The state of the item is not guaranteed to reflect updates that may have occurred as part of a current transaction associated with the calling thread.

Parameters:
pPrincipal - the principal
Returns:
The persistent item backing this principal, or null if no such object exists.
See Also:
getItemForUpdate(java.security.Principal)

getItem

RepositoryItem getItem(RoleFolder pFolder)
Given a RoleFolder that is backed by a persistent repository item in the directory, return the item.

Parameters:
pFolder - the RoleFolder
Returns:
The persistent item backing this principal, or null if no such object exists.

getItemForUpdate

MutableRepositoryItem getItemForUpdate(java.security.Principal pPrincipal)
Given a principal that is backed by a persistent repository item in the directory, return a mutable repository item that can be used to update this principal.

The state of the item is not guaranteed to reflect updates that may have occurred as part of a current transaction associated with the calling thread.

Parameters:
pPrincipal - the principal
Returns:
The persistent item backing this principal, or null if no such object exists.

getPrincipalForItem

java.security.Principal getPrincipalForItem(RepositoryItem pItem)
Given a persistent item in the repository used by this directory, return a Principal corresponding to that persistent item.

If modifications were made to the item which have not been committed to the item's persistent store, the resulting Principal is not guaranteed to reflect those modifications -- the principal is only required to correspond to the item's identity.

Parameters:
pItem - A persistent object backing a principal
Returns:
the principal corresponding to the persistent object

deleteUser

void deleteUser(User pUser)
                throws RepositoryException,
                       DirectoryModificationException
Given a User, delete it from this UserDirectory's repository.

An attempt to delete the user will only be made if it has been detached from its immediate parent organization before calling this method. An user can be deleted using this code Organization parentOrganization = userToDelete.getParentOrganization(); parentOrganization.removeChild(userToDelete); userDirectory.deleteUser(userToDelete);

Parameters:
pUser - The User to be deleted from the repository.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.

deleteOrganization

void deleteOrganization(Organization pOrganization)
                        throws RepositoryException,
                               DirectoryModificationException
Given an Organization, delete it from this UserDirectory's repository.

An attempt to delete the organization will only be made if it has been detached from its immediate parent organization before calling this method. An organization can be deleted using this code Organization parentOrganization = organizationToDelete.getParentOrganization(); parentOrganization.removeChild(organizationToDelete); userDirectory.deleteOrganization(organizationToDelete);

Parameters:
pOrganization - The Organization to be deleted from the repository.
Throws:
RepositoryException
DirectoryModificationException - if the Repository isn't Mutable.