atg.userdirectory
Class UserDirectoryTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.userdirectory.UserDirectoryTools
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
PortalUserDirectoryTools

public class UserDirectoryTools
extends GenericService

A set of useful methods that act upon a set user directory instance. These methods perform userdirectory operations based on primary keys of objects rather than the objects themselves, which saves the user a few extra steps, as well as error handling.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
UserDirectoryTools()
           
 
Method Summary
 boolean addUserToOrganization(java.lang.Object pUserId, java.lang.Object pOrganizationId)
          This method adds a user specified by a given user id to an organization specified by a given organization id
 boolean assignRolesToUser(java.util.Collection pRoleIds, java.lang.Object pUserId)
          This method looks for a collection of roles using the passed in pRoleIds parameter and assigns them to the user associated with the pUserId
 boolean assignRolesToUser(java.lang.Object[] pRoleIds, java.lang.Object pUserId)
          This method looks for an array of roles using the passed in pRoleIds parameter and assigns them to the user associated with the pUserId
 void doStartService()
          This method ensures that the userDirectory property is set before any method calls are made
 UserDirectory getUserDirectory()
          Gets the userDirectory property
 boolean removeAllRolesFromUser(java.lang.Object pUserId)
          This method removes all assigned roles from a user specified by a given user id.
 boolean removeRolesFromUser(java.util.Collection pRoleIds, java.lang.Object pUserId)
          This method removes roles associated with the given role ids from a user specified by a given user id.
 boolean removeRolesFromUser(java.lang.Object[] pRoleIds, java.lang.Object pUserId)
          This method removes roles associated with the given role ids from a user specified by a given user id.
 boolean removeUserFromOrganization(java.lang.Object pUserId, java.lang.Object pOrganizationId)
          This method removes a user specified by a given user id from an organization specified by a given organization id
 boolean removeUserFromParentOrganization(java.lang.Object pUserId)
          This method removes a user from its associated parent organization
 void setUserDirectory(UserDirectory pUserDirectory)
          Sets the userDirectory property
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
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
Class version string

Constructor Detail

UserDirectoryTools

public UserDirectoryTools()
Method Detail

setUserDirectory

public void setUserDirectory(UserDirectory pUserDirectory)
Sets the userDirectory property

Parameters:
pUserDirectory - the user directory used to perform operations

getUserDirectory

public UserDirectory getUserDirectory()
Gets the userDirectory property

Returns:
pUserDirectory the user directory used to perform operations

assignRolesToUser

public boolean assignRolesToUser(java.lang.Object[] pRoleIds,
                                 java.lang.Object pUserId)
This method looks for an array of roles using the passed in pRoleIds parameter and assigns them to the user associated with the pUserId
Parameters:
pRoleIds - the primary keys of the roles that will be assigned to the user
pUserId - the primary key of the user that will have roles assigned to it
Returns:
true if the operation was successful and/or no exceptional situation occurred. false otherwise

assignRolesToUser

public boolean assignRolesToUser(java.util.Collection pRoleIds,
                                 java.lang.Object pUserId)
This method looks for a collection of roles using the passed in pRoleIds parameter and assigns them to the user associated with the pUserId
Parameters:
pRoleIds - the primary keys of the roles that will be assigned to the user
pUserId - the primary key of the user that will have roles assigned to it
Returns:
true if the operation was successful and/or no exceptional situation occurred. false otherwise

addUserToOrganization

public boolean addUserToOrganization(java.lang.Object pUserId,
                                     java.lang.Object pOrganizationId)
This method adds a user specified by a given user id to an organization specified by a given organization id

Parameters:
pOrganizationId - the primary key of the organization to which the user is to be added
pUserId - the primary key of the user to add to the organization
Returns:
true if the user was added and/or no exceptional situation occurred, false otherwise

removeRolesFromUser

public boolean removeRolesFromUser(java.lang.Object[] pRoleIds,
                                   java.lang.Object pUserId)
This method removes roles associated with the given role ids from a user specified by a given user id. If an error occurs during the role removal, all prior removed rolls will be re-assigned

Parameters:
pRoleIds - the primary keys of the roles that are to be removed from the user
pUserId - the primary key of the user
Returns:
true if all roles were removed and/or the roles were not assigned to the user to begin with and no exceptional situation occurred, false otherwise

removeRolesFromUser

public boolean removeRolesFromUser(java.util.Collection pRoleIds,
                                   java.lang.Object pUserId)
This method removes roles associated with the given role ids from a user specified by a given user id. If an error occurs during the role removal, all prior removed rolls will be re-assigned

Parameters:
pRoleIds - the primary keys of the roles that are to be removed from the user
pUserId - the primary key of the user
Returns:
true if all roles were removed and/or the roles were not assigned to the user to begin with and no exceptional situation occurred, false otherwise

removeUserFromOrganization

public boolean removeUserFromOrganization(java.lang.Object pUserId,
                                          java.lang.Object pOrganizationId)
This method removes a user specified by a given user id from an organization specified by a given organization id

Parameters:
pUserId - the primary key of the user to remove
pOrganizationId - the primary key of the organization the user is to be removed from
Returns:
true if the user was removed from the organization, or the user did not belong to the organization and no exceptional error occurred, false otherwise

removeUserFromParentOrganization

public boolean removeUserFromParentOrganization(java.lang.Object pUserId)
This method removes a user from its associated parent organization

Parameters:
pUserId - the id of the user who will be removed from its current parent organization
Returns:
true if the user was removed successfully or did not have a parent organization, false if there was an error having to do with invalid arguments, or some other processing failure

removeAllRolesFromUser

public boolean removeAllRolesFromUser(java.lang.Object pUserId)
This method removes all assigned roles from a user specified by a given user id. If an error occurs during the operation, then any removed roles are reassigned before returning

Parameters:
pUserId - the primary key of the user whose roles will be removed
Returns:
true if the users roles were removed and no exceptional situation occurred, false otherwise

doStartService

public void doStartService()
                    throws ServiceException
This method ensures that the userDirectory property is set before any method calls are made

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the userDirectory property is not set