atg.repository.servlet
Class RepositoryFormHandler

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
All Implemented Interfaces:
DropletFormHandler, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, RepositoryFormConstants, RepositoryFormData, java.util.EventListener
Direct Known Subclasses:
B2BRepositoryFormHandler, MultiProfileForm, RepositoryAssetFormHandler, ScheduledOrderHandler, WorkflowTaskFormSubject, XMLRepositoryFormHandler

public class RepositoryFormHandler
extends GenericFormHandler
implements RepositoryFormData, RepositoryFormConstants

This is a form handler for operating on repository items. It can be used to create new repository items, update existing items, and delete items from the repository.

This bean has a repositoryId property which determines the repository item being operated on by the form handler. It also has a value property which is a dictionary of properties of the current repository item. For example, if you want to get or set the "author" property of a repository item with id "/targetedcontent/Example.html," you would set repositoryId to "/targetedcontent/Example.html," and reference the item's "author" property in the page as "FormHandler.value.author."

Note that since the value property contains the property values corresponding to the repository item with the current repository id, setting the repositoryId property also has the effect of removing all entries from the value dictionary. The new entries are then added to the dictionary as the property values are accessed/set for the new repository item.

This form handler supports the following submit methods:

create
creates a new repository item with the id specified via the repositoryId property, assigning it the property values currently in the value dictionary, and adds the new item to the repository; if repositoryId is not set, the new item is created with an id auto-generated by the repository, assuming requireIdOnCreate is set to false (see below)
update
updates the repository item specified via the repositoryId property, using the property values currently in the value dictionary; the update is committed in the repository
delete
deletes the repository item specified via the repositoryId property from the repository

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

repository
Specifies the repository to operate on.
itemDescriptorName
Specifies the item descriptor that describes the repository items being operated on. For example, new items being added to the repository will be created with the given item desciptor; items being updated are expected to have the given item descriptor. If not specified, the item descriptor associated with the default repository view will be used.
checkForRequiredProperties
Specifies whether the form handler should check that all the required properties are present during create/update operations. If true, an error will be raised for any required property that is missing. Default is true.
requireIdOnCreate
If true, a repository id must be specified when new items are created, or an error will be raised. If false, and the repository id is not specified, an id for the new item will be auto-generated by the repository. Default is true.
extractDefaultValuesFromItem
Specifies whether property values should be extracted from a repository item if they do not have values specified in the form. Sometimes this property is set in jhtml rather than the properties file: for example, a jhtml page that updates existing repository items might set this property to true so that the current item's property values are displayed, while a jhtml page for creating new items might set it to false. Default is true.
createTransientItems
Specifies whether the form handler creates transient items. Items are created but not persisted used addItem. Default is false.

The RepositoryFormHandler also has a set of properties that are used to control navigation after a form operation (create, update, delete) has been completed. These properties specify the URLs to redirect on certain error and success conditions. If the value for a particular condition is not set, the form is left on the page defined as the action for that form (i.e. no redirect takes place). Each operation has its own SuccessURL and ErrorURL properties. Thus the following properties are available:

You can either specify the values of these URLs in the .properties file of the form handler, or you can set them in the jhtml file itself using a hidden tag. For example:
 <input type=hidden bean="FormHandler.createSuccessURL" value="main.jhtml">
 

This form handler also supports the editing of hierarchial properties. In other words properties you can edit properties whose values are themselves other items. To edit the properties of your property, simply specify the names of these properties separated by a "." character. For example, if your item has an address item property, you can set its city sub-property with a tag like:

 <input type="text" bean="FormHandler.value.address.city" >
 
If you have the id of an address, perhaps as a property of some bean and you want to update your item so that it refers to that new item, you can change the special repositoryId sub-property of the address as in this construct:
 <input type="hidden" bean="FormHandler.value.address.repositoryId"
     value="bean:SomeBean.addressId">
 
If the addressId does not correspond to a valid address, an error with the message code "noRepositoryId" error is added to the list of errors for this request.

Migration history:


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static int STATUS_ERROR_REDIRECT
          Constant used to indicate that the form has errors, and that the form should perform a redirect.
static int STATUS_ERROR_STAY
          Constant used to indicate that the form has errors, and that the form should not perform a redirect.
static int STATUS_SUCCESS
          Constant used to indicate that the form has no errors
 
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
RepositoryFormHandler()
           
 
Method Summary
protected  int checkFormError(java.lang.String pErrorURL, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Check to see if there were errors during the submit operation.
protected  boolean checkFormSuccess(java.lang.String pSuccessURL, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          If the form was successfully submitted, redirect after processing the form data if possible.
protected  void checkForRequiredProperties(RepositoryItem pItem)
          Makes sure all the required repository item properties have values submitted in the form.
protected  void deleteItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deletes the item given by the current repository id from the repository.
 boolean getCheckForReadOnlyProperties()
          Returns whether or not the form handler should throw an exception when updating item properties and read only properties are in the value dictionary.
 boolean getCheckForRequiredProperties()
          Returns whether or not the form handler should check that all the required properties are present during the create/update operations.
protected  atg.repository.content.ContentPropertyItemDescriptor getContentItemDescriptor()
          Obtain the content item descriptor
 java.lang.String getContentNameProperty()
          Get the contentNameProperty.
 java.lang.String getContentPathProperty()
          Get the contentPathProperty.
 java.lang.String getCreateErrorURL()
          Returns the URL to redirect to upon a failed item creation.
 java.lang.String getCreateSuccessURL()
          Returns the URL to redirect to upon a successful item creation.
 java.lang.String getDeleteErrorURL()
          Returns the URL to redirect to upon a failed item deletion.
 java.lang.String getDeleteSuccessURL()
          Returns the URL to redirect to upon a successful item deletion.
 boolean getEditMapsAsLists()
          Gets the property EditMapsAsLists.
 atg.repository.servlet.RepositoryEditorErrorHandler getErrorHandler()
          Return an object responsible for handling form errors
 boolean getExtractDefaultValuesFromItem()
          Returns whether or not property values should be extracted from a repository item if they do not have values specified in the form.
 java.lang.String getFolderIdProperty()
          Get the folderIdPropertyName.
 RepositoryItemDescriptor getItemDescriptor()
          Returns the repository item descriptor used by this form handler.
 java.lang.String getItemDescriptorName()
          Returns the name of the repository item descriptor used by this form handler (e.g., to create/add items to the repository).
protected  java.lang.Object getItemProperty(java.lang.String pPropertyName)
          If the repositoryId property is set, returns the value of the corresponding item's property.
 ApplicationLogging getLogger()
          Return logger
 java.lang.String getMapKeyValueSeparator()
          Gets the property MapKeyValueSeparator.
 boolean getRemoveReferencesToDeletedItems()
           
 MutableRepository getRepository()
          Returns the repository this form handler operates over.
 java.lang.String getRepositoryId()
          Returns the repository id of the item being manipulated.
 RepositoryItem getRepositoryItem()
          Returns the repository item (if any) to edit from this form handler This is retrieved based on the repository, itemDescriptorName, and repositoryId properties;
 atg.repository.servlet.RepositoryItemEditor getRepositoryItemEditor()
          Get the repository item editor
 java.lang.String getRepositoryPathName()
           
 boolean getRequireIdOnCreate()
          Returns true if a repository id must be specified when new items are created, false otherwise.
protected  java.lang.Object getSpecifiedIdPropertyValue()
          Return the id property value if it has been specified explicitly, otherwise return null.
protected  TransactionDemarcation getTransactionDemarcation()
          Returns the transaction demaraction for this form handler
protected  javax.transaction.TransactionManager getTransactionManager()
          Returns the transaction manager for the repository that we are using
 java.lang.String[] getTrimProperties()
          Returns property TrimProperties
 java.lang.String getUpdateErrorURL()
          Returns the URL to redirect to upon a failed item update.
 java.lang.String getUpdateSuccessURL()
          Returns the URL to redirect to upon a successful item update.
 java.util.Dictionary getValue()
          Returns a dictionary that stores the pending property values associated with an operation on the repository item (e.g.
protected  java.lang.Object getValueProperty(java.lang.String pName)
          Returns the value of a property from the value Dictionary.
 boolean handleCreate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Takes the current set of 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.
 boolean handleDelete(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deletes the item specified by the repositoryId property from the repository.
 boolean handleUpdate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Takes the current set of property values set as members of the value property and, if there were no errors in submitting the form, modifies the item described by the repositoryId property with these values.
 boolean isClearValueOnSet()
          Returns value of ClearValueOnSet property
 boolean isCreateTransientItems()
          Returns property CreateTransientItems.
 boolean isRequireMapKeys()
          Indicates if the form should require keys for all entries in Map properties.
 boolean isSortRepositoryItemSets()
          Indicates if the form should display Sets of RepositoryItems sorted according to their display names.
 boolean isTrimProperty(java.lang.String pProperty)
          Tests whether pProperty should be trimmed or not
 boolean isUpdateItemsInCollection()
          Return a flag that indicates if the form should update individual collection items when updating a collection property.
protected  void postCreateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just after the item creation process is finished.
protected  void postDeleteItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just after the item is deleted from the repository.
protected  void postUpdateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just after the item is updated.
protected  void postUpdateItemProperties(MutableRepositoryItem pItem)
          This method is called just after the updateItemProperties is completed.
protected  void preCreateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just before the item creation process is started.
protected  void preDeleteItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just before the item is deleted from the repository.
protected  void preUpdateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called just before the item is updated.
 void setCheckForReadOnlyProperties(boolean pCheckForReadOnlyProperties)
          Sets whether or this form handler should throw an exception when updating item properties and read only properties are in the value dictionary.
 void setCheckForRequiredProperties(boolean pCheckForRequiredProperties)
          Sets whether or not the form handler should check that all the required properties are present during the create/update operations.
 void setClearValueOnSet(boolean pClearValueOnSet)
          Sets the clearValueOnSet property
 void setContentNameProperty(java.lang.String pContentNameProperty)
          set the contentNameProperty
 void setContentPathProperty(java.lang.String pContentPathProperty)
          set the contentPathProperty
 void setCreateErrorURL(java.lang.String pCreateErrorURL)
          Sets the URL to redirect to upon a failed item creation.
 void setCreateSuccessURL(java.lang.String pCreateSuccessURL)
          Sets the URL to redirect to upon a successful item creation.
 void setCreateTransientItems(boolean pCreateTransientItems)
          Sets property CreateTransientItems.
 void setDeleteErrorURL(java.lang.String pDeleteErrorURL)
          Sets the URL to redirect to upon a failed item deletion.
 void setDeleteSuccessURL(java.lang.String pDeleteSuccessURL)
          Sets the URL to redirect to upon a successful item deletion.
 void setEditMapsAsLists(boolean pEditMapsAsLists)
          Sets the property EditMapsAsLists.
 void setExtractDefaultValuesFromItem(boolean pExtractDefaultValuesFromItem)
          Sets whether or not property values should be extracted from a repository item if they do not have values specified in the form.
 void setFolderIdProperty(java.lang.String pFolderIdProperty)
          set the folderIdProperty
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
          Sets the name of the repository item descriptor used by this form handler (e.g., to create/add items to the repository).
 void setMapKeyValueSeparator(java.lang.String pMapKeyValueSeparator)
          Sets the property MapKeyValueSeparator.
 void setRemoveReferencesToDeletedItems(boolean pRemoveReferencesToDeletedItems)
          Sets the property RemoveReferencesToDeletedItems.
 void setRepository(MutableRepository pRepository)
          Sets the repository this form handler should operate over.
 void setRepositoryId(java.lang.String pId)
          Sets the repository id of the item to be manipulated.
 void setRepositoryItemEditor(atg.repository.servlet.RepositoryItemEditor pRepositoryItemEditor)
          Set the repository item editor
 void setRepositoryPathName(java.lang.String pRepositoryPathName)
          Sets the property RepositoryPathName.
 void setRequireIdOnCreate(boolean pRequireIdOnCreate)
          Sets whether a repository id must be specified when new items are created.
 void setRequireMapKeys(boolean pRequireMapKeys)
          Set a flag that indicates if the form should require keys for all entries in Map properties.
 void setSortRepositoryItemSets(boolean pSortRepositoryItemSets)
          Set a flag that indicates if the form should display Sets of RepositoryItems sorted according to their display names.
 void setTrimProperties(java.lang.String[] pTrimProperties)
          Sets property trimProperties.
 void setUpdateErrorURL(java.lang.String pUpdateErrorURL)
          Sets the URL to redirect to upon a failed item update.
 void setUpdateItemsInCollection(boolean pUpdateItemsInCollection)
          Set a flag that indicates if the form should update individual collection items when updating a collection property.
 void setUpdateSuccessURL(java.lang.String pUpdateSuccessURL)
          Sets the URL to redirect to upon a successful item update.
protected  void setValueProperty(java.lang.String pName, java.lang.Object pValue)
          Sets the value of a property into the value Dictionary.
static boolean testPropertyAttribute(DynamicPropertyDescriptor pDpd, java.lang.String pAttrName, java.lang.String pTest)
          Test named attribute of specified property descriptor to see if it is equal to the value specified in pTest
protected  void updateChildItemProperty(RepositoryPropertyDescriptor pDesc, java.lang.Object pValue, java.lang.String pKey, MutableRepositoryItem pItem, java.lang.String pItemPath)
          Update single value property that is repository item
protected  void updateContentItemValues(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Update folder item properties such as path
protected  void updateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Updates the repository item given by the current repository id.
protected  void updateItemProperties(MutableRepositoryItem pItem, java.util.Dictionary pValues, java.lang.String pItemPath)
          Takes the current values of the value property and sticks them into the repository item given.
protected  void updateListProperty(MutableRepositoryItem pItem, RepositoryFormList pFormList)
          Goes through the set, array, or list property represented by the data we've collected from the RepositoryFormList object.
protected  void updateMapProperty(MutableRepositoryItem pItem, RepositoryFormMap pFormMap)
          Goes through the map property represented by the data we've collected from the RepositoryFormList object.
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, 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, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


STATUS_SUCCESS

public static final int STATUS_SUCCESS
Constant used to indicate that the form has no errors

See Also:
Constant Field Values

STATUS_ERROR_STAY

public static final int STATUS_ERROR_STAY
Constant used to indicate that the form has errors, and that the form should not perform a redirect.

See Also:
Constant Field Values

STATUS_ERROR_REDIRECT

public static final int STATUS_ERROR_REDIRECT
Constant used to indicate that the form has errors, and that the form should perform a redirect.

See Also:
Constant Field Values
Constructor Detail

RepositoryFormHandler

public RepositoryFormHandler()
Method Detail

getLogger

public ApplicationLogging getLogger()
Return logger

Specified by:
getLogger in interface RepositoryFormData
Returns:
the logger

getErrorHandler

public atg.repository.servlet.RepositoryEditorErrorHandler getErrorHandler()
Description copied from interface: RepositoryFormData
Return an object responsible for handling form errors

Specified by:
getErrorHandler in interface RepositoryFormData
Returns:
the form error handler

getRepositoryItemEditor

public atg.repository.servlet.RepositoryItemEditor getRepositoryItemEditor()
Get the repository item editor

Specified by:
getRepositoryItemEditor in interface RepositoryFormData
Returns:
the repository item editor

setRepositoryItemEditor

public void setRepositoryItemEditor(atg.repository.servlet.RepositoryItemEditor pRepositoryItemEditor)
Set the repository item editor

Parameters:
pRepositoryItemEditor - the object used to manipulate repository items

setCreateTransientItems

public void setCreateTransientItems(boolean pCreateTransientItems)
Sets property CreateTransientItems. If true, newly created items remain transient and are not persisted in the repository with a call to addItem.


isCreateTransientItems

public boolean isCreateTransientItems()
Returns property CreateTransientItems. If true, newly created items remain transient and are not persisted in the repository with a call to addItem.

Specified by:
isCreateTransientItems in interface RepositoryFormData
Returns:
true to create transient items

setRequireMapKeys

public void setRequireMapKeys(boolean pRequireMapKeys)
Set a flag that indicates if the form should require keys for all entries in Map properties.


isRequireMapKeys

public boolean isRequireMapKeys()
Indicates if the form should require keys for all entries in Map properties.

Specified by:
isRequireMapKeys in interface RepositoryFormData
Returns:
true to require map keys

setSortRepositoryItemSets

public void setSortRepositoryItemSets(boolean pSortRepositoryItemSets)
Set a flag that indicates if the form should display Sets of RepositoryItems sorted according to their display names.


isSortRepositoryItemSets

public boolean isSortRepositoryItemSets()
Indicates if the form should display Sets of RepositoryItems sorted according to their display names.

Specified by:
isSortRepositoryItemSets in interface RepositoryFormData
Returns:
true to sort Sets of RepositoryItems

setUpdateItemsInCollection

public void setUpdateItemsInCollection(boolean pUpdateItemsInCollection)
Set a flag that indicates if the form should update individual collection items when updating a collection property.


isUpdateItemsInCollection

public boolean isUpdateItemsInCollection()
Return a flag that indicates if the form should update individual collection items when updating a collection property.

Specified by:
isUpdateItemsInCollection in interface RepositoryFormData
Returns:
true if the individual collection items shoud be updated.

getRepository

public MutableRepository getRepository()
Returns the repository this form handler operates over. If you leave this as null, you can use the repositoryPathName as the way of specifying the repository to use. That method is more dynamic and allows you to create a form which sets the repository via a property in the form.

Specified by:
getRepository in interface RepositoryFormData
Returns:
the repository

setRepository

public void setRepository(MutableRepository pRepository)
Sets the repository this form handler should operate over.


setRepositoryPathName

public void setRepositoryPathName(java.lang.String pRepositoryPathName)
Sets the property RepositoryPathName. This is an alternative way to specify the repository definition. If you set a repositoryPathName property and leave the Repository property as null, this will be used as a path name of the repository component to use. This mechanism is more flexible as it lets you set the repository to edit from a form or parameter in the page.

Parameters:
pRepositoryPathName - new value to set

getRepositoryPathName

public java.lang.String getRepositoryPathName()
Returns:
The value of the property RepositoryPathName.

getItemDescriptorName

public java.lang.String getItemDescriptorName()
                                       throws RepositoryException
Returns the name of the repository item descriptor used by this form handler (e.g., to create/add items to the repository). If the descriptor name hasn't been explicitly set, returns the name of the item descriptor associated with the repository's default view.

Throws:
RepositoryException - if there was a repository error getting the item descriptor

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Sets the name of the repository item descriptor used by this form handler (e.g., to create/add items to the repository).


getItemDescriptor

public RepositoryItemDescriptor getItemDescriptor()
                                           throws RepositoryException
Returns the repository item descriptor used by this form handler. If the itemDescriptorName property is specified, returns the descriptor given by the item descriptor name. Otherwise, returns the item descriptor associated with the repository's default view.

Specified by:
getItemDescriptor in interface RepositoryFormData
Returns:
the item descriptor or null on error
Throws:
RepositoryException - if there was a repository error getting the item descriptor

getRepositoryId

public java.lang.String getRepositoryId()
Returns the repository id of the item being manipulated.

Specified by:
getRepositoryId in interface RepositoryFormData
Returns:
the repository ID

setRepositoryId

public void setRepositoryId(java.lang.String pId)
Sets the repository id of the item to be manipulated. This also clears the value dictionary, since the property values in it correspond to the item with the old repository id.


getValue

public java.util.Dictionary getValue()
Returns a dictionary that stores the pending property values associated with an operation on the repository item (e.g. create, update).

Specified by:
getValue in interface RepositoryFormData
Returns:
the value dictionary

getExtractDefaultValuesFromItem

public boolean getExtractDefaultValuesFromItem()
Returns whether or not property values should be extracted from a repository item if they do not have values specified in the form.

Specified by:
getExtractDefaultValuesFromItem in interface RepositoryFormData

setExtractDefaultValuesFromItem

public void setExtractDefaultValuesFromItem(boolean pExtractDefaultValuesFromItem)
Sets whether or not property values should be extracted from a repository item if they do not have values specified in the form.


getCheckForRequiredProperties

public boolean getCheckForRequiredProperties()
Returns whether or not the form handler should check that all the required properties are present during the create/update operations. If true, an error will be raised for any required property that is missing.

Specified by:
getCheckForRequiredProperties in interface RepositoryFormData
Returns:
true to force check for required properties

setCheckForRequiredProperties

public void setCheckForRequiredProperties(boolean pCheckForRequiredProperties)
Sets whether or not the form handler should check that all the required properties are present during the create/update operations. If true, an error will be raised for any required property that is missing.


getCheckForReadOnlyProperties

public boolean getCheckForReadOnlyProperties()
Returns whether or not the form handler should throw an exception when updating item properties and read only properties are in the value dictionary. Otherwise, read only properties are just skipped.

Specified by:
getCheckForReadOnlyProperties in interface RepositoryFormData

setCheckForReadOnlyProperties

public void setCheckForReadOnlyProperties(boolean pCheckForReadOnlyProperties)
Sets whether or this form handler should throw an exception when updating item properties and read only properties are in the value dictionary. Otherwise, read only properties are just skipped.


getTrimProperties

public java.lang.String[] getTrimProperties()
Returns property TrimProperties


setTrimProperties

public void setTrimProperties(java.lang.String[] pTrimProperties)
Sets property trimProperties. This names the attributes that should be trimmed before updating in the user's profile.


getRequireIdOnCreate

public boolean getRequireIdOnCreate()
Returns true if a repository id must be specified when new items are created, false otherwise. If false, and the repository id is not specified, an id for the new item will be auto-generated by the repository.


setRequireIdOnCreate

public void setRequireIdOnCreate(boolean pRequireIdOnCreate)
Sets whether a repository id must be specified when new items are created. If false, and the repository id is not specified, an id for the new item will be auto-generated by the repository.


setRemoveReferencesToDeletedItems

public void setRemoveReferencesToDeletedItems(boolean pRemoveReferencesToDeletedItems)
Sets the property RemoveReferencesToDeletedItems.

Parameters:
pRemoveReferencesToDeletedItems - new value to set

getRemoveReferencesToDeletedItems

public boolean getRemoveReferencesToDeletedItems()
Returns:
The value of the property RemoveReferencesToDeletedItems.

getCreateSuccessURL

public java.lang.String getCreateSuccessURL()
Returns the URL to redirect to upon a successful item creation.


setCreateSuccessURL

public void setCreateSuccessURL(java.lang.String pCreateSuccessURL)
Sets the URL to redirect to upon a successful item creation.


getCreateErrorURL

public java.lang.String getCreateErrorURL()
Returns the URL to redirect to upon a failed item creation.


setCreateErrorURL

public void setCreateErrorURL(java.lang.String pCreateErrorURL)
Sets the URL to redirect to upon a failed item creation.


getUpdateSuccessURL

public java.lang.String getUpdateSuccessURL()
Returns the URL to redirect to upon a successful item update.


setUpdateSuccessURL

public void setUpdateSuccessURL(java.lang.String pUpdateSuccessURL)
Sets the URL to redirect to upon a successful item update.


getUpdateErrorURL

public java.lang.String getUpdateErrorURL()
Returns the URL to redirect to upon a failed item update.


setUpdateErrorURL

public void setUpdateErrorURL(java.lang.String pUpdateErrorURL)
Sets the URL to redirect to upon a failed item update.


getDeleteSuccessURL

public java.lang.String getDeleteSuccessURL()
Returns the URL to redirect to upon a successful item deletion.


setDeleteSuccessURL

public void setDeleteSuccessURL(java.lang.String pDeleteSuccessURL)
Sets the URL to redirect to upon a successful item deletion.


getDeleteErrorURL

public java.lang.String getDeleteErrorURL()
Returns the URL to redirect to upon a failed item deletion.


setDeleteErrorURL

public void setDeleteErrorURL(java.lang.String pDeleteErrorURL)
Sets the URL to redirect to upon a failed item deletion.


isClearValueOnSet

public boolean isClearValueOnSet()
Returns value of ClearValueOnSet property


setClearValueOnSet

public void setClearValueOnSet(boolean pClearValueOnSet)
Sets the clearValueOnSet property


setEditMapsAsLists

public void setEditMapsAsLists(boolean pEditMapsAsLists)
Sets the property EditMapsAsLists. If you set this to true, the interface for editing maps is as list items using a special "keys" sub-property to define the key. If you set this to false, you edit maps "as is". This allows you to modify properties of existing map entries, but not to add new entries.

Parameters:
pEditMapsAsLists - new value to set

getEditMapsAsLists

public boolean getEditMapsAsLists()
Gets the property EditMapsAsLists. If this is true, the interface for editing maps is as list items using a special "keys" sub-property to define the key. If false, you edit maps "as is". This allows you to modify properties of existing map entries, but not to add new entries.

Specified by:
getEditMapsAsLists in interface RepositoryFormData
Returns:
The value of the property EditMapsAsLists.

setMapKeyValueSeparator

public void setMapKeyValueSeparator(java.lang.String pMapKeyValueSeparator)
Sets the property MapKeyValueSeparator. When editing components of type map, you can use the keyAndRepositoryIds property to set both the key and the map from a single form element. This string is used to separate the key from the repository id - for example: "key=10005" is an acceptable value if the KeyValueSeparator is "=".

Parameters:
pMapKeyValueSeparator - new value to set

getMapKeyValueSeparator

public java.lang.String getMapKeyValueSeparator()
Gets the property MapKeyValueSeparator. When editing components of type map, you can use the keyAndRepositoryIds property to set both the key and the map from a single form element. This string is used to separate the key from the repository id - for example: "key=10005" is an acceptable value if the KeyValueSeparator is "=".

Specified by:
getMapKeyValueSeparator in interface RepositoryFormData
Returns:
The value of the property MapKeyValueSeparator.

checkFormError

protected int checkFormError(java.lang.String pErrorURL,
                             DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Check to see if there were errors during the submit operation. If so, redirect to the supplied error url if possible.

Parameters:
pErrorURL - the URL to redirect to if there are any form errors
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
the status of the form, one of STATUS_SUCCESS, STATUS_ERROR_STAY, or STATUS_ERROR_REDIRECT
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

checkFormSuccess

protected boolean checkFormSuccess(java.lang.String pSuccessURL,
                                   DynamoHttpServletRequest pRequest,
                                   DynamoHttpServletResponse pResponse)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
If the form was successfully submitted, redirect after processing the form data if possible.

Parameters:
pSuccessURL - the URL to redirect to if the form was successfully submitted
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
false if we redirect, true if we don't redirect
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

getContentItemDescriptor

protected atg.repository.content.ContentPropertyItemDescriptor getContentItemDescriptor()
Obtain the content item descriptor


setContentPathProperty

public void setContentPathProperty(java.lang.String pContentPathProperty)
set the contentPathProperty


getContentPathProperty

public java.lang.String getContentPathProperty()
Get the contentPathProperty. Can be set in property files or derived from contentItemDescriptor


setContentNameProperty

public void setContentNameProperty(java.lang.String pContentNameProperty)
set the contentNameProperty


getContentNameProperty

public java.lang.String getContentNameProperty()
Get the contentNameProperty. Can be set in property files or derived from contentItemDescriptor


setFolderIdProperty

public void setFolderIdProperty(java.lang.String pFolderIdProperty)
set the folderIdProperty


getFolderIdProperty

public java.lang.String getFolderIdProperty()
Get the folderIdPropertyName. Can be set in property files or derived from contentItemDescriptor


getSpecifiedIdPropertyValue

protected java.lang.Object getSpecifiedIdPropertyValue()
                                                throws RepositoryException
Return the id property value if it has been specified explicitly, otherwise return null.

Throws:
RepositoryException - if there was an error while accessing the repository

checkForRequiredProperties

protected void checkForRequiredProperties(RepositoryItem pItem)
                                   throws RepositoryException
Makes sure all the required repository item properties have values submitted in the form. If any errors occur, form exceptions are added.

Parameters:
pItem - repository item being updated can be null if item is to be created
Throws:
RepositoryException - if there was an error while accessing the repository

isTrimProperty

public boolean isTrimProperty(java.lang.String pProperty)
Tests whether pProperty should be trimmed or not

Specified by:
isTrimProperty in interface RepositoryFormData
Parameters:
pProperty - the name of the property to check to be trimmed
Returns:
true if pProperty should be trimmed

getValueProperty

protected java.lang.Object getValueProperty(java.lang.String pName)
Returns the value of a property from the value Dictionary.


setValueProperty

protected void setValueProperty(java.lang.String pName,
                                java.lang.Object pValue)
Sets the value of a property into the value Dictionary. If pValue is null then the property defined by pName is removed from the value Dictionary.


getItemProperty

protected java.lang.Object getItemProperty(java.lang.String pPropertyName)
If the repositoryId property is set, returns the value of the corresponding item's property. Otherwise, tries to get the default property value from the item descriptor. Returns null if no property value is found.


getRepositoryItem

public RepositoryItem getRepositoryItem()
Returns the repository item (if any) to edit from this form handler This is retrieved based on the repository, itemDescriptorName, and repositoryId properties;

Specified by:
getRepositoryItem in interface RepositoryFormData
Returns:
the repository item or null

getTransactionManager

protected javax.transaction.TransactionManager getTransactionManager()
Returns the transaction manager for the repository that we are using


getTransactionDemarcation

protected TransactionDemarcation getTransactionDemarcation()
Returns the transaction demaraction for this form handler


handleCreate

public boolean handleCreate(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Takes the current set of 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. If the repositoryId property is specified in the form, the new item is created with the given repository id; otherwise, an auto-generated unique id is used. The repositoryId is set to point to the repository id of the newly created item.

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.

Throws:
javax.servlet.ServletException
java.io.IOException

preCreateItem

protected void preCreateItem(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
This method is called just before the item creation process is started.

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

postCreateItem

protected void postCreateItem(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
This method is called just after the item 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

handleUpdate

public boolean handleUpdate(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Takes the current set of property values set as members of the value property and, if there were no errors in submitting the form, modifies the item described by the repositoryId property with these values.

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 updateSuccessURL. Otherwise, we optionally redirect to updateErrorURL.

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

preUpdateItem

protected void preUpdateItem(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
This method is called just before the item is updated.

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

postUpdateItem

protected void postUpdateItem(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
This method is called just after the item is updated.

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

updateItem

protected void updateItem(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Updates the repository item given by the current repository id. Values stored in the value property are saved into the repository item. If any errors occur in the process, form errors will be added.

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

updateContentItemValues

protected void updateContentItemValues(DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
                                throws javax.servlet.ServletException,
                                       java.io.IOException
Update folder item properties such as path

Throws:
javax.servlet.ServletException
java.io.IOException

updateItemProperties

protected void updateItemProperties(MutableRepositoryItem pItem,
                                    java.util.Dictionary pValues,
                                    java.lang.String pItemPath)
                             throws RepositoryException
Takes the current values of the value property and sticks them into the repository item given. Adds form errors if there were any problems.

Parameters:
pItem - the mutable repository item to update
pValues - the values map
pItemPath - any subitem path
Throws:
RepositoryException - if there was an error while accessing the repository
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

updateChildItemProperty

protected void updateChildItemProperty(RepositoryPropertyDescriptor pDesc,
                                       java.lang.Object pValue,
                                       java.lang.String pKey,
                                       MutableRepositoryItem pItem,
                                       java.lang.String pItemPath)
                                throws RepositoryException
Update single value property that is repository item

Parameters:
pDesc - RepositoryPropertyDescriptor for property
pValue - values dictionary for child item
pKey - property name
pItem - parent item
pItemPath - where repository item is relative to parent (could be child, grandchild etc)
Throws:
RepositoryException

updateListProperty

protected void updateListProperty(MutableRepositoryItem pItem,
                                  RepositoryFormList pFormList)
                           throws RepositoryException
Goes through the set, array, or list property represented by the data we've collected from the RepositoryFormList object.

Throws:
RepositoryException

updateMapProperty

protected void updateMapProperty(MutableRepositoryItem pItem,
                                 RepositoryFormMap pFormMap)
                          throws RepositoryException
Goes through the map property represented by the data we've collected from the RepositoryFormList object.

Throws:
RepositoryException

postUpdateItemProperties

protected void postUpdateItemProperties(MutableRepositoryItem pItem)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
This method is called just after the updateItemProperties is completed. This allows subclasses to directly set properties of the repository item that would not be "digested" by the value dictionary.

Parameters:
pItem - the item being updated
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

handleDelete

public boolean handleDelete(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Deletes the item specified by the repositoryId property from the repository.

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 deleteSuccessURL. Otherwise, we optionally redirect to deleteErrorURL.

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

preDeleteItem

protected void preDeleteItem(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
This method is called just before the item is deleted from the repository.

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

postDeleteItem

protected void postDeleteItem(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
This method is called just after the item is deleted from the repository.

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

deleteItem

protected void deleteItem(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Deletes the item given by the current repository id from the repository. If any errors occur in the process, form errors will be added.

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

testPropertyAttribute

public static boolean testPropertyAttribute(DynamicPropertyDescriptor pDpd,
                                            java.lang.String pAttrName,
                                            java.lang.String pTest)
Test named attribute of specified property descriptor to see if it is equal to the value specified in pTest

Parameters:
pDpd - the property descriptor
pAttrName - the name of the property descriptor's attribute
pTest - the value to compare
Returns:
true if property descriptor's attribute equals pTest