|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.droplet.EmptyFormHandler atg.droplet.GenericFormHandler atg.droplet.TransactionalFormHandler atg.userdirectory.droplet.CreateOrganizationFormHandler
public class CreateOrganizationFormHandler
This formhandler is used to create a new organization
in the user directory. Since the
interface does not provide factory
methods to create new organizations, we rely on a concrete implementation
to create the Organizations. This is the
UserDirectory
getRepositoryUserDirectory
method.
In addition to creating a new organization the following properties
can be set on the organization
The following properties will typically be set in a properties file
The formhandler supports the following submit methods
repositoryUserDirectory
as the means to create
the new organization.
The following properties might be set in the jhtml page
functionNames
string array.
assignableFunctionNames
will be
assigned to a user.
assignableFunctionNames
will be assigned to.
RepositoryUserDirectory
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static java.lang.String |
ERR_NO_ORG_DESC
|
static java.lang.String |
ERR_NO_ORG_NAME
|
static java.lang.String |
ERR_NO_PARENT_ORG_ID
|
static java.lang.String |
ERR_NO_USER_PKEY
|
static java.lang.String |
ERR_ORG_ALREADY_EXISTS
|
static java.lang.String |
ERR_UNABLE_ASSIGN_REL_ROLE
|
static java.lang.String |
ERR_UNABLE_TO_ADD_ORG
|
static java.lang.String |
ERR_UNABLE_TO_ASSIGN_ROLES
|
static java.lang.String |
ERR_UNABLE_TO_CREATE_ROLES
|
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.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 | |
---|---|
CreateOrganizationFormHandler()
|
Method Summary | |
---|---|
protected void |
addFormException(java.lang.String pErrorKey,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Adds a form exception to the formhandler. |
protected void |
assignRelativeRoles(Organization pOrganization,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will assign relativeRoles to the user whose primary key is returned by the #getUserId
method. |
protected void |
createOrganization(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is responsible for creating a new organization. |
protected void |
createRelativeRoles(Organization pOrganization,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method creates relative roles for a particular organization. |
java.lang.String[] |
getAssignableFunctionNames()
Lists the relativeRoles that should be assigned to a particular user. |
java.lang.String |
getCreateOrganizationErrorURL()
URL to redirect to on error. |
java.lang.String |
getCreateOrganizationSuccessURL()
URL to redirect to on success. |
java.lang.String[] |
getFunctionNames()
The list of fucntion names. |
protected java.util.Locale |
getLocale(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns either the Locale from the Request object (if it isn't NULL), or the Locale from the JVM. |
Organization |
getOrganization()
Return the organization property. |
java.lang.String |
getOrganizationDescription()
The description of the organization that is going to be created |
java.lang.String |
getOrganizationName()
The name of the organization that is going to be created |
java.lang.String |
getParentOrganizationId()
The id of the organization that will act as the parent for the newly created organization. |
RepositoryUserDirectory |
getRepositoryUserDirectory()
References the userDirectory that will be used to create and manipulate organizations. |
java.lang.String |
getStringResource(java.lang.String pResourceName,
java.util.Locale pLocale)
This method acts as a utility method to obtain a given resource for a particular key. |
java.lang.String |
getUserId()
The user who will get assigned relativeRoles if the assignRelativeRoles property is set to true. |
java.lang.String |
getUserLocale()
Return the userLocale property. |
boolean |
handleCreateOrganization(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is responsible for creating a new organization. |
boolean |
isAssignRelativeRoles()
Indicates whether or not relativeRoles should be assigned to the user specified by the userId property. |
boolean |
isCreateRelativeRoles()
Indicates whether or not relativeRoles should be created for a particular organization/function combination. |
boolean |
isOrgDescriptionRequired()
Indicates whether or not an organization description is required or not. |
boolean |
isOrgNameRequired()
Indicates whether or not an organization name is required. |
boolean |
isParentOrgRequired()
Indicats whether or not a parentOrg is required in order to create a new organization. |
void |
postCreateOrganization(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This is called after all work is done by the
handleCreateOrganization method. |
void |
preCreateOrganization(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Called before any work is done by the handleCreateOrganization
method. |
void |
setAssignableFunctionNames(java.lang.String[] pAssignableFunctionNames)
Set the assignableFunctionNames property. |
void |
setAssignRelativeRoles(boolean pAssignRelativeRoles)
Set the assignRelativeRoles property. |
void |
setCreateOrganizationErrorURL(java.lang.String pCreateOrganizationErrorURL)
Set the createOrganizationErrorURL property. |
void |
setCreateOrganizationSuccessURL(java.lang.String pCreateOrganizationSuccessURL)
Set the createOrganizationSuccessURL property. |
void |
setCreateRelativeRoles(boolean pCreateRelativeRoles)
Set the createRelativeRoles property. |
void |
setFunctionNames(java.lang.String[] pFunctionNames)
Set the FunctionNames property. |
void |
setOrganization(Organization pOrganization)
Set the organization property. |
void |
setOrganizationDescription(java.lang.String pOrganizationDescription)
Set the OrganizationDescription property. |
void |
setOrganizationName(java.lang.String pOrganizationName)
Set the OrganizationName property. |
void |
setOrgDescriptionRequired(boolean pOrgDescriptionRequired)
Set the orgDescriptionRequired property. |
void |
setOrgNameRequired(boolean pOrgNameRequired)
Set the orgNameRequired property. |
void |
setParentOrganizationId(java.lang.String pParentOrganizationId)
Set the ParentOrganizationId property. |
void |
setParentOrgRequired(boolean pParentOrgRequired)
Set the parentOrgRequired property. |
void |
setRepositoryUserDirectory(RepositoryUserDirectory pRepositoryUserDirectory)
Set the RepositoryUserDirectory property. |
protected void |
setRollbackOnly()
This method will call the setRollbackTransaction
method on the superclass. |
void |
setUserId(java.lang.String pUserId)
Set the userId property. |
void |
setUserLocale(java.lang.String pUserLocale)
Set the userLocale property. |
Methods inherited from class atg.droplet.EmptyFormHandler |
---|
afterGet, beforeGet |
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 |
---|
public static java.lang.String CLASS_VERSION
public static final java.lang.String ERR_ORG_ALREADY_EXISTS
public static final java.lang.String ERR_NO_ORG_NAME
public static final java.lang.String ERR_NO_ORG_DESC
public static final java.lang.String ERR_NO_PARENT_ORG_ID
public static final java.lang.String ERR_UNABLE_TO_ADD_ORG
public static final java.lang.String ERR_NO_USER_PKEY
public static final java.lang.String ERR_UNABLE_TO_ASSIGN_ROLES
public static final java.lang.String ERR_UNABLE_TO_CREATE_ROLES
public static final java.lang.String ERR_UNABLE_ASSIGN_REL_ROLE
Constructor Detail |
---|
public CreateOrganizationFormHandler()
Method Detail |
---|
public Organization getOrganization()
createOrganization()
method. This allows later functions
such as postCreateOrganization to access the newly created organization.
This method should not be set via jhtml or properties file
public void setOrganization(Organization pOrganization)
pOrganization
- public java.lang.String getUserId()
assignRelativeRoles
property is set to true. The id
value of this property is used to lookup the user in the userdirectory
by their primaryKey.
public void setUserId(java.lang.String pUserId)
pUserId
- public boolean isCreateRelativeRoles()
public void setCreateRelativeRoles(boolean pCreateRelativeRoles)
pCreateRelativeRoles
- public boolean isAssignRelativeRoles()
userId
property. This
defaults to true.
public void setAssignRelativeRoles(boolean pAssignRelativeRoles)
pAssignRelativeRoles
- public java.lang.String[] getAssignableFunctionNames()
public void setAssignableFunctionNames(java.lang.String[] pAssignableFunctionNames)
pAssignableFunctionNames
- public java.lang.String[] getFunctionNames()
public void setFunctionNames(java.lang.String[] pFunctionNames)
pFunctionNames
- public boolean isOrgNameRequired()
public void setOrgNameRequired(boolean pOrgNameRequired)
pOrgNameRequired
- public boolean isOrgDescriptionRequired()
public void setOrgDescriptionRequired(boolean pOrgDescriptionRequired)
pOrgDescriptionRequired
- public boolean isParentOrgRequired()
public void setParentOrgRequired(boolean pParentOrgRequired)
pParentOrgRequired
- public java.lang.String getUserLocale()
public void setUserLocale(java.lang.String pUserLocale)
pUserLocale
- public java.lang.String getCreateOrganizationSuccessURL()
public void setCreateOrganizationSuccessURL(java.lang.String pCreateOrganizationSuccessURL)
pCreateOrganizationSuccessURL
- public java.lang.String getCreateOrganizationErrorURL()
public void setCreateOrganizationErrorURL(java.lang.String pCreateOrganizationErrorURL)
pCreateOrganizationErrorUR
- public java.lang.String getOrganizationName()
public void setOrganizationName(java.lang.String pOrganizationName)
pOrganizationName
- public java.lang.String getOrganizationDescription()
public void setOrganizationDescription(java.lang.String pOrganizationDescription)
pOrganizationDescription
- public java.lang.String getParentOrganizationId()
public void setParentOrganizationId(java.lang.String pParentOrganizationId)
pParentOrganizationId
- public RepositoryUserDirectory getRepositoryUserDirectory()
public void setRepositoryUserDirectory(RepositoryUserDirectory pRepositoryUserDirectory)
pRepositoryUserDirectory
- public void preCreateOrganization(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
handleCreateOrganization
method. This currently does nothing.
pRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
value
javax.servlet.ServletException
- if an error occurs
java.io.IOException
- if an error occurspublic void postCreateOrganization(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
handleCreateOrganization
method. This will
first check to see if the createRelativeRoles
method
should be invoked by checking the createRelativeRoles property.
After creatRelativeRoles is optionally called, the method
will see if the transaction is rolled back. If it is not then
it will see if it should invoke the assignRelativeRoles
by checking the assignRelativeRoles property.
pRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
value
javax.servlet.ServletException
- if an error occurs
java.io.IOException
- if an error occursprotected void createRelativeRoles(Organization pOrganization, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
This method creates relative roles by iterating through
the list of functions listed in the functionNames
property. This roles are created relative to the
pOrganization
parameter.
If an error is encountered, the transaction will be marked for rollback and a droplet exception will be generated.
pOrganization
- organization for w2hich relative roles
will be createdpRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
valueprotected void assignRelativeRoles(Organization pOrganization, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
#getUserIdgetUserId
method.
After the user is extracted from the userDirectory via
the primaryKey, the values returned by the
assignableFunctionNames
method will be used
to get relativeRoles from the organization and then assign
them to the user.
pOrganization
- the organization that the roles should be relative topRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
valuepublic boolean handleCreateOrganization(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
preCreateOrganization,
createOrganization, and postCreateOrganization
methods.
If a form error is ever generated, the method will redirect
to the createOrganizationErrorURL
. After all processing
is done by the form the form will redirect to either the
createOrganizationErrorURL
or the
createOrganizationSuccessURL
.
pRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
value
boolean
value
javax.servlet.ServletException
- if an error occurs
java.io.IOException
- if an error occursprotected void createOrganization(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
If any of the above checks fail, a droplet exception will be generated specifying what piece of information was missing and will return from the method.
Next the organization will be created using the
repositoryUserDirectory
property. If an organization
is successfully created, the
method will be called. Setting
the organization for the remainder of the formhandlers lifetime
allows later methods, such as the postCreateOrganization method
to access the organization.
setOrganization
pRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
valueprotected void addFormException(java.lang.String pErrorKey, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
pErrorKey
to obtain a resource using the getStringResource
method.
pErrorKey
- the resource keypRequest
- a DynamoHttpServletRequest
valuepResponse
- a DynamoHttpServletResponse
valueprotected java.util.Locale getLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
pRequest
- the servlet's request
public java.lang.String getStringResource(java.lang.String pResourceName, java.util.Locale pLocale)
pResourceName
- the resource key used to obtain the resourcepLocale
- the users locale for which the resource bundle will be
obtained.
protected void setRollbackOnly()
setRollbackTransaction
method on the superclass. Indicating that the transaction
should be rolled back.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |