|
|||||||||
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.repository.servlet.RepositoryFormHandler atg.projects.b2bstore.repository.B2BRepositoryFormHandler
public class B2BRepositoryFormHandler
This form handler extends RepositoryFormHandler to provide automatic management of relationships between existing repository items and repository items that are created and removed by this form handler.
For example, you can use this form handler to manage the relationship between organizations and billing addresses, automatically adding each a billing address that is created to a parent organization's list of billing addresses, and automatically removing that address from the parent organization's list when it is removed from the repository.
You use this form handler by configuring the repository id and item descriptor type of the parent item whose properties you want to manage, and configuring the name of the property you want to update when a repository item is created or deleted. This configuration is typically performed using hidden input fields in your jhtml pages, since each use of the form handler may affect a different parent item and a different property of that item.
The following properties will typically be set in a properties file
The following properties will typically be set in a jhtml file
RepositoryFormHandler
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
MY_RESOURCE_NAME
|
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, RESOURCE_BUNDLE_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 | |
---|---|
B2BRepositoryFormHandler()
|
Method Summary | |
---|---|
protected void |
addItemToProperty(RepositoryItem pItem,
java.lang.Object updatableProperty)
Based on whether the argument is of type Map or Collection, this method calls addToMap or addToCollection respectively. |
protected void |
addToCollection(RepositoryItem pItem,
java.util.Collection updatableProperty)
This method adds the newly created repository item to the Collection property of the updateRepositoryItem. |
protected void |
addToMap(RepositoryItem pItem,
java.util.Map updatableProperty)
This method adds the newly created repository item to the Map property of the updateRepositoryItem. |
protected void |
checkForRequiredProperties(DynamoHttpServletRequest pRequest)
Makes sure all the required repository item properties have values submitted in the form. |
protected void |
deleteItem(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Override deleteItem method to check for references to the item being deleted by other repository items. |
protected RepositoryItem |
getCurrentItem()
Get the repository item that this form is operating on. |
protected java.util.Locale |
getLocale(DynamoHttpServletRequest pRequest)
Get the locale to use for user-visible error messages. |
protected java.lang.String |
getMsgResource(java.lang.String pMessageKey,
DynamoHttpServletRequest pRequest)
Return a message from a resource file, taking into account the locale used for user-visible messages. |
protected java.lang.String |
getMsgResource(java.lang.String pMessageKey,
DynamoHttpServletRequest pRequest,
java.lang.Object pArg)
Return a message from a resource file, taking into account the locale used for user-visible messages and substituting the value of a specified argument for the {0} placeholder in the message text. |
java.lang.String[] |
getRequiredFields()
Return the list of required property names. |
static java.lang.String |
getResourceBundleName()
Return the name of the resource bundle to use for this class. |
protected MutableRepositoryItem |
getUpdatableItem()
Get a mutable version of the repository item whose id updateRepositoryId and whose type is
updateItemDescriptorName . |
protected java.lang.Object |
getUpdatableProperty()
Get the property of the update repository item that is to be updated when a new repository item is created. |
java.lang.String |
getUpdateItemDescriptorName()
Return the item descriptor name for the item specified by updateRepositoryId . |
java.lang.String |
getUpdateKey()
Return the key that identifies the map entry to modify, in cases where updatePropertyName specifies a map-valued property. |
java.lang.String |
getUpdatePropertyName()
Return the property of the update item to modify when this form handler creates or deletes a repository item. |
java.lang.String |
getUpdateRepositoryId()
Return the repository id of a "container" or "parent" item that may be updated automatically whenever a repository item is created or deleted by this form handler. |
java.lang.String |
getUserLocale()
Return the preferred Locale for user-vislble error messages. |
static boolean |
isBlank(java.lang.String pStr)
Return true if pStr is null, the empty string, or consists entirely of whitespace where whitespace is defined by the String.trim method. |
protected void |
postCreateItem(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is called just after a new repository item has been created to add the new item to some property of the update item. |
protected void |
preCreateItem(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is called just before the item creation process is started to verify that all required properties have been specified in the form. |
protected void |
preDeleteItem(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is called just before a repository item is deleted to remove the item from some property of the update item. |
protected void |
preUpdateItem(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method is called just before the an item is updated to verify that all required properties have been specified in the form. |
protected void |
removeFromCollection(RepositoryItem pItem,
java.util.Collection updatableProperty)
This method removes a specified repository item from a specified collection. |
protected void |
removeFromMap(RepositoryItem pItem,
java.util.Map updatableProperty)
This method removes a specified repository item from a specified map. |
protected void |
removeItemFromProperty(RepositoryItem pItem,
java.lang.Object updatableProperty)
Based on whether the argument is of type Map or Collection, this method calls removeFromMap or removeFromCollection respectively. |
void |
setRequiredFields(java.lang.String[] pRequiredFields)
Specify a list of property names that must be set by the form using this form handler. |
void |
setUpdateItemDescriptorName(java.lang.String pUpdateItemDescriptorName)
Set the item descriptor name for the item specified by updateRepositoryId . |
void |
setUpdateKey(java.lang.String pUpdateKey)
Set the key that identifies the map entry to modify, in cases where updatePropertyName specifies a map-valued property. |
void |
setUpdatePropertyName(java.lang.String pPropertyName)
Set the property of the update item to modify when this form handler creates or deletes a repository item. |
void |
setUpdateRepositoryId(java.lang.String pUpdateRepositoryId)
Set the repository id of a "container" or "parent" item that may be updated automatically whenever a repository item is created or deleted by this form handler. |
void |
setUserLocale(java.lang.String pUserLocale)
Set the preferred Locale for user-vislble error messages. |
Methods inherited from class atg.droplet.EmptyFormHandler |
---|
afterGet, beforeGet |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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 MY_RESOURCE_NAME
Constructor Detail |
---|
public B2BRepositoryFormHandler()
Method Detail |
---|
public java.lang.String getUpdateRepositoryId()
public void setUpdateRepositoryId(java.lang.String pUpdateRepositoryId)
public java.lang.String getUpdateItemDescriptorName()
updateRepositoryId
.
public void setUpdateItemDescriptorName(java.lang.String pUpdateItemDescriptorName)
updateRepositoryId
.
public java.lang.String getUpdatePropertyName()
updateRepositoryId
refers to a repository item of
type Organization, and the updatePropertyName
is
billingAddresses, then creating a new repository item
will automatically add it to that organization's
billingAddresses
property, and removing a repository
item will automatically remove it from that organization's
billingAddresses
.
public void setUpdatePropertyName(java.lang.String pPropertyName)
public java.lang.String getUpdateKey()
updatePropertyName
specifies a map-valued property.
public void setUpdateKey(java.lang.String pUpdateKey)
updatePropertyName
specifies a map-valued property.
public java.lang.String[] getRequiredFields()
public void setRequiredFields(java.lang.String[] pRequiredFields)
public java.lang.String getUserLocale()
public void setUserLocale(java.lang.String pUserLocale)
public static java.lang.String getResourceBundleName()
protected void checkForRequiredProperties(DynamoHttpServletRequest pRequest)
RepositoryException
- if there was an error while
accessing the repositoryprotected void preCreateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
preCreateItem
in class RepositoryFormHandler
pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing
the code
java.io.IOException
- if there was an error with servlet ioprotected void preUpdateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
preUpdateItem
in class RepositoryFormHandler
pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing
the code
java.io.IOException
- if there was an error with servlet ioprotected void postCreateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
updateRepositoryId
and the property identified by updatePropertyName
, then
calls addItemToProperty
to add the new item to the named
property of the existing item.
postCreateItem
in class RepositoryFormHandler
pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing
the code
java.io.IOException
- if there was an error with servlet ioprotected void preDeleteItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
updateRepositoryId
and the property identified by
updatePropertyName
, then calls
removeItemFromProperty
to remove the item being
deleted from that property of the existing item.
preDeleteItem
in class RepositoryFormHandler
pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing
the code
java.io.IOException
- if there was an error with servlet ioprotected void deleteItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
deleteItem
in class RepositoryFormHandler
pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing
the code
java.io.IOException
- if there was an error with servlet ioprotected void addItemToProperty(RepositoryItem pItem, java.lang.Object updatableProperty)
protected void addToMap(RepositoryItem pItem, java.util.Map updatableProperty)
protected void addToCollection(RepositoryItem pItem, java.util.Collection updatableProperty)
protected void removeItemFromProperty(RepositoryItem pItem, java.lang.Object updatableProperty)
protected void removeFromMap(RepositoryItem pItem, java.util.Map updatableProperty)
protected void removeFromCollection(RepositoryItem pItem, java.util.Collection updatableProperty)
protected RepositoryItem getCurrentItem() throws RepositoryException
RepositoryException
protected MutableRepositoryItem getUpdatableItem() throws RepositoryException
updateRepositoryId
and whose type is
updateItemDescriptorName
.
RepositoryException
protected java.lang.Object getUpdatableProperty() throws RepositoryException
RepositoryException
protected java.lang.String getMsgResource(java.lang.String pMessageKey, DynamoHttpServletRequest pRequest)
atg.core.util.getMsgResource
protected java.lang.String getMsgResource(java.lang.String pMessageKey, DynamoHttpServletRequest pRequest, java.lang.Object pArg)
atg.core.util.getMsgResource
protected java.util.Locale getLocale(DynamoHttpServletRequest pRequest)
userLocale
property if set, otherwise
returns the request locale from pRequest
if set, otherwise
returns the default server locale.
public static boolean isBlank(java.lang.String pStr)
String
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |