com.nurelm.nucontent.model
Class RepeatItem

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

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

A RepeatItem represents one "line" in a RepeatList. As such, it can contain content and images, which can be retrieved with the getContentSet and getImageSet functions.

Ordered lists of RepeatItems are owned by RepeatList objects, which can return sorted, restricted, or full unordered lists of RepeatItems

See Also:
Serialized Form

Nested Class Summary
static class RepeatItem.RepeatItemComparator
          This inner class, implementing the java.util.Comparator class, is used by RepeatList to sort RepeatItem objects.
 
Constructor Summary
RepeatItem()
          Creates a new RepeatItem with a unique repeatItemId field.
RepeatItem(java.util.ArrayList repeatItemList)
           
RepeatItem(java.lang.String repeatItemId)
          For use with Migrator - let's you set everything
 
Method Summary
 void addContent(java.lang.String contentId, java.lang.String text)
          Adds a newContent object to this RepeatItem.
 void addFile(StandAloneFile file)
          Adds a new File object to this RepeatItem.
 void addImage(Image image)
          Adds a new Image object to this RepeatItem.
 Content getContent(java.lang.String contentId)
          Gets a particular Content object from this RepeatItem.
 Content getContentCreateIfNeeded(java.lang.String contentId, java.lang.String defaultContent)
          Gets a specified Content object, but creates a new one if it does not exist.
 java.util.HashSet getContentSet()
          Gets this object's complete set of content objects.
 java.util.HashSet getContentSetCopy()
           
 StandAloneFile getFile(java.lang.String fileId)
          Returns the File object associated with the supplied fileId.
 java.util.HashSet getFileSet()
           
 Image getImage(java.lang.String imageId)
          Returns the Image object associated with the supplied imageId.
 java.util.HashSet getImageSet()
          Gets this object's complete set of content objects.
 java.util.HashSet getImageSetCopy()
           
 Page getLinkedPage()
          Returns the page linked to this item.
 java.lang.String getRepeatItemId()
          Returns this object's unique repeatItemId.
 java.util.ArrayList getRepeatItemList()
           
 RepeatList getRepeatList()
          Returns the repeatList of which this item is a member.
 void removeContent(java.lang.String contentId)
          Removes a Content object from this RepeatItem.
 void removeFile(java.lang.String fileId)
          Removes File object from this RepeatItem.
 void removeImage(java.lang.String imageId)
          Removes Image object from this RepeatItem.
 void setContentSet(java.util.Collection ce)
           
 void setImageSet(java.util.Collection ce)
           
 void setLinkedPage(Page linkedPage)
          Sets the ID of the page linked to this item.
 void setRepeatItemList(java.util.ArrayList repeatItemList)
           
 void updateContent(java.lang.String contentId, java.lang.String text)
          Updates an existingContent object in this RepeatItem.
 void updateContent(java.lang.String contentId, java.lang.String text, java.lang.String type)
          Updates an existingContent object in this RepeatItem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepeatItem

public RepeatItem()
Creates a new RepeatItem with a unique repeatItemId field.


RepeatItem

public RepeatItem(java.lang.String repeatItemId)
For use with Migrator - let's you set everything


RepeatItem

public RepeatItem(java.util.ArrayList repeatItemList)
Method Detail

getRepeatList

public RepeatList getRepeatList()
Returns the repeatList of which this item is a member.


getRepeatItemId

public java.lang.String getRepeatItemId()
Returns this object's unique repeatItemId.

Returns:
Returns this object's unique repeatItemId.

getContentSet

public java.util.HashSet getContentSet()
Gets this object's complete set of content objects.

Returns:
A HashSet including all of this item's Content objects. An unordered list type was used since content has no meaningful ordering within a RepeatItem.

setContentSet

public void setContentSet(java.util.Collection ce)

setImageSet

public void setImageSet(java.util.Collection ce)

getContentSetCopy

public java.util.HashSet getContentSetCopy()

getImageSetCopy

public java.util.HashSet getImageSetCopy()

getImageSet

public java.util.HashSet getImageSet()
Gets this object's complete set of content objects.

Returns:
A HashSet including all of this item's Image objects. An unordered list type was used since content has no meaningful ordering within a RepeatItem.

getFileSet

public java.util.HashSet getFileSet()

addContent

public void addContent(java.lang.String contentId,
                       java.lang.String text)
                throws DataAccessException
Adds a newContent object to this RepeatItem. If the specified content already exists, then modify it.

Parameters:
contentId - The String by which this Content object will be known. This must be unique to the Content objects in this RepeatItem.

text - This Content object's value.
Throws:
DataAccessException

updateContent

public void updateContent(java.lang.String contentId,
                          java.lang.String text)
                   throws DataAccessException
Updates an existingContent object in this RepeatItem.

Parameters:
contentId - The String by which this Content object will be known. This must be unique to the Content objects in this RepeatItem.

text - This Content object's value.
Throws:
DataAccessException - Thrown if content is being updated for a userId which does not exist within this RepeatItem.

updateContent

public void updateContent(java.lang.String contentId,
                          java.lang.String text,
                          java.lang.String type)
                   throws DataAccessException
Updates an existingContent object in this RepeatItem.

Parameters:
contentId - The String by which this Content object will be known. This must be unique to the Content objects in this RepeatItem.

text - This Content object's value.
type - This Content object's type.
Throws:
DataAccessException - Thrown if content is being updated for a userId which does not exist within this RepeatItem.

removeContent

public void removeContent(java.lang.String contentId)
                   throws DataAccessException
Removes a Content object from this RepeatItem.

Parameters:
contentId - The contentId of the Content object to be removed.
Throws:
DataAccessException - Thrown if content is being removed for a userId which does not exist within this RepeatItem.

getContent

public Content getContent(java.lang.String contentId)
Gets a particular Content object from this RepeatItem.

Parameters:
contentId - The contentId of the Content object to be retrieved. If this item is associated with a linked page ID, then content will be retrieved from that page instead.
Returns:
Returns the Content object specified. If nothing is found, returns null.

getContentCreateIfNeeded

public Content getContentCreateIfNeeded(java.lang.String contentId,
                                        java.lang.String defaultContent)
                                 throws DataAccessException
Gets a specified Content object, but creates a new one if it does not exist.

Parameters:
contentId - The contentId of the Content object to be retrieved / created.
defaultContent - The content to use if a new object must be created.
Returns:
Returns the Content object specified. If nothing is found, creates a new Content object and returns it.
Throws:
DataAccessException - DOCUMENT ME!

addImage

public void addImage(Image image)
              throws DataAccessException
Adds a new Image object to this RepeatItem.

Parameters:
image - The Image object to be added.
Throws:
DataAccessException - Thrown if the image already exists within this RepeatItem.

removeImage

public void removeImage(java.lang.String imageId)
                 throws DataAccessException
Removes Image object from this RepeatItem.

Parameters:
imageId - The imageId of the object to be removed.
Throws:
DataAccessException - Thrown if the image does not exist within this RepeatItem.

getImage

public Image getImage(java.lang.String imageId)
Returns the Image object associated with the supplied imageId.

Parameters:
imageId - The imageId of the Image object to be retrieved.
Returns:
Returns an Image object corresponding to the imageId passed in, or null if no such object exists..

addFile

public void addFile(StandAloneFile file)
             throws DataAccessException
Adds a new File object to this RepeatItem.

Parameters:
file - The File object to be added.
Throws:
DataAccessException - Thrown if the file already exists within this RepeatItem.

removeFile

public void removeFile(java.lang.String fileId)
                throws DataAccessException
Removes File object from this RepeatItem.

Parameters:
fileId - The fileId of the object to be removed.
Throws:
DataAccessException - Thrown if the file does not exist within this RepeatItem.

getFile

public StandAloneFile getFile(java.lang.String fileId)
Returns the File object associated with the supplied fileId.

Parameters:
fileId - The fileId of the File object to be retrieved.
Returns:
Returns an File object corresponding to the fileId passed in, or null if no such object exists..

getRepeatItemList

public java.util.ArrayList getRepeatItemList()
                                      throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException

setRepeatItemList

public void setRepeatItemList(java.util.ArrayList repeatItemList)

getLinkedPage

public Page getLinkedPage()
Returns the page linked to this item.


setLinkedPage

public void setLinkedPage(Page linkedPage)
Sets the ID of the page linked to this item.