atg.userprofiling
Class MultiProfileAddFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.repository.servlet.RepositoryFormHandler
                      extended by atg.userprofiling.MultiProfileForm
                          extended by atg.userprofiling.MultiProfileAddFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, RepositoryFormConstants, RepositoryFormData, java.util.EventListener
Direct Known Subclasses:
MultiUserAddFormHandler

public class MultiProfileAddFormHandler
extends MultiProfileForm

This is a form handler for creating one or more user profiles with a single submit request.

This bean has a count property which determines the number of user profiles being created by the form handler. count must be set in order for this bean to function properly. The count value is used to determine the number of users allocated in the array of UserListItem objects. Each UserListItem object contains a value dictionary of properties for the given user. To refer to these properties you simply set the "FormHandler.users[index].value.propertyName" to set individual per-user property values.

This bean also has a value property which is a dictionary of properties of the current repository item. This set of properties is applied to every user profile created by this form handler. For example, if you want to get or set the "userType" property of a repository item you would set the "FormHanlder.value.userType" bean property.

This form handler supports the following submit methods:

create
creates a set of new user profiles with the specified property settings, combining the value with the UserListItem.value settings. Each profile is created with an auto-generated repositoryId unless the individual user.repositoryId has been set.
cancel
cancel the supplied form information by clearing out the value dictionary and reinitializing the per-user users array.

The following properties of the MultiProfileAddFormHandler will typically be set in a properties file for this component:

repository
Specifies the repository to operate on - obtained via ProfileTools.
maxCount
Specifies the maximum value allowed for setting count to. Default is 0 which indicates that there is no maximum applied.
minCount
Specifies the minimum value allowed for setting count to. The default is 1.
generatePassword
Specifies whether the form handler should generate a password by setting the password to the current value of the defaultPassword property. Default is false.
defaultPassword
Specifies the string value of what the desired password default should be.
userListItemClass
Specifies the name of the class to be used for the entries in the users array. Default is UserListItem.

See Also:
RepositoryFormHandler, UserListItem, MultiProfileUpdateFormHandler

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.userprofiling.MultiProfileForm
CONFIRMPASSWORD_PARAM, OLDPASSWORD_PARAM
 
Fields inherited from class atg.repository.servlet.RepositoryFormHandler
STATUS_ERROR_REDIRECT, STATUS_ERROR_STAY, STATUS_SUCCESS
 
Fields inherited from class atg.droplet.GenericFormHandler
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.repository.servlet.RepositoryFormConstants
NULL_SENTINEL, REPOSITORY_ID_PROPERTY_NAME, UPDATE_APPEND, UPDATE_PREPEND, UPDATE_REMOVE, UPDATE_REPLACE
 
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
MultiProfileAddFormHandler()
           
 
Method Summary
 void addFormException(DropletException exc)
          Adds a new exception to the list of FormExceptions.
 boolean beforeSet(DynamoHttpServletRequest request, DynamoHttpServletResponse response)
          Called before any setX methods on this form are set when a form that modifies properties of this form handler is submitted.
protected  void createUser(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method handles the creation of an individual user.
protected  atg.userprofiling.UserListItem createUserListItemObject()
          This method acts as a factory method for creating the result object that will be used by this processor.
 boolean getClearValuesOnCreate()
           
 boolean getCommonFormError()
          Returns true if an error common to all users occurred while processing the form.
 java.util.Vector getCommonFormExceptions()
          Returns the array of common exceptions that occurred.
 int getCount()
          Returns the count of users being created by this form handler
 atg.userprofiling.UserListItem getCurrentUser()
          Get the object representing the user currently being added
 java.lang.String getDefaultPassword()
           
 java.lang.String getItemDescriptorName()
          Get the value of itemDescriptorName.
 int getMaxCount()
          Returns the max count of users that can be created by this form handler
 int getMinCount()
          Returns the minumum count of users that can be created by this form handler
 java.lang.String getUserListItemClass()
          Get the name of the class to be used for the users array
 java.util.List getUsers()
          Allocates if necessary and Returns the list of user profiles being created by this form handler
 boolean handleCancel(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Resets the current list of users in the users to initialize them to null to clear out the form data that hasn't been submitted yet.
 boolean handleClear(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Resets the current list of users in the users to initialize them to null to clear out the form data that hasn't been submitted yet.
 boolean handleCreate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Takes the current list of users in the users and for each one, replicates the set of common property values set as members of the value property and, if there were no errors in submitting the form, creates a new repository item, sets these property values in the new item, and adds the item persistently to the repository.
protected  void initUsers()
          Allocates the list of user profiles being created by this form handler
 boolean isGeneratePassword()
          Returns the passwordGenerator to be used by this form handler
 boolean isGenerateRegisterEvents()
          Get property GenerateRegisterEvents
protected  boolean mergeValueDictionaries(java.util.Dictionary pCommonValues, java.util.Dictionary pUserValues, RepositoryFormHandler pFormHandler, int pUserIndex, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, java.lang.String pPropertyPathPrefix)
          Merges the common value dictionary into the user-specific value dictionary.
protected  void postCreate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just after the creation process is finished.
protected  void postCreateUser(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just after an individual user is created.
protected  void preCreate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called at the beginning of the creation process prior to creating the individual users.
protected  void preCreateUser(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just before an individual user is created.
 void resetFormExceptions()
          Clears out all form exceptions
 void setClearValuesOnCreate(boolean pClearValuesOnCreate)
          Sets the property clearValuesOnCreate.
 void setCount(int pCount)
          Validates and Sets the count of users being created by this form handler.
 void setCurrentUser(atg.userprofiling.UserListItem pCurrentUser)
          Sets the object representing the user currently being added
 void setDefaultPassword(java.lang.String pDefaultPassword)
          Sets the property defaultPassword.
 void setGeneratePassword(boolean pGeneratePassword)
          Sets the password generator used by this form handler.
 void setGenerateRegisterEvents(boolean pGenerateRegisterEvents)
          Set property GenerateRegisterEvents
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
          Set the value of itemDescriptorName.
 void setMaxCount(int pMaxCount)
          Sets the maximum count of users that can be created by this form handler.
 void setMinCount(int pMinCount)
          Sets the minumum count of users that can be created by this form handler.
 void setUserListItemClass(java.lang.String pUserListItemClass)
          Sets the list of user profiles being created
 void setUsers(java.util.List pUsers)
          Sets the list of user profiles being created
protected  boolean userAlreadyExists(Repository pProfileRepository, RepositoryFormHandler pFormHandler, int pUserIndex, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns true if a user already exists with the given login name
 
Methods inherited from class atg.userprofiling.MultiProfileForm
afterSet, confirmPasswordValue, formatUserMessage, formatUserMessage, formatUserMessage, formatUserMessage, getProfile, getProfileTools, getTransactionManager, getUserLocale, getValueProperty, isConfirmOldPassword, isConfirmPassword, setConfirmOldPassword, setConfirmPassword, setProfile, setProfileTools, setTransactionManager, updatePasswordValue
 
Methods inherited from class atg.repository.servlet.RepositoryFormHandler
checkFormError, checkFormSuccess, checkForRequiredProperties, deleteItem, getCheckForReadOnlyProperties, getCheckForRequiredProperties, getContentItemDescriptor, getContentNameProperty, getContentPathProperty, getCreateErrorURL, getCreateSuccessURL, getDeleteErrorURL, getDeleteSuccessURL, getEditMapsAsLists, getErrorHandler, getExtractDefaultValuesFromItem, getFolderIdProperty, getItemDescriptor, getItemProperty, getLogger, getMapKeyValueSeparator, getRemoveReferencesToDeletedItems, getRepository, getRepositoryId, getRepositoryItem, getRepositoryItemEditor, getRepositoryPathName, getRequireIdOnCreate, getSpecifiedIdPropertyValue, getTransactionDemarcation, getTrimProperties, getUpdateErrorURL, getUpdateSuccessURL, getValue, getValueProperty, handleDelete, handleUpdate, isClearValueOnSet, isCreateTransientItems, isRequireMapKeys, isSortRepositoryItemSets, isTrimProperty, isUpdateItemsInCollection, postCreateItem, postDeleteItem, postUpdateItem, postUpdateItemProperties, preCreateItem, preDeleteItem, preUpdateItem, setCheckForReadOnlyProperties, setCheckForRequiredProperties, setClearValueOnSet, setContentNameProperty, setContentPathProperty, setCreateErrorURL, setCreateSuccessURL, setCreateTransientItems, setDeleteErrorURL, setDeleteSuccessURL, setEditMapsAsLists, setExtractDefaultValuesFromItem, setFolderIdProperty, setMapKeyValueSeparator, setRemoveReferencesToDeletedItems, setRepository, setRepositoryId, setRepositoryItemEditor, setRepositoryPathName, setRequireIdOnCreate, setRequireMapKeys, setSortRepositoryItemSets, setTrimProperties, setUpdateErrorURL, setUpdateItemsInCollection, setUpdateSuccessURL, setValueProperty, testPropertyAttribute, updateChildItemProperty, updateContentItemValues, updateItem, updateItemProperties, updateListProperty, updateMapProperty
 
Methods inherited from class atg.droplet.GenericFormHandler
addUncheckedFormException, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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, reResolveThis, 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

MultiProfileAddFormHandler

public MultiProfileAddFormHandler()
Method Detail

getCount

public int getCount()
Returns the count of users being created by this form handler


setCount

public void setCount(int pCount)
Validates and Sets the count of users being created by this form handler. If count is greater than maxCount property, we set count to maxCount If count is less than minCount property, we set count to minCount


getMaxCount

public int getMaxCount()
Returns the max count of users that can be created by this form handler


setMaxCount

public void setMaxCount(int pMaxCount)
Sets the maximum count of users that can be created by this form handler.


getMinCount

public int getMinCount()
Returns the minumum count of users that can be created by this form handler


setMinCount

public void setMinCount(int pMinCount)
Sets the minumum count of users that can be created by this form handler.


isGeneratePassword

public boolean isGeneratePassword()
Returns the passwordGenerator to be used by this form handler


setGeneratePassword

public void setGeneratePassword(boolean pGeneratePassword)
Sets the password generator used by this form handler.


getUsers

public java.util.List getUsers()
Allocates if necessary and Returns the list of user profiles being created by this form handler


setUsers

public void setUsers(java.util.List pUsers)
Sets the list of user profiles being created


getUserListItemClass

public java.lang.String getUserListItemClass()
Get the name of the class to be used for the users array


setUserListItemClass

public void setUserListItemClass(java.lang.String pUserListItemClass)
Sets the list of user profiles being created


getCurrentUser

public atg.userprofiling.UserListItem getCurrentUser()
Get the object representing the user currently being added


setCurrentUser

public void setCurrentUser(atg.userprofiling.UserListItem pCurrentUser)
Sets the object representing the user currently being added


setGenerateRegisterEvents

public void setGenerateRegisterEvents(boolean pGenerateRegisterEvents)
Set property GenerateRegisterEvents

Parameters:
pGenerateRegisterEvents - new value to set

isGenerateRegisterEvents

public boolean isGenerateRegisterEvents()
Get property GenerateRegisterEvents

Returns:
GenerateRegisterEvents

setDefaultPassword

public void setDefaultPassword(java.lang.String pDefaultPassword)
Sets the property defaultPassword. This is used when the generatePassword property is set to true and it contains the default to be used for all users being created.


getDefaultPassword

public java.lang.String getDefaultPassword()
Returns:
The value of the defaultPassword property. If set to null, return the value of username.

setClearValuesOnCreate

public void setClearValuesOnCreate(boolean pClearValuesOnCreate)
Sets the property clearValuesOnCreate. This is useful using session scoped form handlers to control whether the form data is to be cleared after the create submit request is complete.


getClearValuesOnCreate

public boolean getClearValuesOnCreate()
Returns:
The value of the clearValuesOnCreate property.

addFormException

public void addFormException(DropletException exc)
Adds a new exception to the list of FormExceptions. The exception is added both to the regular form exception list, and to the common exceptions list.

Overrides:
addFormException in class GenericFormHandler

resetFormExceptions

public void resetFormExceptions()
Clears out all form exceptions

Overrides:
resetFormExceptions in class GenericFormHandler

getCommonFormError

public boolean getCommonFormError()
Returns true if an error common to all users occurred while processing the form.


getCommonFormExceptions

public java.util.Vector getCommonFormExceptions()
Returns the array of common exceptions that occurred.


getItemDescriptorName

public java.lang.String getItemDescriptorName()
Get the value of itemDescriptorName.

Overrides:
getItemDescriptorName in class RepositoryFormHandler
Returns:
value of itemDescriptorName.

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Set the value of itemDescriptorName.

Overrides:
setItemDescriptorName in class RepositoryFormHandler
Parameters:
pItemDescriptorName - Value to assign to mItemDescriptorName.

initUsers

protected void initUsers()
Allocates the list of user profiles being created by this form handler


beforeSet

public boolean beforeSet(DynamoHttpServletRequest request,
                         DynamoHttpServletResponse response)
                  throws DropletFormException
Description copied from class: GenericFormHandler
Called before any setX methods on this form are set when a form that modifies properties of this form handler is submitted.

Specified by:
beforeSet in interface DropletFormHandler
Overrides:
beforeSet in class MultiProfileForm
Returns:
true if form processing should continue, false if it should be aborted
Throws:
DropletFormException

createUserListItemObject

protected atg.userprofiling.UserListItem createUserListItemObject()
                                                           throws java.lang.ClassNotFoundException,
                                                                  java.lang.InstantiationException,
                                                                  java.lang.IllegalAccessException
This method acts as a factory method for creating the result object that will be used by this processor. It instantiates whatever Class is specified by the getUserListItemObject method.

Returns:
a UserListItem value
Throws:
java.lang.ClassNotFoundException - if an error occurs
java.lang.InstantiationException - if an error occurs
java.lang.IllegalAccessException - if an error occurs

handleCreate

public boolean handleCreate(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Takes the current list of users in the users and for each one, replicates the set of common property values set as members of the value property and, if there were no errors in submitting the form, creates a new repository item, sets these property values in the new item, and adds the item persistently to the repository. An auto-generated unique id is used as the repositoryId unless the user.repositoryId has been set. The repositoryId is set to point to the repository id of the newly created item.

Prior to creating the list of users, preCreate is called and following the create of the list of users, postCreate is called.

Prior to creating an individual user, preCreateUser is called and following the create of each user, postCreateUser is called.

If any errors occur in the process, form errors will be added. If there were no errors encountered while submitting the form, we optionally redirect to the value of the property createSuccessURL. Otherwise, we optionally redirect to createErrorURL.

Overrides:
handleCreate in class RepositoryFormHandler
Throws:
javax.servlet.ServletException
java.io.IOException

userAlreadyExists

protected boolean userAlreadyExists(Repository pProfileRepository,
                                    RepositoryFormHandler pFormHandler,
                                    int pUserIndex,
                                    DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws RepositoryException,
                                    javax.servlet.ServletException,
                                    java.io.IOException
Returns true if a user already exists with the given login name

Parameters:
pProfileRepository - the repository to search for the pre-existing user
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
RepositoryException - if there was an error while accessing the Profile Repository
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

mergeValueDictionaries

protected boolean mergeValueDictionaries(java.util.Dictionary pCommonValues,
                                         java.util.Dictionary pUserValues,
                                         RepositoryFormHandler pFormHandler,
                                         int pUserIndex,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse,
                                         java.lang.String pPropertyPathPrefix)
Merges the common value dictionary into the user-specific value dictionary.


handleCancel

public boolean handleCancel(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Resets the current list of users in the users to initialize them to null to clear out the form data that hasn't been submitted yet.

Overrides:
handleCancel in class GenericFormHandler
Throws:
javax.servlet.ServletException
java.io.IOException

handleClear

public boolean handleClear(DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Resets the current list of users in the users to initialize them to null to clear out the form data that hasn't been submitted yet. This is identical to the Cancel submit method - to be used in beginning of form to clear out the leftover data in session scoped form handler objects.

Overrides:
handleClear in class MultiProfileForm
Throws:
javax.servlet.ServletException
java.io.IOException

preCreate

protected void preCreate(DynamoHttpServletRequest pRequest,
                         DynamoHttpServletResponse pResponse)
                  throws javax.servlet.ServletException,
                         java.io.IOException
This method is called at the beginning of the creation process prior to creating the individual users.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

postCreate

protected void postCreate(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
This method is called just after the creation process is finished.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

preCreateUser

protected void preCreateUser(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
This method is called just before an individual user is created.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

createUser

protected void createUser(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
This method handles the creation of an individual user. Presently, we simply call handleCreate on the current UserListItem object

Parameters:
pRequest - the request associated with this form submission
pResponse - the response associated with this form submission
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

postCreateUser

protected void postCreateUser(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
This method is called just after an individual user is created.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io