com.nurelm.nucontent.model
Class Site

java.lang.Object
  extended bycom.nurelm.nucontent.model.Site

public class Site
extends java.lang.Object

Corresponds to a NuContent Web site. Through this object, programmers can access every page on the entire site. NuContent provides access to the current Site object via each request in the attribute called "site".

For example, say we create a Site object in the usual way:

Site mySite = (Site) request.getAttribute("site");

Here's how to get a list of all root pages on the site:

ArrayList rootPages = (ArrayList) mySite.getRootPages();

Once a Page is retrieved, any piece of content in that object can easily be retrieved or modified.


Field Summary
protected static java.lang.String EXCEEDS_MAXIMUM_NUMBER_OF_USERS
           
protected static java.lang.String GROUP_ALREADY_EXISTS
           
protected static java.lang.String GROUP_NOT_FOUND
           
protected static java.lang.String ROOT_PAGE_ALREADY_EXISTS
           
protected static java.lang.String ROOT_PAGE_NOT_FOUND
           
protected static java.lang.String USER_ALREADY_EXISTS
           
protected static java.lang.String USER_NOT_FOUND
           
 
Method Summary
 Page addRootPage(java.lang.String contentGroupId)
          Creates a new root page containing a default name and short description.
 Page addRootPage(java.lang.String contentGroupId, java.lang.String id)
          Use the other addRootPage method in preference over this one.
 Group createGroup(java.lang.String groupname)
           
 User createUser(java.lang.String username)
           
 java.util.Collection getEditPages(java.lang.String username)
          Return a collection of all working Pages with open EDIT Tasks registered to the User with the given username.
 Group getGroup(java.lang.String groupname)
           
 java.lang.String[] getGroupNames()
           
 java.util.Collection getGroups()
           
 Group[] getGroups(java.lang.String[] groupnames)
           
 java.util.Collection getLockedPages(java.lang.String username)
          Return a collection of all Pages locked by the User with the given username.
 Node getNode(java.lang.String id)
          Returns the Node object associated with the supplied id.
 Node getNodeLockIfNeeded(java.lang.String id, UserValueObject userVO, java.lang.String pageURI, boolean isLockable)
          Returns the requested Node, but locks it and returns the working copy instead if necessary (if the Node is really a Page.
 java.util.Collection getNonSiteAdminUsers()
          Returns a Collection of Users who are all not in site admin group.
 java.util.Collection getNoReviewerAssinedWorkingPages()
          Return a collection of all the Pages that are workign versions of pages that are being reviewed and assigned no reviewer group user to review
 int getNumberOfUsers()
          Returns Existing number of users.
 int getNumberOfUsers(java.lang.String GroupName)
          Returns Existing number of users in the Group.
 java.util.Collection getOpenTasks()
          Returns all opened Tasks, sorted by username.
 Page getPageCreateRootIfNeeded(java.lang.String contentGroupId, java.lang.String pageId)
          First attempts to find the page based on the pageId.
 Page getPageLockIfNeeded(java.lang.String id, UserValueObject userVO, java.lang.String pageURI, boolean isLockable)
          Returns the requested Page, but locks it and returns the working copy instead if necessary.
 java.util.Collection getReviewPages(java.lang.String username)
          Return a collection of all working Pages with open REVIEW Tasks registered to the User with the given username.
 Page getRootPage(java.lang.String contentGroupId)
          Returns the root Page for the specified contentGroupId.
 Page getRootPageCreateIfNeeded(java.lang.String contentGroupId)
          Returns the specified root Page, but creates it if it does not exist.
 java.util.Collection getRootPages()
          Returns all of this Site's root Pages.
 Group getSiteAdminGroup()
           
 java.lang.String getSiteId()
          Provides access to the current Site's ID
 User getUser(java.lang.String username)
           
 java.util.Collection getUsers()
           
 java.util.Collection getUsersWithLockedPages()
          Returns a list of Users with locked pages, sorted by alpha.
 java.util.Collection getWorkingPagesForEdit(java.lang.String username)
          Return a collection of all the Pages that are workign versions of pages locked by the User with the given username that are being edited.
 java.util.Collection getWorkingPagesForReview(java.lang.String username)
          Return a collection of all the Pages that are workign versions of pages locked by the User with the given username that are being reviewed.
 boolean isGroupNameExists(java.lang.String groupname)
          Used to check if a group with the given name exists.
 boolean isPagedLockedByUser(java.lang.String pageId, java.lang.String username)
          Returns true if the page with the specified page id is locked by the specified user.
 UserValueObject login(java.lang.String username, java.lang.String password)
           
 void removeGroup(java.lang.String groupname)
           
 void removeRepeatItemsByLinkedPageId(java.lang.String linkedPageId)
          Removes any repeat items with the specified linkedPageId.
 void removeRootPage(java.lang.String contentGroupId)
          Removes the root page with the specified template ID from the data store.
 void removeUser(java.lang.String username)
           
 boolean rootPageExists(java.lang.String contentGroupId)
          Used to check if a root Page for the given content group id (also referred to as template id) exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_PAGE_NOT_FOUND

protected static final java.lang.String ROOT_PAGE_NOT_FOUND
See Also:
Constant Field Values

ROOT_PAGE_ALREADY_EXISTS

protected static final java.lang.String ROOT_PAGE_ALREADY_EXISTS
See Also:
Constant Field Values

USER_NOT_FOUND

protected static final java.lang.String USER_NOT_FOUND
See Also:
Constant Field Values

USER_ALREADY_EXISTS

protected static final java.lang.String USER_ALREADY_EXISTS
See Also:
Constant Field Values

GROUP_NOT_FOUND

protected static final java.lang.String GROUP_NOT_FOUND
See Also:
Constant Field Values

GROUP_ALREADY_EXISTS

protected static final java.lang.String GROUP_ALREADY_EXISTS
See Also:
Constant Field Values

EXCEEDS_MAXIMUM_NUMBER_OF_USERS

protected static final java.lang.String EXCEEDS_MAXIMUM_NUMBER_OF_USERS
See Also:
Constant Field Values
Method Detail

getSiteId

public java.lang.String getSiteId()
Provides access to the current Site's ID

Returns:
The current Site's ID.

rootPageExists

public boolean rootPageExists(java.lang.String contentGroupId)
Used to check if a root Page for the given content group id (also referred to as template id) exists.

Parameters:
contentGroupId - The template ID.
Returns:
true if a root page exists for the given contentGroupId and false if it does not.

getRootPage

public Page getRootPage(java.lang.String contentGroupId)
                 throws DataAccessException
Returns the root Page for the specified contentGroupId.

Parameters:
contentGroupId - The template ID
Returns:
The Page corresponding to the specified ID.
Throws:
DataAccessException - if a root Page does not exist for the contentGroupId.

getRootPages

public java.util.Collection getRootPages()
                                  throws DataAccessException
Returns all of this Site's root Pages.

Returns:
All of this Site's root Pages
Throws:
DataAccessException

getRootPageCreateIfNeeded

public Page getRootPageCreateIfNeeded(java.lang.String contentGroupId)
                               throws DataAccessException
Returns the specified root Page, but creates it if it does not exist.

Returns:
The Page object specified (or the new one just created if necessary)
Throws:
DataAccessException

getPageCreateRootIfNeeded

public Page getPageCreateRootIfNeeded(java.lang.String contentGroupId,
                                      java.lang.String pageId)
                               throws DataAccessException
First attempts to find the page based on the pageId. If no page exists with the supplied pageId, then an DataAccessException is thrown. If the pageId is null, it will look for a root page with the supplied contentGroupId. If none exist, a new root page will be created and returned. This method is used by com.nurelm.nucontent.TagHead. If a Web page is accessed with a pageId set in the query string, we assume that the page exists (or at least the user expects it to exist). Therefore, we do not create the page if the pageId is set; instead we throw an exception.

Throws:
DataAccessException

addRootPage

public Page addRootPage(java.lang.String contentGroupId)
                 throws DataAccessException
Creates a new root page containing a default name and short description. The parent field for root pages equals null.

Throws:
DataAccessException

addRootPage

public Page addRootPage(java.lang.String contentGroupId,
                        java.lang.String id)
                 throws DataAccessException
Use the other addRootPage 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 the data transformation from EJB to JDO.

Throws:
DataAccessException

removeRootPage

public void removeRootPage(java.lang.String contentGroupId)
                    throws DataAccessException
Removes the root page with the specified template ID from the data store.

Parameters:
contentGroupId - Also known as the template ID.
Throws:
DataAccessException

removeRepeatItemsByLinkedPageId

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

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

getNode

public Node getNode(java.lang.String id)
Returns the Node object associated with the supplied id.

Parameters:
id - The ID of the node to be fetched.
Returns:
The node corresponding to the id passed in.

getPageLockIfNeeded

public Page getPageLockIfNeeded(java.lang.String id,
                                UserValueObject userVO,
                                java.lang.String pageURI,
                                boolean isLockable)
Returns the requested Page, but locks it and returns the working copy instead if necessary.

Parameters:
id - The id of the page to be returned.
userVO - The user value object of the current user.
isLockable - True if the page has locking enabled.
Returns:
If necessary, the page returned is the working copy of a now locked page.

getNodeLockIfNeeded

public Node getNodeLockIfNeeded(java.lang.String id,
                                UserValueObject userVO,
                                java.lang.String pageURI,
                                boolean isLockable)
Returns the requested Node, but locks it and returns the working copy instead if necessary (if the Node is really a Page.

Parameters:
id - The id of the page to be returned.
userVO - The user value object of the current user.
isLockable - True if the page has locking enabled.
Returns:
If necessary, the page returned is the working copy of a now locked page.

getLockedPages

public java.util.Collection getLockedPages(java.lang.String username)
Return a collection of all Pages locked by the User with the given username.

Parameters:
username - The name of the User to be looked up.
Returns:
A Collection of Pages which have LOCK Tasks associated with the given User

isPagedLockedByUser

public boolean isPagedLockedByUser(java.lang.String pageId,
                                   java.lang.String username)
Returns true if the page with the specified page id is locked by the specified user.

Parameters:
username - The username of the user for which we are checking.
pageId - The ID of the page.
Returns:
Returns true if the given page is locked by the specified user.

getEditPages

public java.util.Collection getEditPages(java.lang.String username)
Return a collection of all working Pages with open EDIT Tasks registered to the User with the given username.

Parameters:
username - The name of the User to be looked up.
Returns:
A Collection of working Pages which have EDIT Tasks associated with the given User

getReviewPages

public java.util.Collection getReviewPages(java.lang.String username)
Return a collection of all working Pages with open REVIEW Tasks registered to the User with the given username.

Parameters:
username - The name of the User to be looked up.
Returns:
A Collection of working Pages which have REVIEW Tasks associated with the given User

getWorkingPagesForEdit

public java.util.Collection getWorkingPagesForEdit(java.lang.String username)
Return a collection of all the Pages that are workign versions of pages locked by the User with the given username that are being edited.

Parameters:
username - The name of the User to be looked up.
Returns:
A Collection of Pages which have LOCK Tasks associated with the given User that have an open Task type of type EDIT

getWorkingPagesForReview

public java.util.Collection getWorkingPagesForReview(java.lang.String username)
Return a collection of all the Pages that are workign versions of pages locked by the User with the given username that are being reviewed.

Parameters:
username - The name of the User to be looked up.
Returns:
A Collection of Pages which have LOCK Tasks associated with the given User that have an open Task type of type REVIEW

getNoReviewerAssinedWorkingPages

public java.util.Collection getNoReviewerAssinedWorkingPages()
                                                      throws DataAccessException
Return a collection of all the Pages that are workign versions of pages that are being reviewed and assigned no reviewer group user to review

Returns:
A Collection of Pages which have REVIEWS Tasks not associated with the Reviewer Group User that have an open Task type of type REVIEW
Throws:
DataAccessException

getUser

public User getUser(java.lang.String username)
             throws DataAccessException
Throws:
DataAccessException

createUser

public User createUser(java.lang.String username)
                throws DataAccessException
Throws:
DataAccessException

removeUser

public void removeUser(java.lang.String username)
                throws DataAccessException
Throws:
DataAccessException

getGroup

public Group getGroup(java.lang.String groupname)
               throws DataAccessException
Throws:
DataAccessException

getSiteAdminGroup

public Group getSiteAdminGroup()

getGroups

public Group[] getGroups(java.lang.String[] groupnames)
                  throws DataAccessException
Throws:
DataAccessException

createGroup

public Group createGroup(java.lang.String groupname)
                  throws DataAccessException
Throws:
DataAccessException

removeGroup

public void removeGroup(java.lang.String groupname)
                 throws DataAccessException
Throws:
DataAccessException

login

public UserValueObject login(java.lang.String username,
                             java.lang.String password)

getGroupNames

public java.lang.String[] getGroupNames()

getUsers

public java.util.Collection getUsers()

getNonSiteAdminUsers

public java.util.Collection getNonSiteAdminUsers()
Returns a Collection of Users who are all not in site admin group.

Returns:
Collection of users.

getUsersWithLockedPages

public java.util.Collection getUsersWithLockedPages()
Returns a list of Users with locked pages, sorted by alpha.

Returns:
List of users with locked pages.

getNumberOfUsers

public int getNumberOfUsers()
Returns Existing number of users.

Returns:
Exiting of number of user for the site.

getNumberOfUsers

public int getNumberOfUsers(java.lang.String GroupName)
                     throws DataAccessException
Returns Existing number of users in the Group.

Parameters:
GroupName - The name of the Group to be looked up.
Returns:
Exiting of number of users int the site's Group
Throws:
DataAccessException

getOpenTasks

public java.util.Collection getOpenTasks()
Returns all opened Tasks, sorted by username.

Returns:
List of open Tasks sorted by username

getGroups

public java.util.Collection getGroups()

isGroupNameExists

public boolean isGroupNameExists(java.lang.String groupname)
Used to check if a group with the given name exists.

Returns:
true if a group exists for the given group name and false if it does not.