com.day.cq.wcm.api
Interface Page

All Superinterfaces:
org.apache.sling.api.adapter.Adaptable, LabeledResource
All Known Implementing Classes:
PageImpl

public interface Page
extends org.apache.sling.api.adapter.Adaptable, LabeledResource

Defines the interface of a CQ WCM Page.


Method Summary
 boolean canUnlock()
          Return a flag indicating whether the current user can unlock a page.
 Page getAbsoluteParent(int level)
          Returns the absolute parent page.
 org.apache.sling.api.resource.Resource getContentResource()
          Returns the resource of the page's content or null if the page has no content.
 org.apache.sling.api.resource.Resource getContentResource(String relPath)
          Returns the addressed resource of the page's content or null if the respective resource does not exist.
 int getDepth()
          Returns the hierarchical depth of the page.
 Locale getLanguage(boolean ignoreContent)
          Returns the content language of the page.
 Calendar getLastModified()
          Returns the time when the page was last modified or null if this information is not available or if the page has no content.
 String getLastModifiedBy()
          Return the user id that last modified the page or null if this information is not available or if the page has no content.
 String getLockOwner()
          Return the lock owner of a page.
 String getName()
          Returns the name of the page.
 String getNavigationTitle()
          Returns the navigation title of the page or null if none defined.
 Calendar getOffTime()
          Returns the offTime of the page.
 Calendar getOnTime()
          Returns the onTime of the page.
 PageManager getPageManager()
          Convenience method that returns the manager of this page.
 String getPageTitle()
          Returns the page title of the page or null if none defined.
 Page getParent()
          Returns the parent page if it's resource adapts to page.
 Page getParent(int level)
          Returns the relative parent page.
 String getPath()
          Returns the path of the page.
 org.apache.sling.api.resource.ValueMap getProperties()
          Returns a value map of the page content.
 org.apache.sling.api.resource.ValueMap getProperties(String relPath)
          Returns a value map of the address content of the page.
 Tag[] getTags()
          Returns the tags set on this page.
 Template getTemplate()
          Returns the template that was used to create this page or null if none defined.
 String getTitle()
          Returns the title of the page or null if none defined.
 String getVanityUrl()
          Returns the vanity url.
 boolean hasContent()
          Checks if the page has content attached.
 boolean isHideInNav()
          Returns the "hideInNav" flag or false if non defined.
 boolean isLocked()
          Checks if this page is locked.
 boolean isValid()
          Checks if the page is valid.
 Iterator<Page> listChildren()
          Returns an iterator over all child resources that adapt to a page.
 Iterator<Page> listChildren(Filter<Page> filter)
          Returns an iterator over all child resources that adapt to a page and that are included in the given filter.
 void lock()
          Lock a page.
 long timeUntilValid()
          Returns the number of milliseconds when this page gets valid.
 void unlock()
          Unlock a page.
 
Methods inherited from interface org.apache.sling.api.adapter.Adaptable
adaptTo
 
Methods inherited from interface com.day.cq.commons.LabeledResource
getDescription
 

Method Detail

getPath

String getPath()
Returns the path of the page.

Specified by:
getPath in interface LabeledResource
Returns:
path of the page.

getPageManager

PageManager getPageManager()
Convenience method that returns the manager of this page.

Returns:
the page manager.

getContentResource

org.apache.sling.api.resource.Resource getContentResource()
Returns the resource of the page's content or null if the page has no content.

Returns:
resource or null
See Also:
hasContent()

getContentResource

org.apache.sling.api.resource.Resource getContentResource(String relPath)
Returns the addressed resource of the page's content or null if the respective resource does not exist. If relPath is null or an empty string the toplevel content resource is returned.

Parameters:
relPath - relative path into content
Returns:
resource or null
Throws:
IllegalArgumentException - if path is not relative.

listChildren

Iterator<Page> listChildren()
Returns an iterator over all child resources that adapt to a page. other child resources are skipped.

Returns:
iterator of child pages

listChildren

Iterator<Page> listChildren(Filter<Page> filter)
Returns an iterator over all child resources that adapt to a page and that are included in the given filter. other child resources are skipped.

Parameters:
filter - for iteration. may be null
Returns:
iterator of child pages

getDepth

int getDepth()
Returns the hierarchical depth of the page. The depth is the number of getParent() calls would be needed to reach the root node.

Returns:
the depth of the page.

getParent

Page getParent()
Returns the parent page if it's resource adapts to page.

Returns:
the parent page or null

getParent

Page getParent(int level)
Returns the relative parent page. If no page exists at that level, null is returned. Example (this path == /content/geometrixx/en/products) | level | returned | | 0 | /content/geometrixx/en/products | | 1 | /content/geometrixx/en | | 2 | /content/geometrixx | | 3 | /content | | 4 | null |

Parameters:
level - hierarchy level of the parent page to retrieve
Returns:
the respective parent page or null

getAbsoluteParent

Page getAbsoluteParent(int level)
Returns the absolute parent page. If no page exists at that level, null is returned. Example (this path == /content/geometrixx/en/products) | level | returned | | 0 | /content | | 1 | /content/geometrixx | | 2 | /content/geometrixx/en | | 3 | /content/geometrixx/en/products | | 4 | null |

Parameters:
level - hierarchy level of the parent page to retrieve
Returns:
the respective parent page or null

getProperties

org.apache.sling.api.resource.ValueMap getProperties()
Returns a value map of the page content. If the page has no content an empty map is returned.

Returns:
a value map
See Also:
hasContent()

getProperties

org.apache.sling.api.resource.ValueMap getProperties(String relPath)
Returns a value map of the address content of the page. If the addressed content does not exit, null is returned. If relPath is null or an empty string the toplevel content properties are returned.

Parameters:
relPath - relative path to the content
Returns:
a property map or null
Throws:
IllegalArgumentException - of the given path is not relative.

getName

String getName()
Returns the name of the page. this is the last path segment of the page path.

Specified by:
getName in interface LabeledResource
Returns:
page name

getTitle

String getTitle()
Returns the title of the page or null if none defined. The title is a short form of the page title, usually displayed in the site admin.

Specified by:
getTitle in interface LabeledResource
Returns:
title of the page

getPageTitle

String getPageTitle()
Returns the page title of the page or null if none defined.

Returns:
page title

getNavigationTitle

String getNavigationTitle()
Returns the navigation title of the page or null if none defined. The navigation title is usually used when drawing navigation links.

Returns:
navigation title

isHideInNav

boolean isHideInNav()
Returns the "hideInNav" flag or false if non defined. The hideInNav flag is usually used to control if a page should be displayed in a navigation.

Returns:
hide in navigation flag

hasContent

boolean hasContent()
Checks if the page has content attached.

Returns:
true if the page has content; false otherwise.

isValid

boolean isValid()
Checks if the page is valid. It is valid if it has content and if the on-/off time range spans the current time.

Returns:
true if the page is valid; false otherwise.

timeUntilValid

long timeUntilValid()
Returns the number of milliseconds when this page gets valid. If the page is already valid, 0 is returned. If the page is out dated, i.e. the offTime is in the past, a negative number is returned. If this page has no content Long.MIN_VALUE is returned.

Returns:
milliseconds until page gets valid.

getOnTime

Calendar getOnTime()
Returns the onTime of the page. The onTime defines after which time it is valid. If no onTime is specified null is returned and the onTime is not respected in the isValid() calculation.

Returns:
onTime or null

getOffTime

Calendar getOffTime()
Returns the offTime of the page. The offTime defines before which time it is valid. If no offTime is specified null is returned and the offTime is not respected in the isValid() calculation.

Returns:
offTime or null

getLastModifiedBy

String getLastModifiedBy()
Return the user id that last modified the page or null if this information is not available or if the page has no content.

Returns:
user id or null

getLastModified

Calendar getLastModified()
Returns the time when the page was last modified or null if this information is not available or if the page has no content.

Returns:
last modification date or null

getVanityUrl

String getVanityUrl()
Returns the vanity url.

Returns:
The vanity url for this page or null

getTags

Tag[] getTags()
Returns the tags set on this page.

Returns:
The tags set on this page.

lock

void lock()
          throws WCMException
Lock a page.

Throws:
WCMException - if an error during this operation occurs.

isLocked

boolean isLocked()
Checks if this page is locked.

Returns:
true if this page is locked.

getLockOwner

String getLockOwner()
Return the lock owner of a page.

Returns:
lock owner; null if the page is not locked

canUnlock

boolean canUnlock()
Return a flag indicating whether the current user can unlock a page.

Returns:
true if the page can be unlocked; false otherwise

unlock

void unlock()
            throws WCMException
Unlock a page.

Throws:
WCMException - if an error during this operation occurs.

getTemplate

Template getTemplate()
Returns the template that was used to create this page or null if none defined.

Returns:
template or null

getLanguage

Locale getLanguage(boolean ignoreContent)
Returns the content language of the page. The language is usually defined on the page content via a jcr:language property containing the iso codes for language and country. if the property is not defined on this page all ancestors are search for such an property. If no language is defined at all, the path is examined if it contains a iso label. If no language can be found at all, the systems default locale is returned. If ignoreConent is true, only the names of the path is used to determine the language. Note that this has nothing to do with i18n of the cq5 itself.

Parameters:
ignoreContent - if true only the path is used to determine the language.
Returns:
the language of the content


Copyright © 2008 Day Management AG. All Rights Reserved.