org.liquidsite.core.content
Class ContentPage

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.Content
          extended byorg.liquidsite.core.content.ContentPage

public class ContentPage
extends Content

A web page. A page has optional links to a template and a section. A template link means that the page elements in the templates are inherited by this page. A section link means that any documents in the section can be presented by this page.


Field Summary
 
Fields inherited from class org.liquidsite.core.content.Content
DOCUMENT_CATEGORY, FILE_CATEGORY, FOLDER_CATEGORY, FORUM_CATEGORY, NAME_CHARS, PAGE_CATEGORY, POST_CATEGORY, SECTION_CATEGORY, SITE_CATEGORY, TEMPLATE_CATEGORY, TOPIC_CATEGORY, TRANSLATOR_CATEGORY
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
  ContentPage(ContentManager manager, Content parent)
          Creates a new page with default values.
protected ContentPage(ContentManager manager, ContentData data, DataSource src)
          Creates a new page.
 
Method Summary
protected  void doValidate()
          Validates the object data before writing to the database.
 java.util.List getAllElementNames(User user)
          Returns all page element names in this page and it's template.
 java.lang.String getElement(User user, java.lang.String name)
          Returns a named page element.
 java.util.List getLocalElementNames()
          Returns all page element names in this page.
 ContentTemplate getTemplate(User user)
          Returns the page template.
 int getTemplateId()
          Returns the tempate content identifier.
 void setElement(java.lang.String name, java.lang.String data)
          Sets the data for a named page element.
 void setTemplate(ContentTemplate template)
          Sets the page template.
 void setTemplateId(int template)
          Sets the template content identifier.
 
Methods inherited from class org.liquidsite.core.content.Content
deleteRevision, doDelete, doInsert, doUpdate, equals, equals, getAllRevisions, getAttribute, getAttributeNames, getAuthor, getAuthorName, getCategory, getComment, getDomain, getDomainName, getId, getLock, getMaxRevisionNumber, getModifiedDate, getName, getOfflineDate, getOnlineDate, getParent, getParentId, getPermissions, getRevision, getRevisionNumber, isLatestRevision, isOnline, isPublishedRevision, setAttribute, setAuthorName, setComment, setId, setModifiedDate, setName, setOfflineDate, setOnlineDate, setParent, setParentId, setRevisionNumber, toString
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentPage

public ContentPage(ContentManager manager,
                   Content parent)
            throws ContentException
Creates a new page with default values.

Parameters:
manager - the content manager to use
parent - the parent content object
Throws:
ContentException - if the database couldn't be accessed properly

ContentPage

protected ContentPage(ContentManager manager,
                      ContentData data,
                      DataSource src)
               throws ContentException
Creates a new page.

Parameters:
manager - the content manager to use
data - the content data object
src - the data source to use
Throws:
ContentException - if the database couldn't be accessed properly
Method Detail

getTemplate

public ContentTemplate getTemplate(User user)
                            throws ContentException,
                                   ContentSecurityException
Returns the page template.

Parameters:
user - the user performing the operation
Returns:
the page template, or null for none
Throws:
ContentException - if the database couldn't be accessed properly
ContentSecurityException - if the user didn't have read access to the template

setTemplate

public void setTemplate(ContentTemplate template)
Sets the page template.

Parameters:
template - the new template, or null for none

getTemplateId

public int getTemplateId()
Returns the tempate content identifier.

Returns:
the template content identifier

setTemplateId

public void setTemplateId(int template)
Sets the template content identifier.

Parameters:
template - the new template identifier

getAllElementNames

public java.util.List getAllElementNames(User user)
                                  throws ContentException,
                                         ContentSecurityException
Returns all page element names in this page and it's template. The returned collection is guaranteed to not contain any duplicates.

Parameters:
user - the user performing the operation
Returns:
a list of page element names
Throws:
ContentException - if the database couldn't be accessed properly
ContentSecurityException - if the user didn't have read access to the template

getLocalElementNames

public java.util.List getLocalElementNames()
Returns all page element names in this page. If a page element is not present in this collection, it may still be present in the template and thus returned by getElement().

Returns:
a list of page element names

getElement

public java.lang.String getElement(User user,
                                   java.lang.String name)
                            throws ContentException,
                                   ContentSecurityException
Returns a named page element. The element data will be retrieved from this page if possible, or from the template. The template parents will also be searched in the inheritance order, starting from the page template.

Parameters:
user - the user performing the operation
name - the page element name
Returns:
the page element data, or null if the page element didn't exist
Throws:
ContentException - if the database couldn't be accessed properly
ContentSecurityException - if the user didn't have read access to the template

setElement

public void setElement(java.lang.String name,
                       java.lang.String data)
Sets the data for a named page element. The element will be removed from this page if the data value is null. The page element values in the template will NOT be modified.

Parameters:
name - the page element name
data - the page element data, or null

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Overrides:
doValidate in class Content
Throws:
ContentException - if the object data wasn't valid