atg.repository.servlet
Class RepositoryFormDataImpl

java.lang.Object
  extended by atg.repository.servlet.RepositoryFormDataImpl
All Implemented Interfaces:
RepositoryFormData

public class RepositoryFormDataImpl
extends java.lang.Object
implements RepositoryFormData

A minimal, stand-alone implementation of RepositoryFormData.

Created: July 25 2005

See Also:
RepositoryFormEditor

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
RepositoryFormDataImpl(MutableRepository pRepository, RepositoryItemDescriptor pItemDescriptor, java.lang.String pRepositoryId, ApplicationLogging pLogger, atg.repository.servlet.RepositoryEditorErrorHandler pErrorHandler)
          Create a RepositoryFormDataImpl, without having a pre-existing repository item.
RepositoryFormDataImpl(RepositoryItem pRepositoryItem, ApplicationLogging pLogger, atg.repository.servlet.RepositoryEditorErrorHandler pErrorHandler)
           
 
Method Summary
protected  java.util.Dictionary createValueDictionary()
          Create the value dictionary.
 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()
          Gets whether or not the form handler should check that all the required properties are present during the create/update operations.
 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.
 RepositoryItemDescriptor getItemDescriptor()
          Return the item descriptor for the top-level item or null
 ApplicationLogging getLogger()
          The component to use for logging
 java.lang.String getMapKeyValueSeparator()
          Gets the property MapKeyValueSeparator.
 MutableRepository getRepository()
          Returns the repository this objects operates on.
 java.lang.String getRepositoryId()
          Returns the repository id of the item being manipulated.
 RepositoryItem getRepositoryItem()
          The current repository item or null if no current item exists
 atg.repository.servlet.RepositoryItemEditor getRepositoryItemEditor()
          Return an implementaion of RepositoryItemEditor
 java.util.Set getTrimProperties()
          Get the Set of the names of properties to trim.
 java.util.Dictionary getValue()
          Returns a dictionary that stores the pending property values associated with an operation on the repository item (e.g.
 boolean isCreateTransientItems()
          Gets 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
 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 setCreateTransientItems(boolean pCreateTransientItems)
          Sets property CreateTransientItems.
 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 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.util.Set pTrimProperties)
          Set the Set of the names of properties to trim.
 
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

RepositoryFormDataImpl

public RepositoryFormDataImpl(RepositoryItem pRepositoryItem,
                              ApplicationLogging pLogger,
                              atg.repository.servlet.RepositoryEditorErrorHandler pErrorHandler)
                       throws RepositoryException
Throws:
RepositoryException

RepositoryFormDataImpl

public RepositoryFormDataImpl(MutableRepository pRepository,
                              RepositoryItemDescriptor pItemDescriptor,
                              java.lang.String pRepositoryId,
                              ApplicationLogging pLogger,
                              atg.repository.servlet.RepositoryEditorErrorHandler pErrorHandler)
Create a RepositoryFormDataImpl, without having a pre-existing repository item.

Parameters:
pRepository - The repository to contain this item
pRepositoryItemDescriptor - The repository item descriptor for the item we are editing.
pRepositoryId - The repository id for the item we are editing
pLogger - The logger to use for logging.
Method Detail

setTrimProperties

public void setTrimProperties(java.util.Set pTrimProperties)
Set the Set of the names of properties to trim.


getTrimProperties

public java.util.Set getTrimProperties()
Get the Set of the names of properties to trim.


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.


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

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.


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.


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.

The default setting is false.


setRequireMapKeys

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


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.


getRepositoryItemEditor

public atg.repository.servlet.RepositoryItemEditor getRepositoryItemEditor()
Return an implementaion of RepositoryItemEditor

Specified by:
getRepositoryItemEditor in interface RepositoryFormData
Returns:
an editor implementation

getErrorHandler

public atg.repository.servlet.RepositoryEditorErrorHandler getErrorHandler()
Return an object responsible for handling form errors

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

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

getItemDescriptor

public RepositoryItemDescriptor getItemDescriptor()
                                           throws RepositoryException
Return the item descriptor for the top-level item or null

Specified by:
getItemDescriptor in interface RepositoryFormData
Returns:
the item descriptor or null on error
Throws:
RepositoryException

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

getRepository

public MutableRepository getRepository()
Returns the repository this objects operates on. 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

getRepositoryItem

public RepositoryItem getRepositoryItem()
The current repository item or null if no current item exists

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

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.

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

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

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

getCheckForRequiredProperties

public boolean getCheckForRequiredProperties()
Gets 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

isCreateTransientItems

public boolean isCreateTransientItems()
Gets 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

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

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

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

getLogger

public ApplicationLogging getLogger()
The component to use for logging

Specified by:
getLogger in interface RepositoryFormData
Returns:
the logger

createValueDictionary

protected java.util.Dictionary createValueDictionary()
Create the value dictionary. This is the dictionary that will be returned by getValue().