atg.repository.servlet
Class RepositoryFormList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by atg.repository.servlet.RepositoryFormList
All Implemented Interfaces:
atg.web.collection.CollectionAdapter, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess
Direct Known Subclasses:
RepositoryFormMap

public class RepositoryFormList
extends java.util.ArrayList
implements atg.web.collection.CollectionAdapter

This class is used by the RepositoryFormHandler. It is returned when a property of type array, set or list is requested as a sub-property of the value property (e.g. RFH.value.someListProperty). It has additional sub-properties that give you more flexibility when editing a list.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
RepositoryFormList(RepositoryFormData pFormData, RepositoryPropertyDescriptor pProperty, RepositoryItem pItem)
           
RepositoryFormList(RepositoryFormData pFormData, RepositoryPropertyDescriptor pProperty, RepositoryItem pItem, java.lang.Object pPropertyValue)
           
 
Method Summary
 void clear()
           
 boolean contains(java.lang.Object o)
           
 java.lang.Object get(int pIndex)
           
 java.lang.String getComponentItemRepository()
          Get the component repository if this is a collection of repository items.
 java.lang.String getComponentItemType()
          Get the component item type if this is a collection of repository items.
 java.lang.Object getDefaultElementValue(int pIndex)
           
 boolean getIsModified()
          Return the isModified state of the collection.
protected  ApplicationLogging getLogger()
          Utility method for retrieving an ApplicationLogging object.
 int getNumDuplicates()
          Return the number of duplicates detected during an insert operation.
 int getNumNewValues()
           
 RepositoryPropertyDescriptor getPropertyDescriptor()
           
 java.lang.Object getPropertyValue()
          Return the stored value of our associated repository item property.
 java.lang.String[] getRepositoryIds()
           
 boolean[] getSkip()
           
 boolean getSkip(int pIndex)
           
 boolean getSupportsIsModified()
          Used to determine if getIsModified is supported.
 java.lang.String getUpdateMode()
           
 java.lang.Object getValue(int pIndex)
          Retrieves the real value we should use for this item.
 java.lang.Object[] getValues()
           
 int insertItems(java.lang.String pIds, int pInsertIndex)
          Insert one or more repository items into the collection.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int removeElement(int pIndex)
          Remove the element at a specified index.
 int reorder(java.lang.String pEncodedIndices)
          Reorder the collection.
 void setIsModified(boolean pModified)
          Set the isModified state of the collection.
 void setNumNewValues(int pNumNewValues)
          Sets the property NumNewValues.
 void setRepositoryIds(java.lang.String[] pRepositoryIds)
          Sets the property RepositoryIds.
 void setSkip(boolean[] pSkip)
          Sets the property Skip.
 void setSkip(int pIndex, boolean pValue)
          Sets a single element after resizing the array if necessary
 void setSupportsIsModified(boolean pSupportsIsModified)
          Set the state of the supportsIsModified flag.
 void setUpdateMode(java.lang.String pUpdateMode)
          Sets the property UpdateMode.
 void setValues(java.lang.Object[] pValues)
          Sets the property Values.
 int size()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 void updateItemProperties(int pIndex)
          Updates the properties for the given item
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clone, ensureCapacity, indexOf, lastIndexOf, remove, remove, removeRange, set, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

RepositoryFormList

public RepositoryFormList(RepositoryFormData pFormData,
                          RepositoryPropertyDescriptor pProperty,
                          RepositoryItem pItem)

RepositoryFormList

public RepositoryFormList(RepositoryFormData pFormData,
                          RepositoryPropertyDescriptor pProperty,
                          RepositoryItem pItem,
                          java.lang.Object pPropertyValue)
Method Detail

getPropertyDescriptor

public RepositoryPropertyDescriptor getPropertyDescriptor()

setRepositoryIds

public void setRepositoryIds(java.lang.String[] pRepositoryIds)
Sets the property RepositoryIds. When set, this defines the list of items stored in this list.

Parameters:
pRepositoryIds - new value to set

getRepositoryIds

public java.lang.String[] getRepositoryIds()
Returns:
The value of the property RepositoryIds.

setSkip

public void setSkip(boolean[] pSkip)
Sets the property Skip. This can be set on a per item basis. If true, we skip the update of these entries. In the replace mode, this will cause this entry to be deleted. In the append/prepend mode, the skipped entires are simply not put into the list.

Parameters:
pSkip - new value to set

getSkip

public boolean[] getSkip()
Returns:
The value of the property Skip.

getSkip

public boolean getSkip(int pIndex)

setSkip

public void setSkip(int pIndex,
                    boolean pValue)
Sets a single element after resizing the array if necessary


setValues

public void setValues(java.lang.Object[] pValues)
Sets the property Values. This allows you to access the value of these properties as a simple array sub-property.

Parameters:
pValues - new value to set

getValues

public java.lang.Object[] getValues()
Returns:
The value of the property Values.

getValue

public java.lang.Object getValue(int pIndex)
Retrieves the real value we should use for this item. When we are representing a list of real items, we need to get the actual repository item out of the RepositoryFormHashtable.


getPropertyValue

public java.lang.Object getPropertyValue()
Return the stored value of our associated repository item property.

Returns:
The stored value of our property.

updateItemProperties

public void updateItemProperties(int pIndex)
                          throws RepositoryException
Updates the properties for the given item

Throws:
RepositoryException

setNumNewValues

public void setNumNewValues(int pNumNewValues)
Sets the property NumNewValues. This is set to the # of items we should create for this form submission.

Parameters:
pNumNewValues - new value to set

getNumNewValues

public int getNumNewValues()
Returns:
The value of the property NumNewValues.

setUpdateMode

public void setUpdateMode(java.lang.String pUpdateMode)
Sets the property UpdateMode. This can be one of the values "append", "prepend", "replace", or "remove". It is used to determine how we combine this value with the underlying repository item's value.

Parameters:
pUpdateMode - new value to set

getUpdateMode

public java.lang.String getUpdateMode()
Returns:
The value of the property UpdateMode.

getNumDuplicates

public int getNumDuplicates()
Return the number of duplicates detected during an insert operation.

Returns:
the number of duplicate items

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Overrides:
size in class java.util.ArrayList

get

public java.lang.Object get(int pIndex)
Specified by:
get in interface java.util.List
Overrides:
get in class java.util.ArrayList

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.List
Overrides:
isEmpty in class java.util.ArrayList

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.List
Overrides:
contains in class java.util.ArrayList

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.List
Overrides:
iterator in class java.util.AbstractList

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List
Overrides:
toArray in class java.util.ArrayList

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
Overrides:
clear in class java.util.ArrayList

getDefaultElementValue

public java.lang.Object getDefaultElementValue(int pIndex)

getLogger

protected ApplicationLogging getLogger()
Utility method for retrieving an ApplicationLogging object.


removeElement

public int removeElement(int pIndex)
                  throws atg.web.collection.CollectionAdapterException
Remove the element at a specified index.

Specified by:
removeElement in interface atg.web.collection.CollectionAdapter
Parameters:
pIndex - The index of the element to remove from the collection.
Returns:
The index of the removed element.
Throws:
atg.web.collection.CollectionAdapterException

getIsModified

public boolean getIsModified()
Return the isModified state of the collection.

Specified by:
getIsModified in interface atg.web.collection.CollectionAdapter
Returns:
true if the collection was modified using any of the CollectionAdapter methods.

setIsModified

public void setIsModified(boolean pModified)
Set the isModified state of the collection.

Specified by:
setIsModified in interface atg.web.collection.CollectionAdapter
Parameters:
pModified - The boolean representing the state.

getSupportsIsModified

public boolean getSupportsIsModified()
Used to determine if getIsModified is supported.

Specified by:
getSupportsIsModified in interface atg.web.collection.CollectionAdapter
Returns:
true if the CollectionAdapter and grid editor are being used.

setSupportsIsModified

public void setSupportsIsModified(boolean pSupportsIsModified)
Set the state of the supportsIsModified flag.

Specified by:
setSupportsIsModified in interface atg.web.collection.CollectionAdapter
Parameters:
pSupportsIsModified - Set to true by the grid collection editor.

insertItems

public int insertItems(java.lang.String pIds,
                       int pInsertIndex)
                throws atg.web.collection.CollectionAdapterException
Insert one or more repository items into the collection.

Specified by:
insertItems in interface atg.web.collection.CollectionAdapter
Parameters:
pIds - A comma separated list of IDs.
pInsertIndex - The index at which to insert or -1 to append the items.
Returns:
The number of items that were inserted.
Throws:
atg.web.collection.CollectionAdapterException

getComponentItemRepository

public java.lang.String getComponentItemRepository()
Get the component repository if this is a collection of repository items.

Specified by:
getComponentItemRepository in interface atg.web.collection.CollectionAdapter

getComponentItemType

public java.lang.String getComponentItemType()
Get the component item type if this is a collection of repository items.

Specified by:
getComponentItemType in interface atg.web.collection.CollectionAdapter

reorder

public int reorder(java.lang.String pEncodedIndices)
            throws atg.web.collection.CollectionAdapterException
Reorder the collection.

Specified by:
reorder in interface atg.web.collection.CollectionAdapter
Parameters:
pEncodedIndices - An encoded string representing order-by-number changes.
Returns:
The number of items reordered.
Throws:
atg.web.collection.CollectionAdapterException