com.nurelm.nucontent.model
Class RepeatList

java.lang.Object
  extended bycom.nurelm.nucontent.model.RepeatList
All Implemented Interfaces:
java.io.Serializable

public class RepeatList
extends java.lang.Object
implements java.io.Serializable

A RepeatList contains an list of RepeatItems. This object contains methods to retrieve RepeatItems, which can be returned in their natural ordering, restricted based on content values, or ordered based on certain content fields.

A RepeatList can be thought of as a table, with each row represented by a RepeatItems. Fields in each row of this hypothetical table are represented by Content and Image items, and column names correspond to each Content and Image item's contentId and imageId.

Here's a summary of how RepeatLists fit into a Page's object structure:

  1. Pages contain an unordered collection of RepeatLists.
  2. RepeatLists contain an ordered list of RepeatItems.
  3. RepeatItems contain unordered lists of 1) Content objects, and 2) Image objects.

See Also:
Serialized Form

Constructor Summary
protected RepeatList()
          Does nothing, used nowhere, but eliminates JDO complie-time warning about not having a zero-args constructor.
  RepeatList(java.lang.String repeatListId)
          Create a new RepeatList.
  RepeatList(java.lang.String repeatListId, java.util.ArrayList repeatItemList)
          Create a new RepeatList.
  RepeatList(java.lang.String repeatListId, java.lang.String linkedTemplateId)
          Create a new RepeatList linked to the template indicated.
 
Method Summary
 RepeatItem addRepeatItem()
          Adds a new RepeatItem at the end of the list of RepeatItems
 RepeatItem addRepeatItem(java.util.ArrayList repeatItemList)
          Allows an entire list of repeat items to be added.
 RepeatItem addRepeatItem(int index)
          Adds a new RepeatItem at the location specified by the supplied index.
 RepeatItem addRepeatItem(int index, Page linkedPage)
          Adds a new RepeatItem at the location specified by the supplied index.
 RepeatItem addRepeatItem(java.lang.String repeatItemId)
          Adds a new RepeatItem at the end of the list of RepeatItems with the specified id.
 boolean containsLinkedPage(Page linkedPage)
          Determines if this repeat list contains a repeat item that is linked to the page specified.
 RepeatItem copyRepeatItem(int index)
          Adds a new RepeatItem at the location specified by the supplied index.
 java.lang.String getContentType(java.lang.String restrictId)
           
 java.lang.String getLinkedTemplateId()
          Returns this RepeatList's linked template ID.
 RepeatItem getRepeatItem(int index)
          Get a particular RepeatItem object.
 RepeatItem getRepeatItem(java.lang.String repeatItemId)
          Get a particular RepeatItem object.
 RepeatItem getRepeatItem(java.lang.String contentId, java.lang.String contentText)
          Get the first RepeatItem that contains content with the specified ID and value.
 RepeatItem getRepeatItemCreateIfNeeded(java.lang.String repeatItemId)
          Get a particular RepeatItem object, and create a new one if it does not exist.
 int getRepeatItemIndex(java.lang.String repeatItemId)
          Returns the index of the specified RepeatItem in this RepeatList's list.
 java.util.List getRepeatItemList()
          Returns this RepeatList's collection of RepeatItems.
 java.util.List getRepeatItemList(java.lang.String restrictIds, java.lang.String restrictValues, java.lang.String sortByIds, java.lang.String sortByDirections)
          Returns this RepeatList's collection of RepeatItems.
 java.util.List getRepeatItemList(java.lang.String searchIds, java.lang.String searchValues, java.lang.String sortByIds, java.lang.String sortByDirections, boolean isCaseSensitive)
          Returns this RepeatList's collection of RepeatItems.
 int getRepeatItemListSize()
          Returns the number of items contained in this repeat list.
 java.lang.String getRepeatListId()
          Returns this RepeatList's identifier.
 void moveRepeatItemDown(int index)
          Moving up means giving the RepeatItem a smaller index.
 void moveRepeatItemUp(int index)
          Moving up means giving the RepeatItem a larger index.
 boolean removeDuplicatesIfExist()
           
 void removeRepeatItem(int index)
          Removes a RepeatItem, and any corresponding Image or Content items.
 void removeRepeatItem(int index, Page page)
          Removes a RepeatItem, and any corresponding Image or Content items.
 void removeRepeatItem(java.lang.String repeatItemId)
          Remove the repeat item with the specified id.
 void removeRepeatItemsByLinkedPageId(java.lang.String linkedPageId)
          Removes all repeat items with the specified linkedPageId
 void setLinkedTemplateId(java.lang.String linkedTemplateId)
          Sets this RepeatList's linked template ID.
 int size()
          Returns the number of RepeatItem objects in this RepeatList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepeatList

protected RepeatList()
Does nothing, used nowhere, but eliminates JDO complie-time warning about not having a zero-args constructor.


RepeatList

public RepeatList(java.lang.String repeatListId)
Create a new RepeatList.

Parameters:
repeatListId - The id associated with this RepeatList. Must be unique among other RepeatLists in the current Page.

RepeatList

public RepeatList(java.lang.String repeatListId,
                  java.lang.String linkedTemplateId)
Create a new RepeatList linked to the template indicated.

Parameters:
repeatListId - The id associated with this RepeatList. Must be unique among other RepeatLists in the current Page.
linkedTemplateId - The templateId of a page with which to link this list.

RepeatList

public RepeatList(java.lang.String repeatListId,
                  java.util.ArrayList repeatItemList)
Create a new RepeatList.

Parameters:
repeatListId - The id associated with this RepeatList. Must be unique among other RepeatLists in the current Page.
repeatItemList - A list of repeatItem objects.
Method Detail

getRepeatListId

public java.lang.String getRepeatListId()
Returns this RepeatList's identifier.

Returns:
This RepeatList's identifier.

getLinkedTemplateId

public java.lang.String getLinkedTemplateId()
Returns this RepeatList's linked template ID.

Returns:
This RepeatList's linked template ID.

containsLinkedPage

public boolean containsLinkedPage(Page linkedPage)
Determines if this repeat list contains a repeat item that is linked to the page specified.

Parameters:
linkedPage - The page to determine if this repeat list contains.
Returns:
true if this repeat list contains a page linked to the page specified.

setLinkedTemplateId

public void setLinkedTemplateId(java.lang.String linkedTemplateId)
Sets this RepeatList's linked template ID.


size

public int size()
Returns the number of RepeatItem objects in this RepeatList.

Returns:
The number of RepeatItem objects in this RepeatList.

getRepeatItemList

public java.util.List getRepeatItemList()
Returns this RepeatList's collection of RepeatItems.

The returned collection will be sorted in its natural order, and will not be restricted.

Returns:
This RepeatList's collection of RepeatItems sorted in natural order.

getRepeatItemListSize

public int getRepeatItemListSize()
Returns the number of items contained in this repeat list.


getRepeatItemList

public java.util.List getRepeatItemList(java.lang.String restrictIds,
                                        java.lang.String restrictValues,
                                        java.lang.String sortByIds,
                                        java.lang.String sortByDirections)
                                 throws DataAccessException
Returns this RepeatList's collection of RepeatItems.

The returned collection will be sorted and restricted based on the input parameters.

Parameters:
restrictIds - A comma-separated list of Content object ids which will be used to restrict the returned collection. Use an empty string if you do not want to restrict results.
restrictValues - A comma-separated list of Content object values which will be used to restrict the returned collection. The list must contain one value corresponding to each value in the restictIds list.

sortByIds - A comma-separated list of Content object ids which will be used to sort the returned collection. Use an empty string if you do not want to sort results.
sortByDirections - A comma-separated list of directions will be used to sort the returned collection. Each direction can be either "ascending" or "descending".

Returns:
A sorted, restricted collection of RepeatItem objects.
Throws:
DataAccessException - Thrown if anything bad happens during the query.

getRepeatItemList

public java.util.List getRepeatItemList(java.lang.String searchIds,
                                        java.lang.String searchValues,
                                        java.lang.String sortByIds,
                                        java.lang.String sortByDirections,
                                        boolean isCaseSensitive)
                                 throws DataAccessException
Returns this RepeatList's collection of RepeatItems.

The returned collection will be sorted and searched based on the input parameters.

Parameters:
searchIds - A comma-separated list of Content object ids which will be used to search the returned collection. Use an empty string if you do not want to search results.
searchValues - A comma-separated list of Content object values which will be used to search the returned collection. The list must contain one value corresponding to each value in the searchIds list.

sortByIds - A comma-separated list of Content object ids which will be used to sort the returned collection. Use an empty string if you do not want to sort results.
sortByDirections - A comma-separated list of directions will be used to sort the returned collection. Each direction can be either "ascending" or "descending".

isCaseSensitive - True if search should be case sensitive.
Returns:
A sorted, searched collection of RepeatItem objects.
Throws:
DataAccessException - Thrown if anything bad happens during the query.

getRepeatItemIndex

public int getRepeatItemIndex(java.lang.String repeatItemId)
Returns the index of the specified RepeatItem in this RepeatList's list.

Returns:
An integer representing the specified RepeatItem's position in this RepeatList.

getRepeatItem

public RepeatItem getRepeatItem(int index)
Get a particular RepeatItem object.

Parameters:
index - The index of the object to be retrieved (starts at 0).
Returns:
The RepeatItem object corresponding to the repeatItemId specified.


getRepeatItem

public RepeatItem getRepeatItem(java.lang.String repeatItemId)
Get a particular RepeatItem object.

Parameters:
repeatItemId - The id of the object to be retrieved.
Returns:
The RepeatItem object corresponding to the repeatItemId specified.


getRepeatItem

public RepeatItem getRepeatItem(java.lang.String contentId,
                                java.lang.String contentText)
Get the first RepeatItem that contains content with the specified ID and value.

Parameters:
contentId - The contentId of the content to seek.
contentText - The value of the text of the content to seek.
Returns:
The first RepeatItem corresponding to the values specified.

getContentType

public java.lang.String getContentType(java.lang.String restrictId)

getRepeatItemCreateIfNeeded

public RepeatItem getRepeatItemCreateIfNeeded(java.lang.String repeatItemId)
Get a particular RepeatItem object, and create a new one if it does not exist.

Parameters:
repeatItemId - The id of the object to be retrieved.
Returns:
The RepeatItem object corresponding to the repeatItemId specified.


addRepeatItem

public RepeatItem addRepeatItem()
Adds a new RepeatItem at the end of the list of RepeatItems

Returns:
The RepeatItem just added.

addRepeatItem

public RepeatItem addRepeatItem(java.lang.String repeatItemId)
Adds a new RepeatItem at the end of the list of RepeatItems with the specified id.

Parameters:
repeatItemId - The id of the new repeatItem to add.
Returns:
The RepeatItem just added.

addRepeatItem

public RepeatItem addRepeatItem(int index)
Adds a new RepeatItem at the location specified by the supplied index.

Parameters:
index - The position in the collection of RepeatItems at which to add a new object.
Returns:
The RepeatItem just added.

addRepeatItem

public RepeatItem addRepeatItem(int index,
                                Page linkedPage)
Adds a new RepeatItem at the location specified by the supplied index.

Parameters:
index - The position in the collection of RepeatItems at which to add a new object.
Returns:
The RepeatItem just added.

addRepeatItem

public RepeatItem addRepeatItem(java.util.ArrayList repeatItemList)
Allows an entire list of repeat items to be added.


copyRepeatItem

public RepeatItem copyRepeatItem(int index)
Adds a new RepeatItem at the location specified by the supplied index.

Parameters:
index - The position in the collection of RepeatItems at which to add a new object.
Returns:
The RepeatItem just added.

removeRepeatItem

public void removeRepeatItem(int index,
                             Page page)
Removes a RepeatItem, and any corresponding Image or Content items.

Parameters:
index - The position of the object to be removed.
page - The Page object that is associated with the RepeatItem.

removeRepeatItem

public void removeRepeatItem(java.lang.String repeatItemId)
Remove the repeat item with the specified id.


removeRepeatItemsByLinkedPageId

public void removeRepeatItemsByLinkedPageId(java.lang.String linkedPageId)
Removes all repeat items with the specified linkedPageId

Parameters:
linkedPageId - The linkedPageId to search for when finding repeat items to remove.

removeDuplicatesIfExist

public boolean removeDuplicatesIfExist()

removeRepeatItem

public void removeRepeatItem(int index)
Removes a RepeatItem, and any corresponding Image or Content items.

Parameters:
index - The position of the object to be removed.

moveRepeatItemUp

public void moveRepeatItemUp(int index)
Moving up means giving the RepeatItem a larger index. If the supplied index is out of bounds, then an IndexOutOfBoundsException is thrown.

Parameters:
index - The position of the object to be moved up.

moveRepeatItemDown

public void moveRepeatItemDown(int index)
Moving up means giving the RepeatItem a smaller index. If the supplied index is out of bounds, then an IndexOutOfBoundsException is thrown.

Parameters:
index - The index of the object to be moved down.