com.nurelm.nucontent.model
Class Page

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

public class Page
extends Node
implements java.io.Serializable

Corresponds to a Web page in a NuContent application. Through this object, programmers can access every piece of NuContent-controlled content on a particular page. NuContent provides access to the current Page object via each request in the attribute called "page".

For example, say we create a Page object in the usual way within a NuContent JSP page:

Page myPage = (Page) request.getAttribute("page");

Here's how to get the value of some content on the current page with the content ID of "test content":

String contentValue = page.getContent("test content").getText();

Here's how to get the value of some content with the same content ID ("test content") that happens to be in the third row of a repeat list with a repeat ID of "test list":

String contentValue = page.getRepeatList("test list").getRepeatItem(2).getContent("test content").getText();

See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList childNodeList
           
static java.lang.String CONTENT_ALREADY_EXISTS
           
static java.lang.String CONTENT_NOT_FOUND
           
protected  java.util.Set contentSet
           
static java.lang.String DEFAULT_CONTENT
           
protected  java.util.Set editorGroupNames
           
static java.lang.String FILE_ALREADY_EXISTS
           
static java.lang.String FILE_NOT_FOUND
           
protected  java.util.Set fileSet
           
static java.lang.String IMAGE_ALREADY_EXISTS
           
static java.lang.String IMAGE_NOT_FOUND
           
protected  java.util.Set imageSet
           
static java.lang.String NODE_NOT_FOUND
           
protected  Page parent
           
static java.lang.String REPEAT_LIST_ALREADY_EXISTS
           
static java.lang.String REPEAT_LIST_NOT_FOUND
           
protected  java.util.Set repeatListSet
           
protected  java.util.Set reviewUserNames
           
protected  java.util.ArrayList tasks
           
protected  java.util.ArrayList versions
           
protected  java.util.Set viewerGroupNames
           
static int WORKING_VERSION
           
 
Fields inherited from class com.nurelm.nucontent.model.Node
DEFAULT_NAME, DEFAULT_SHORT_DESC, id, isNewWindow, site, transientGeneration, transientIsBottomChildNode, transientIsChildNode, transientIsSelected, transientIsTopChildNode, version
 
Constructor Summary
Page()
          This constructor does nothing.
Page(java.lang.String name, java.lang.String shortDesc, Page parent)
           
Page(java.lang.String name, java.lang.String shortDesc, Page parent, int version)
           
Page(java.lang.String name, java.lang.String shortDesc, Page parent, java.lang.String id)
           
 
Method Summary
 File addChildFile(File file)
          Adds a new child file to the end of the subpage list and returns the new File object.
 File addChildFile(File file, int orderIndex)
          Adds a new child file at the orderIndex location in the subpage list and returns the new File object.
 Node addChildLink(Link link)
           
 Node addChildLink(Link link, int orderIndex)
           
 Page addChildPage(java.lang.String name, java.lang.String shortDesc)
          Adds a new child page and returns it.
 Page addChildPage(java.lang.String name, java.lang.String shortDesc, int orderIndex)
          Adds child at specified index.
 Page addChildPage(java.lang.String name, java.lang.String shortDesc, int orderIndex, java.lang.String id)
          Adds child at specified index and with specified ID.
 Page addChildPage(java.lang.String name, java.lang.String shortDesc, java.lang.String id)
          Use the other addChildPage method in preference over this one.
 void addContent(java.lang.String contentId, java.lang.String text)
          Adds the supplied content to the db.
 void addImage(Image image)
          Adds the supplied image to the db.
 void addNuFile(StandAloneFile file)
          Adds the supplied image to the db.
 void addOpenTask(int type, java.util.Date requestedCompletionDate, User assignedTo, User assignedBy, java.lang.String comment)
          Adds a new, open task to the current page.
 void addOpenTaskWithOutClosePreviousTask(int type, java.util.Date requestedCompletionDate, User assignedTo, User assignedBy, java.lang.String comment)
          Adds a new, open task to the current page.
 RepeatList addRepeatList(java.lang.String repeatListId)
          Adds a new RepeatList that is associated with the supplied repeatListId.
 RepeatList addRepeatList(java.lang.String repeatListId, java.lang.String linkedTemplateId)
          Adds a new RepeatList that is associated with the supplied repeatListId and linked to linkedTemplateId.
 RepeatList addRepeatListCollection(java.lang.String repeatListId, java.util.ArrayList repeatItemList)
          Adds a new RepeatListCollection that is associated with the supplied repeatListId.
 boolean canBreed()
          Returns true if the node can generate child nodes.
 int closeOpenTasks(int type, java.lang.String comment)
          Closes any open tasks in the current object that have the specified type.
 java.util.ArrayList getBirdSeedList()
          Returns an ArrayList containing Page objects that represent the bird seed list (AKA bread crumb trail) leading up to the current page.
 java.util.ArrayList getChildNodeList()
          Returns a list of all nodes that are children of this page.
protected  java.util.List getChildNodeListCopy()
          Returns a certain type of "shallow" copy of the current Page object's child node list.
protected  java.util.List getChildNodeListCopy(Page copyParent)
          Returns a certain type of "shallow" copy of the current Page object's child node list.
 java.util.Collection getChildPageList()
          Returns list of pages that list this page as their parent.
 java.util.Collection getChildPageListSortByName()
          Returns list of pages that list this page as their parent.
 java.lang.String getComments()
          Gets an HTML formatted list of comments associated with this page.
 Content getContent(java.lang.String contentId)
           
 Content getContentCreateIfNeeded(java.lang.String contentId, java.lang.String defaultContent)
           
 java.util.HashSet getContentSet()
           
protected  java.util.Set getContentSetCopy()
          Returns a "shallow" copy of the Set of this Page's content.
 Page getCurrentVersion()
          Gets the current page with this id.
 Page getCurrentWorkingCopy()
          Gets the current working copy of this object.
 java.util.Set getEditorGroupNames()
          Provides access to this Page's editor group names.
 java.lang.String[] getEditorGroupNamesArray()
          Provides access to this Page's editor group names.
protected  java.util.Set getEditorGroupNamesCopy()
          Returns a "shallow" copy of the Set of this Page's editor group names.
 StandAloneFile getFile(java.lang.String fileId)
          Returns the File object associated with the supplied fileId.
 java.util.HashSet getFileSet()
           
protected  java.util.Set getFileSetCopy()
          Returns a "shallow" copy of the Set of this Page's files.
 Task getFirstOpenTask()
          Finds the first open task in this object and returns it.
 Task getFirstOpenTaskByType(int type)
          Finds the first open task of the specified type in this object and returns it.
 java.lang.String getFirstOpenTaskDate()
          Gets date of first open task in string form.
 java.lang.String getFirstOpenTaskType()
          Gets type of first open task in string form.
 java.util.ArrayList getFullNavTreeList()
          Returns ArrayList of Node objects with their transient generation and isSelected fields set.
 int getGeneration()
          Calculates and returns the generation.
 Image getImage(java.lang.String imageId)
          Returns the image associated with the supplied imageId.
 java.util.HashSet getImageSet()
           
protected  java.util.Set getImageSetCopy()
          Returns a "shallow" copy of the Set of this Page's images.
 java.lang.String getLastWorkingPageComments()
          Gets an HTML formatted list of comments associated with the most recent working page (this page if it is a working page).
 Page getLockingPage()
          Gets the Page which has this Page locked.
 java.lang.String getLockingPageId()
          Returns the page id of the page that has this one locked.
 User getLockingUser()
          Returns the User who has this page locked.
 java.lang.String getName()
          Provides access to this Page's name.
 StandAloneFile getNuFile(java.lang.String fileId)
          Returns the image associated with the supplied imageId.
 java.util.Collection getOpenTasksByType(int type)
          Finds the first open task of the specified type in this object and returns it.
 java.lang.String getPageURI()
           
 Page getParent()
          Returns this page's parent.
 RepeatList getRepeatList(java.lang.String repeatListId)
          Returns the RepeatList associated with the supplied repeatId.
 RepeatList getRepeatList(java.lang.String repeatListId, java.lang.String linkedTemplateId)
          Returns the RepeatList associated with the supplied repeatId.
 RepeatList getRepeatListCollectionCreateIfNeeded(java.lang.String repeatListId, java.util.ArrayList repeatItemList)
           
 RepeatList getRepeatListCreateIfNeeded(java.lang.String repeatListId)
          Returns the RepeatList associated with the supplied repeatId, and creates it if it does not already exist.
 RepeatList getRepeatListCreateIfNeeded(java.lang.String repeatListId, java.lang.String linkedTemplateId)
          Returns the RepeatList associated with the supplied repeatId and linked to the page indicated, and creates it if it does not already exist.
 java.util.HashSet getRepeatListSet()
           
protected  java.util.Set getRepeatListSetCopy()
          Returns a "shallow" copy of the Set of this Page's repeat lists.
 boolean getRequireReview()
           
 java.util.Set getReviewUserNames()
          Provides access to this Page's review user names.
 java.lang.String[] getReviewUserNamesArray()
          Provides access to this Page's review user names.
protected  java.util.Set getReviewUserNamesCopy()
          Returns a "shallow" copy of the Set of this Page's review group names.
 java.lang.String getShortDesc()
          Provides access to this Page's short description.
 Site getSite()
          Gets the Site to which this page belongs.
 java.lang.String getURI(java.lang.String parentTemplateFile)
          Deprecated. Replaced by getURI(String,String). This deprecated version will assume an empty contextPath.
 java.lang.String getURI(java.lang.String parentTemplateFile, java.lang.String contextPath)
          Gets the current page's URI
 Page getVersion(int version)
          Returns the version of this object with the specified version number.
 java.util.Set getViewerGroupNames()
          Provides access to this Page's viewer groups.
 java.lang.String[] getViewerGroupNamesArray()
           
protected  java.util.Set getViewerGroupNamesCopy()
          Returns a "shallow" copy of the Set of this Page's viewer group names.
 boolean hasChildren()
          Returns true if this Node has children nodes.
 boolean isChildLinkEditable(UserValueObject userVO, boolean isParentEditable)
          Indicates if this object is editable.
 boolean isChildLinkViewable(UserValueObject userVO, boolean isParentViewable)
          Indicates if this object is viewable.
 boolean isEditable(UserValueObject userVO)
          The page is editable if it is not locked by another user, and either ...
 boolean isInReview()
          Determines if page is currently being reviewed.
 boolean isLocked()
          Determines if this page is already locked.
 boolean isUserInEditorGroup(UserValueObject userVO)
          Used to determine if the user is in a group that can edit this page.
 boolean isViewable(UserValueObject userVO)
          Determines if the current page is viewable.
 Page lock(java.util.Date requestedCompletionDate, User assignedTo, User assignedBy, java.lang.String pageURI, java.lang.String comment)
          Checks out, or "locks" a page.
 void moveChildNodeDown(int nodeIndex)
          Moving up means giving the Node a smaller index.
 void moveChildNodeUp(int nodeIndex)
          Moving up means giving the Node a larger index.
 void recursiveReplaceEditorGroups(java.lang.String[] newEditorGroups)
          Replaces editor groups for this Page and all of it's children recursively.
 void recursiveReplaceReviewUsers(java.lang.String[] newReviewUsers)
          Replaces review users for this Page and all of it's children recursively.
 void recursiveReplaceViewerGroups(java.lang.String[] newViewerGroups)
          Applies the supplied permissions to this page and all of its descendent pages.
 void removeChildNode(Node node)
          Remove the specified child object.
 void removeContent(java.lang.String contentId)
           
 void removeImage(java.lang.String imageId)
          Removes an image, but does not remove corresponding file.
 void removeNuFile(java.lang.String fileId)
          Removes an image, but does not remove corresponding file.
 void removePageVersion(int version)
          Removes a version of this object.
 void removeRepeatList(java.lang.String repeatListId)
          Removes the specified RepeatList.
 void replaceEditorGroups(java.lang.String[] newEditorGroups)
          Removes any editor group values and replaces them with the values contained in the supplied newEditorGroups array.
 void replaceReviewUsers(java.lang.String[] newReviewUsers)
          Removes any review user values and replaces them with the values contained in the supplied newReviewUsernames array.If newReviewUserNames is null or empty, the review users are cleared and no groups are replaced.
 void replaceViewerGroups(java.lang.String[] newViewerGroups)
          Removes any viewer group values and replaces them with the values contained in the supplied newViewerGroups array.
 void sendBackToEditor(java.lang.String comment)
          Sends the page being reviewed back to the originating editor for further updates.
 void setName(java.lang.String name)
          Sets this Page's name.
 void setPageURI(java.lang.String pageURI)
           
 void setRequireReview(boolean reviewReq)
           
 void setShortDesc(java.lang.String shortDesc)
          Sets this Page's short description.
 void unlockAndCancel(javax.servlet.ServletContext sc, java.lang.String comment, User user)
          Unlocks the current Page and discards all edits that have been made to its working copy.
 void unlockAndSave(javax.servlet.ServletContext sc, java.lang.String comment, java.lang.String reviewType, User user)
          If this page does not require a review, unlocks the current page if it's locked, makes the working copy page the live page, and puts the old page into the version list; if the page does require review, redirects to assignReviewer.
 void unlockAndSave(javax.servlet.ServletContext sc, java.lang.String comment, java.lang.String reviewType, User user, boolean reviewTypeExt, boolean doreview)
          If this page does not require a review, unlocks the current page if it's locked, makes the working copy page the live page, and puts the old page into the version list; if the page does require review and review-exten turn on then redirects to assignReviewers.
 void updateContent(java.lang.String contentId, java.lang.String text)
           
 void updateContent(java.lang.String contentId, java.lang.String text, java.lang.String type)
           
 
Methods inherited from class com.nurelm.nucontent.model.Node
getId, getIsNewWindow, getTransientGeneration, getTransientIsBottomChildNode, getTransientIsChildNode, getTransientIsSelected, getTransientIsTopChildNode, getVersion, setIsNewWindow, setTransientGeneration, setTransientIsBottomChildNode, setTransientIsChildNode, setTransientIsSelected, setTransientIsTopChildNode, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTENT

public static final java.lang.String DEFAULT_CONTENT
See Also:
Constant Field Values

NODE_NOT_FOUND

public static final java.lang.String NODE_NOT_FOUND
See Also:
Constant Field Values

CONTENT_NOT_FOUND

public static final java.lang.String CONTENT_NOT_FOUND
See Also:
Constant Field Values

CONTENT_ALREADY_EXISTS

public static final java.lang.String CONTENT_ALREADY_EXISTS
See Also:
Constant Field Values

IMAGE_NOT_FOUND

public static final java.lang.String IMAGE_NOT_FOUND
See Also:
Constant Field Values

IMAGE_ALREADY_EXISTS

public static final java.lang.String IMAGE_ALREADY_EXISTS
See Also:
Constant Field Values

FILE_NOT_FOUND

public static final java.lang.String FILE_NOT_FOUND
See Also:
Constant Field Values

FILE_ALREADY_EXISTS

public static final java.lang.String FILE_ALREADY_EXISTS
See Also:
Constant Field Values

REPEAT_LIST_NOT_FOUND

public static final java.lang.String REPEAT_LIST_NOT_FOUND
See Also:
Constant Field Values

REPEAT_LIST_ALREADY_EXISTS

public static final java.lang.String REPEAT_LIST_ALREADY_EXISTS
See Also:
Constant Field Values

WORKING_VERSION

public static final int WORKING_VERSION
See Also:
Constant Field Values

parent

protected Page parent

contentSet

protected java.util.Set contentSet

imageSet

protected java.util.Set imageSet

fileSet

protected java.util.Set fileSet

repeatListSet

protected java.util.Set repeatListSet

childNodeList

protected java.util.ArrayList childNodeList

viewerGroupNames

protected java.util.Set viewerGroupNames

editorGroupNames

protected java.util.Set editorGroupNames

reviewUserNames

protected java.util.Set reviewUserNames

versions

protected java.util.ArrayList versions

tasks

protected java.util.ArrayList tasks
Constructor Detail

Page

public Page()
This constructor does nothing. Its purpose is to prevent JDO from calling the real constructor when populating a HashMap of root Pages, thereby greatly speeding up sites with a large number root Pages. This makes a huge speed difference for big sites.


Page

public Page(java.lang.String name,
            java.lang.String shortDesc,
            Page parent)

Page

public Page(java.lang.String name,
            java.lang.String shortDesc,
            Page parent,
            java.lang.String id)

Page

public Page(java.lang.String name,
            java.lang.String shortDesc,
            Page parent,
            int version)
Method Detail

isViewable

public boolean isViewable(UserValueObject userVO)
Determines if the current page is viewable.

The page is viewable if...

  1. The page is not associated with specific viewer groups
  2. The user is in the Group.SITE_ADMINISTRATORS group
  3. The user is in a group that corresponds to page viewer groups
  4. The user can edit the page

Parameters:
userVO - Current user.
Returns:
True if current user can view this page.

isEditable

public boolean isEditable(UserValueObject userVO)
The page is editable if it is not locked by another user, and either ...
  1. The username is User.SITE_ADMINISTRATOR, or
  2. the user is in a group that corresponds to page editor groups.
Public visitors can never edit.

Parameters:
userVO - Current user.
Returns:
True if current user can edit this page.

isInReview

public boolean isInReview()
Determines if page is currently being reviewed.

Returns:
True if page is currently in review by anyone, false otherwise.

isUserInEditorGroup

public boolean isUserInEditorGroup(UserValueObject userVO)
Used to determine if the user is in a group that can edit this page. Does not return any information about locking ... see isEditable if you need to determine if the user can edit this page with locking taken into account.


isLocked

public boolean isLocked()
Determines if this page is already locked.

Returns:
True if page is locked, false otherwise.

getComments

public java.lang.String getComments()
Gets an HTML formatted list of comments associated with this page.

Returns:
A formatted list of comments associated with this page, for example:

[Edited by jim on 9/11/04 at 10:32am] I added some new events

[Reviewed and rejected by admin on 9/11/04 at 11:45am] Looks like you need to spell check your changes.

[Edited by jim on 9/11/04 at 1:20pm] Corrected spellings.


getLastWorkingPageComments

public java.lang.String getLastWorkingPageComments()
Gets an HTML formatted list of comments associated with the most recent working page (this page if it is a working page).

Returns:
A formatted list of comments associated with most recent working page, for example:

[Edited by jim on 9/11/04 at 10:32am] I added some new events

[Reviewed and rejected by admin on 9/11/04 at 11:45am] Looks like you need to spell check your changes.

[Edited by jim on 9/11/04 at 1:20pm] Corrected spellings.


getLockingUser

public User getLockingUser()
                    throws DataAccessException
Returns the User who has this page locked.

Returns:
The User who has this page locked.
Throws:
DataAccessException - Thrown if the page is not locked.

lock

public Page lock(java.util.Date requestedCompletionDate,
                 User assignedTo,
                 User assignedBy,
                 java.lang.String pageURI,
                 java.lang.String comment)
          throws DataAccessException
Checks out, or "locks" a page. This action does a couple of things behind the scenes:
  1. Creates a new version of the page, the "working copy," leaving the existing version for regular viewing.
  2. Sets the working page's URI.
  3. Adds an uncompleted LOCK Task to the current page.

Parameters:
requestedCompletionDate - The requested completion date.
assignedTo - The user to whom the task was assigned.
assignedBy - The assigner of the task.
pageURI - The URI of the page, excluding the context path.
comment - A comment entered by the user or the system.
Returns:
The working copy of this page.
Throws:
DataAccessException - Thrown if there is any problem locking this page.

unlockAndSave

public void unlockAndSave(javax.servlet.ServletContext sc,
                          java.lang.String comment,
                          java.lang.String reviewType,
                          User user)
                   throws DataAccessException
If this page does not require a review, unlocks the current page if it's locked, makes the working copy page the live page, and puts the old page into the version list; if the page does require review, redirects to assignReviewer.

Unlocking a page involves a few steps behind the scenes, all of which are performed in an all-or-nothing transaction:

  1. Close the open LOCK Task on the current page
  2. Create a copy of the current page, move the current page's list of tasks to the copy, and add the copy to the list of versions
  3. Close the open edit task on the working copy page
  4. Replace the current page's list of tasks with those of the working page
  5. Copy the working page's name, description, content, images, repeat items, sub-links and sub-files to the current page, replacing those of the current page
  6. Remove the working page
  7. Increment the current page's version
One might ask why we do not simply delete the current page and make the working copy the current page. We do not do this because we want to make sure that any other page in the site which references the current page (for example, in a list of subpages, in a hard-coded link within a JSP, etc.) can point to page with the same automatically generated pageId. So, we must work with the same page since a new pageId would be generated for any other page.

Parameters:
comment - Comments will be saved with the LOCK Task that gets closed when this page is unlocked.
Throws:
DataAccessException - Lock and unlock operations must happen on non-working copy pages. Attempting to unlock a working copy page results in an exception.

unlockAndSave

public void unlockAndSave(javax.servlet.ServletContext sc,
                          java.lang.String comment,
                          java.lang.String reviewType,
                          User user,
                          boolean reviewTypeExt,
                          boolean doreview)
                   throws DataAccessException
If this page does not require a review, unlocks the current page if it's locked, makes the working copy page the live page, and puts the old page into the version list; if the page does require review and review-exten turn on then redirects to assignReviewers.

Unlocking a page involves a few steps behind the scenes, all of which are performed in an all-or-nothing transaction:

  1. Close the open LOCK Task on the current page
  2. Create a copy of the current page, move the current page's list of tasks to the copy, and add the copy to the list of versions
  3. Close the open edit task on the working copy page
  4. Replace the current page's list of tasks with those of the working page
  5. Copy the working page's name, description, content, images, repeat items, sub-links and sub-files to the current page, replacing those of the current page
  6. Remove the working page
  7. Increment the current page's version
One might ask why we do not simply delete the current page and make the working copy the current page. We do not do this because we want to make sure that any other page in the site which references the current page (for example, in a list of subpages, in a hard-coded link within a JSP, etc.) can point to page with the same automatically generated pageId. So, we must work with the same page since a new pageId would be generated for any other page.

Parameters:
comment - Comments will be saved with the LOCK Task that gets closed when this page is unlocked.
Throws:
DataAccessException - Lock and unlock operations must happen on non-working copy pages. Attempting to unlock a working copy page results in an exception.

getSite

public Site getSite()
Gets the Site to which this page belongs.

Returns:
The Site to which this page belongs.

sendBackToEditor

public void sendBackToEditor(java.lang.String comment)
                      throws DataAccessException
Sends the page being reviewed back to the originating editor for further updates.

Parameters:
comment - The reviewer's comments
Throws:
DataAccessException

unlockAndCancel

public void unlockAndCancel(javax.servlet.ServletContext sc,
                            java.lang.String comment,
                            User user)
                     throws DataAccessException
Unlocks the current Page and discards all edits that have been made to its working copy.

Throws:
DataAccessException - Lock and unlock operations must happen on non-working copy pages. Attempting to unlock a working copy page results in an exception.

addOpenTask

public void addOpenTask(int type,
                        java.util.Date requestedCompletionDate,
                        User assignedTo,
                        User assignedBy,
                        java.lang.String comment)
Adds a new, open task to the current page. If there are any open tasks of the same type, they are closed with a system message before the new task is added, and a message is logged.

Parameters:
type - The type of open task to add.
requestedCompletionDate - The requested completion date.
assignedTo - The user to whom the task was assigned.
assignedBy - The assigner of the task.
comment - A comment entered by the user or the system.

addOpenTaskWithOutClosePreviousTask

public void addOpenTaskWithOutClosePreviousTask(int type,
                                                java.util.Date requestedCompletionDate,
                                                User assignedTo,
                                                User assignedBy,
                                                java.lang.String comment)
Adds a new, open task to the current page. If there are any open tasks of the same type, they are not get closed.

Parameters:
type - The type of open task to add.
requestedCompletionDate - The requested completion date.
assignedTo - The user to whom the task was assigned.
assignedBy - The assigner of the task.
comment - A comment entered by the user or the system.

closeOpenTasks

public int closeOpenTasks(int type,
                          java.lang.String comment)
Closes any open tasks in the current object that have the specified type.

Parameters:
type - The Task.TaskType of the task(s) to be closed.
comment - The comment to add to the comment fields of the Tasks being closed.
Returns:
The number of tasks closed.

getFirstOpenTaskByType

public Task getFirstOpenTaskByType(int type)
Finds the first open task of the specified type in this object and returns it.

Parameters:
type - The task type to find.
Returns:
The first open Task of type in this object, or null if none exist.

getOpenTasksByType

public java.util.Collection getOpenTasksByType(int type)
Finds the first open task of the specified type in this object and returns it.

Parameters:
type - The task type to find.
Returns:
The first open Task of type in this object, or null if none exist.

getFirstOpenTask

public Task getFirstOpenTask()
Finds the first open task in this object and returns it.

Returns:
The first open Task in this object, or null if none exist.

getFirstOpenTaskType

public java.lang.String getFirstOpenTaskType()
Gets type of first open task in string form.

Returns:
Type of first open task in string form.

getFirstOpenTaskDate

public java.lang.String getFirstOpenTaskDate()
Gets date of first open task in string form.

Returns:
Date string of first open task in string form.

getVersion

public Page getVersion(int version)
Returns the version of this object with the specified version number.

Parameters:
version - The version number of the page to be returned. If the version does not exist, returns null.

getCurrentWorkingCopy

public Page getCurrentWorkingCopy()
Gets the current working copy of this object. This should be the latest version in the version list, but this method will check all versions if that is not the case.

Returns:
Returns the current working copy of this object, or null if none exist.

getCurrentVersion

public Page getCurrentVersion()
                       throws DataAccessException
Gets the current page with this id.

Returns:
The current version of this page (not a working copy or old version).
Throws:
DataAccessException

getLockingPage

public Page getLockingPage()
                    throws DataAccessException
Gets the Page which has this Page locked.

Throws:
DataAccessException - If this Page is not a working copy, or if multiple locking pages are found.

getLockingPageId

public java.lang.String getLockingPageId()
Returns the page id of the page that has this one locked.

Returns:
ID of page that has this one locked, or null if this page is not locked.

isChildLinkEditable

public boolean isChildLinkEditable(UserValueObject userVO,
                                   boolean isParentEditable)
Indicates if this object is editable.

Specified by:
isChildLinkEditable in class Node
Parameters:
userVO - Current user.
isParentEditable - True if parent is editable.
Returns:
True if this object is editable.

isChildLinkViewable

public boolean isChildLinkViewable(UserValueObject userVO,
                                   boolean isParentViewable)
Indicates if this object is viewable.

Specified by:
isChildLinkViewable in class Node
Parameters:
userVO - Current user.
isParentViewable - True if parent is viewable.
Returns:
True if this object is viewable.

replaceEditorGroups

public void replaceEditorGroups(java.lang.String[] newEditorGroups)
Removes any editor group values and replaces them with the values contained in the supplied newEditorGroups array. If newEditorGroups is null or empty, the editor groups are cleared and no groups are replaced.

Parameters:
newEditorGroups - String[] array containing group names that will be replace any existing editor groups for the page.

replaceReviewUsers

public void replaceReviewUsers(java.lang.String[] newReviewUsers)
Removes any review user values and replaces them with the values contained in the supplied newReviewUsernames array.If newReviewUserNames is null or empty, the review users are cleared and no groups are replaced.


recursiveReplaceEditorGroups

public void recursiveReplaceEditorGroups(java.lang.String[] newEditorGroups)
Replaces editor groups for this Page and all of it's children recursively.

Parameters:
newEditorGroups - String[] array containing group names that will be replace any existing editor groups for the page.

recursiveReplaceReviewUsers

public void recursiveReplaceReviewUsers(java.lang.String[] newReviewUsers)
Replaces review users for this Page and all of it's children recursively.


getEditorGroupNames

public java.util.Set getEditorGroupNames()
Provides access to this Page's editor group names.

Returns:
This Page's editor group names.

getEditorGroupNamesArray

public java.lang.String[] getEditorGroupNamesArray()
Provides access to this Page's editor group names.

Returns:
This Page's editor group names.

getReviewUserNames

public java.util.Set getReviewUserNames()
Provides access to this Page's review user names.

Returns:
This Page's review user names.

getReviewUserNamesArray

public java.lang.String[] getReviewUserNamesArray()
Provides access to this Page's review user names.

Returns:
This Page's review user names as String array.

getReviewUserNamesCopy

protected java.util.Set getReviewUserNamesCopy()
Returns a "shallow" copy of the Set of this Page's review group names.


replaceViewerGroups

public void replaceViewerGroups(java.lang.String[] newViewerGroups)
Removes any viewer group values and replaces them with the values contained in the supplied newViewerGroups array. If newViewerGroups is null or empty, the viewer groups are cleared and no groups are replaced.

Parameters:
newViewerGroups - String array containing group names that will be replace any existing viewer groups for the page.

recursiveReplaceViewerGroups

public void recursiveReplaceViewerGroups(java.lang.String[] newViewerGroups)
Applies the supplied permissions to this page and all of its descendent pages.

Parameters:
newViewerGroups - The new groups to use.

getViewerGroupNames

public java.util.Set getViewerGroupNames()
Provides access to this Page's viewer groups.

Returns:
This Page's viewer groups.

getViewerGroupNamesArray

public java.lang.String[] getViewerGroupNamesArray()

getURI

public java.lang.String getURI(java.lang.String parentTemplateFile)
Deprecated. Replaced by getURI(String,String). This deprecated version will assume an empty contextPath.

Gets the current page's URI

Overrides:
getURI in class Node
Parameters:
parentTemplateFile - The JSP file that represents the page's template
Returns:
The page's URI, adjusted for contextPath

getURI

public java.lang.String getURI(java.lang.String parentTemplateFile,
                               java.lang.String contextPath)
Gets the current page's URI

Specified by:
getURI in class Node
Parameters:
parentTemplateFile - The JSP file that represents the page's template
contextPath - The current context path.
Returns:
The page's URI, adjusted for contextPath

moveChildNodeUp

public void moveChildNodeUp(int nodeIndex)
Moving up means giving the Node a larger index. If the supplied index is out of bounds, then nothing happens.

Parameters:
nodeIndex - Index of the Node to move.

moveChildNodeDown

public void moveChildNodeDown(int nodeIndex)
Moving up means giving the Node a smaller index.

Parameters:
nodeIndex - Index of the Node to move.

addChildPage

public Page addChildPage(java.lang.String name,
                         java.lang.String shortDesc)
Adds a new child page and returns it.

Parameters:
name - Name of child.
shortDesc - Short description of child.
Returns:
Page object corresponding to child.

addChildPage

public Page addChildPage(java.lang.String name,
                         java.lang.String shortDesc,
                         java.lang.String id)
Use the other addChildPage method in preference over this one. Here we pass in the id (PK), but typically it will be generated automatically by the constructor. We created this method to assist in data migration operations.

Parameters:
name - Name of child.
id - NuContent ID of child.
shortDesc - Short description of child.
Returns:
Page object corresponding to child.

addChildPage

public Page addChildPage(java.lang.String name,
                         java.lang.String shortDesc,
                         int orderIndex)
Adds child at specified index.

Parameters:
name - Name of child.
orderIndex - Index of child.
shortDesc - Short description of child.
Returns:
Page object corresponding to child.

addChildPage

public Page addChildPage(java.lang.String name,
                         java.lang.String shortDesc,
                         int orderIndex,
                         java.lang.String id)
Adds child at specified index and with specified ID.

Parameters:
name - Name of child.
id - NuContent ID of child.
orderIndex - Index of child.
shortDesc - Short description of child.
Returns:
Page object corresponding to child.

removeChildNode

public void removeChildNode(Node node)
                     throws DataAccessException
Remove the specified child object.

Parameters:
node - The object to remove.
Throws:
DataAccessException - Thrown if there's trouble removing the child.

addChildFile

public File addChildFile(File file)
Adds a new child file to the end of the subpage list and returns the new File object.

Parameters:
file - Object to add.
Returns:
The new object.

addChildFile

public File addChildFile(File file,
                         int orderIndex)
Adds a new child file at the orderIndex location in the subpage list and returns the new File object.


addChildLink

public Node addChildLink(Link link)

addChildLink

public Node addChildLink(Link link,
                         int orderIndex)

getChildNodeList

public java.util.ArrayList getChildNodeList()
Returns a list of all nodes that are children of this page.

Returns:
A list of all nodes that are children of this page.

getChildPageList

public java.util.Collection getChildPageList()
Returns list of pages that list this page as their parent. This function does not return all nodes, just pages.

Returns:
A list of pages that list this page as their parent.

getChildPageListSortByName

public java.util.Collection getChildPageListSortByName()
Returns list of pages that list this page as their parent. This function does not return all nodes, just pages. Sorts by page name.

Returns:
A list of pages that list this page as their parent.

getFullNavTreeList

public java.util.ArrayList getFullNavTreeList()
Returns ArrayList of Node objects with their transient generation and isSelected fields set. This will allow the TagSubsections tag to simply iterate through the list and print the print the links based on the information contained in the objects.


getGeneration

public int getGeneration()
Calculates and returns the generation. Root pages have a generation of zero. The first level has a generation of 1, etc. Note that this method is not terribly efficient - if you will need to obtain the generation multiple times, you should populate the transientGeneration property instead. See the getFullNavTreeList() implementation for an example.


addContent

public void addContent(java.lang.String contentId,
                       java.lang.String text)
                throws DataAccessException
Adds the supplied content to the db.

Throws:
DataAccessException - if content already exists for the pageId / contentId combination.

updateContent

public void updateContent(java.lang.String contentId,
                          java.lang.String text)
                   throws DataAccessException
Throws:
DataAccessException

updateContent

public void updateContent(java.lang.String contentId,
                          java.lang.String text,
                          java.lang.String type)
                   throws DataAccessException
Throws:
DataAccessException

removeContent

public void removeContent(java.lang.String contentId)
                   throws DataAccessException
Throws:
DataAccessException

getContent

public Content getContent(java.lang.String contentId)

getContentCreateIfNeeded

public Content getContentCreateIfNeeded(java.lang.String contentId,
                                        java.lang.String defaultContent)
                                 throws DataAccessException
Throws:
DataAccessException

addImage

public void addImage(Image image)
              throws DataAccessException
Adds the supplied image to the db.

Throws:
DataAccessException - if image already exists for the pageId / imageId combination.

removeImage

public void removeImage(java.lang.String imageId)
                 throws DataAccessException
Removes an image, but does not remove corresponding file.

Parameters:
imageId - The image's unique id.
Throws:
DataAccessException - Thrown if the image with the corresponding id cannot be found.

getImage

public Image getImage(java.lang.String imageId)
               throws DataAccessException
Returns the image associated with the supplied imageId.

Throws: