atg.repository.servlet
Class XMLRepositoryFormHandler

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.repository.servlet.XMLRepositoryFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, RepositoryFormConstants, RepositoryFormData, java.util.EventListener

public class XMLRepositoryFormHandler
extends RepositoryFormHandler

This class is an extension of RepositoryFormHandler that has a few additional features.

(1) You can refer to repository items by "name" rather than the (less user friendly) repository id. For example, instead of setting the repositoryId property to "/targetedcontent/foo.html," one can set itemName to "foo," and also set the itemFolder and itemExtension properties to "/targetedcontent/" and ".html," respectively. Setting these properties has the effect of also updating the repositoryId property to the corresponding repository id.

(2) There is a special content property, which represents the content associated with the repository item. The contentPropertyName property specifies the actual property name of the item which is to be treated as the "content." Before the content property is set in the item, we insert paragraph tags where the text's paragraphs start and end, thus making the content appropriate for an item in an XML or HTML repository. For example, if the contentParagraphTagName property is set to "p," the content's paragraphs are enclosed in the <p> and </p> tags. When the content property is read back into the form, the paragraph tags are stripped off again, so that the user only sees regular text.

See Also:
RepositoryFormHandler

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
XMLRepositoryFormHandler()
           
 
Method Summary
 java.lang.String getClaimPropertyName()
          Returns property ClaimPropertyName
 java.lang.String getContent()
          Returns the item's content.
 java.lang.String getContentParagraphTagName()
          Returns the name of the XML/HTML tag in which the content's paragraphs should be enclosed.
 java.lang.String getContentPropertyName()
          Returns the property name of the item's "content" property.
 java.lang.String getItemExtension()
          Returns the item's file extension, if any.
 java.lang.String getItemFolder()
          Returns the item's folder in the repository.
 java.lang.String getItemName()
          Returns the item's name.
 java.lang.String getItemPathWordSeparator()
          Returns the string to replace spaces with in the item's path.
 java.util.Properties getLinksDictionary()
          Returns the set of properties/dictionary of HTTP links which correspond to some content.
 java.lang.String getXmlEncoding()
          Returns the name of the encoding type to be used for the actual XML file.
 boolean handleClaimUpdate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Checks to see if the current editor can claim the requested article.
 void setClaimPropertyName(java.lang.String pClaimPropertyName)
          Sets property ClaimPropertyName
 void setContent(java.lang.String pContent)
          Sets the item's content.
 void setContentParagraphTagName(java.lang.String pContentParagraphTagName)
          Sets the name of the XML/HTML tag in which the content's paragraphs should be enclosed.
 void setContentPropertyName(java.lang.String pContentPropertyName)
          Sets the property name of the item's "content" property.
 void setItemExtension(java.lang.String pItemExtension)
          Sets the item's file extension and, consequently, updates the repositoryId property to the repository id corresponding to the item's name, folder, and extension.
 void setItemFolder(java.lang.String pItemFolder)
          Sets the item's folder in the repository and, consequently, updates the repositoryId property to the repository id corresponding to the item's name, folder, and extension.
 void setItemName(java.lang.String pItemName)
          Sets the item's name and, consequently, updates the repositoryId property to the corresponding repository id.
 void setItemPathWordSeparator(java.lang.String pItemPathWordSeparator)
          Sets the string to replace spaces with in the item's path.
 void setLinksDictionary(java.util.Properties pLinksDictionary)
          Sets the set of properties/dictionary of HTTP links which correspond to some content.
 void setXmlEncoding(java.lang.String pXMLEncoding)
          Sets the name of the encoding type to be used for the actual XML file.
protected  void updateItem(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Updates the repository item given by the current repository id.
 
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, getItemDescriptorName, getItemProperty, getLogger, getMapKeyValueSeparator, getRemoveReferencesToDeletedItems, getRepository, getRepositoryId, getRepositoryItem, getRepositoryItemEditor, getRepositoryPathName, getRequireIdOnCreate, getSpecifiedIdPropertyValue, getTransactionDemarcation, getTransactionManager, getTrimProperties, getUpdateErrorURL, getUpdateSuccessURL, getValue, getValueProperty, handleCreate, handleDelete, handleUpdate, isClearValueOnSet, isCreateTransientItems, isRequireMapKeys, isSortRepositoryItemSets, isTrimProperty, postCreateItem, postDeleteItem, postUpdateItem, postUpdateItemProperties, preCreateItem, preDeleteItem, preUpdateItem, setCheckForReadOnlyProperties, setCheckForRequiredProperties, setClearValueOnSet, setContentNameProperty, setContentPathProperty, setCreateErrorURL, setCreateSuccessURL, setCreateTransientItems, setDeleteErrorURL, setDeleteSuccessURL, setEditMapsAsLists, setExtractDefaultValuesFromItem, setFolderIdProperty, setItemDescriptorName, setMapKeyValueSeparator, setRemoveReferencesToDeletedItems, setRepository, setRepositoryId, setRepositoryItemEditor, setRepositoryPathName, setRequireIdOnCreate, setRequireMapKeys, setSortRepositoryItemSets, setTrimProperties, setUpdateErrorURL, setUpdateSuccessURL, setValueProperty, testPropertyAttribute, updateChildItemProperty, updateContentItemValues, updateItemProperties, updateListProperty, updateMapProperty
 
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, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

XMLRepositoryFormHandler

public XMLRepositoryFormHandler()
Method Detail

getItemName

public java.lang.String getItemName()
Returns the item's name.


setItemName

public void setItemName(java.lang.String pItemName)
Sets the item's name and, consequently, updates the repositoryId property to the corresponding repository id.


getItemFolder

public java.lang.String getItemFolder()
Returns the item's folder in the repository.


setItemFolder

public void setItemFolder(java.lang.String pItemFolder)
Sets the item's folder in the repository and, consequently, updates the repositoryId property to the repository id corresponding to the item's name, folder, and extension. The folder is expected to end with a "/" (e.g., "/targetedcontent/").


getItemExtension

public java.lang.String getItemExtension()
Returns the item's file extension, if any.


setItemExtension

public void setItemExtension(java.lang.String pItemExtension)
Sets the item's file extension and, consequently, updates the repositoryId property to the repository id corresponding to the item's name, folder, and extension. The extension is expected to start with a "." (e.g., ".html").


getItemPathWordSeparator

public java.lang.String getItemPathWordSeparator()
Returns the string to replace spaces with in the item's path.


setItemPathWordSeparator

public void setItemPathWordSeparator(java.lang.String pItemPathWordSeparator)
Sets the string to replace spaces with in the item's path. For example, if itemPathWordSeparator is set to "_" then the id "/targeted content/my item.html" will be converted into "/targeted_content/my_item.html."


getContentPropertyName

public java.lang.String getContentPropertyName()
Returns the property name of the item's "content" property.


setContentPropertyName

public void setContentPropertyName(java.lang.String pContentPropertyName)
Sets the property name of the item's "content" property. The specified property must exist in the item descriptor used by this form handler, and it must be of type String.


getContentParagraphTagName

public java.lang.String getContentParagraphTagName()
Returns the name of the XML/HTML tag in which the content's paragraphs should be enclosed. If not specified, the "content" property will in effect be treated as a regular repository item property.


setContentParagraphTagName

public void setContentParagraphTagName(java.lang.String pContentParagraphTagName)
Sets the name of the XML/HTML tag in which the content's paragraphs should be enclosed.


getXmlEncoding

public java.lang.String getXmlEncoding()
Returns the name of the encoding type to be used for the actual XML file. This should be a valid XML encoding type. If not specified, the default encoding type will be used to write the XML file for new items.


setXmlEncoding

public void setXmlEncoding(java.lang.String pXMLEncoding)
Sets the name of the encoding type to be used for the actual XML file. This should be a valid XML encoding type.


getLinksDictionary

public java.util.Properties getLinksDictionary()
Returns the set of properties/dictionary of HTTP links which correspond to some content. e.g. ATG corresponds to http://www.atg.com.


setLinksDictionary

public void setLinksDictionary(java.util.Properties pLinksDictionary)
Sets the set of properties/dictionary of HTTP links which correspond to some content. e.g. ATG corresponds to http://www.atg.com.


getContent

public java.lang.String getContent()
Returns the item's content. This value is obtained by looking up the value of the item's "content" property (either in the value table, or in the repository item itself), and stripping off the paragraph tags.


setContent

public void setContent(java.lang.String pContent)
Sets the item's content. This has the effect of setting the value of value.content, where content is specified by contentPropertyName. Before the item's content is set, links to any known content are added. The property value is set to the item's content after HTML paragraph tags are added to it.


getClaimPropertyName

public java.lang.String getClaimPropertyName()
Returns property ClaimPropertyName


setClaimPropertyName

public void setClaimPropertyName(java.lang.String pClaimPropertyName)
Sets property ClaimPropertyName


handleClaimUpdate

public boolean handleClaimUpdate(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Checks to see if the current editor can claim the requested article. If the article is not being edited by someone else then the article's meta-data is updated to reflect that the current editor has claimed it.

It then updates the rest of the article's meta-data. See atg.repository.servlet.RepositoryFormHandler.handleUpdate().

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
See Also:
atg.repository.servlet.RepositoryFormHandler.handleUpdate

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. Also, the XML encoding (which is not technically a property of the repository item) is updated through the XMLDeclaration. If any errors occur in the process, form errors will be added.

Overrides:
updateItem in class RepositoryFormHandler
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