Package com.day.cq.wcm.api
Interface Page
-
- All Superinterfaces:
Adaptable
,LabeledResource
@ProviderType public interface Page extends Adaptable, LabeledResource
Defines the interface of a CQ WCM Page.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canUnlock()
Return a flag indicating whether the current user can unlock a page.Page
getAbsoluteParent(int level)
Returns the absolute parent page.Resource
getContentResource()
Returns the resource of the page's content ornull
if the page has no content.Resource
getContentResource(java.lang.String relPath)
Returns the addressed resource of the page's content ornull
if the respective resource does not exist.java.util.Calendar
getDeleted()
Checks if the page is in a deletion processjava.lang.String
getDeletedBy()
Return the user id that triggered the deletion of page ornull
if the page was not deleted.int
getDepth()
Returns the hierarchical depth of the page.java.util.Locale
getLanguage()
Returns the content language of the page.java.util.Locale
getLanguage(boolean ignoreContent)
Returns the content language of the page.java.util.Calendar
getLastModified()
Returns the time when the page was last modified ornull
if this information is not available or if the page has no content.java.lang.String
getLastModifiedBy()
Return the user id that last modified the page ornull
if this information is not available or if the page has no content.java.lang.String
getLockOwner()
Return the lock owner of a page.java.lang.String
getName()
Returns the name of the page.java.lang.String
getNavigationTitle()
Returns the navigation title of the page ornull
if none defined.java.util.Calendar
getOffTime()
Returns theoffTime
of the page.java.util.Calendar
getOnTime()
Returns theonTime
of the page.PageManager
getPageManager()
Convenience method that returns the manager of this page.java.lang.String
getPageTitle()
Returns the page title of the page ornull
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.java.lang.String
getPath()
Returns the path of the page.ValueMap
getProperties()
Returns a value map of the page content.ValueMap
getProperties(java.lang.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 ornull
if none defined or the current user does not have read access to the template resource specified by the path in the page's template property.java.lang.String
getTitle()
Returns the title of the page ornull
if none defined.java.lang.String
getVanityUrl()
Returns the vanity url.boolean
hasChild(java.lang.String name)
Checks if the page has a child page namedname
boolean
hasContent()
Checks if the page has content attached.boolean
isHideInNav()
Returns the "hideInNav" flag orfalse
if non defined.boolean
isLocked()
Checks if this page is locked.boolean
isValid()
Checks if the page is valid.java.util.Iterator<Page>
listChildren()
Returns an iterator over all child resources that adapt to a page.java.util.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.java.util.Iterator<Page>
listChildren(Filter<Page> filter, boolean deep)
Returns an iterator over descendant 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 com.day.cq.commons.LabeledResource
getDescription
-
-
-
-
Method Detail
-
getPath
java.lang.String getPath()
Returns the path of the page.- Specified by:
getPath
in interfaceLabeledResource
- Returns:
- path of the page.
-
getPageManager
PageManager getPageManager()
Convenience method that returns the manager of this page.- Returns:
- the page manager.
-
getContentResource
Resource getContentResource()
Returns the resource of the page's content ornull
if the page has no content.- Returns:
- resource or
null
- See Also:
hasContent()
-
getContentResource
Resource getContentResource(java.lang.String relPath)
Returns the addressed resource of the page's content ornull
if the respective resource does not exist. IfrelPath
isnull
or an empty string the toplevel content resource is returned.- Parameters:
relPath
- relative path into content- Returns:
- resource or
null
- Throws:
java.lang.IllegalArgumentException
- if path is not relative.
-
listChildren
java.util.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
java.util.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 benull
- Returns:
- iterator of child pages
-
listChildren
java.util.Iterator<Page> listChildren(Filter<Page> filter, boolean deep)
Returns an iterator over descendant resources that adapt to a page and that are included in the given filter. other child resources are skipped.- Parameters:
filter
- for iteration. may benull
deep
- false traverses only children; true traverses all descendants- Returns:
- iterator of child pages
-
hasChild
boolean hasChild(java.lang.String name)
Checks if the page has a child page namedname
- Parameters:
name
- Name of the child- Returns:
true
if the page has this child;false
otherwise.
-
getDepth
int getDepth()
Returns the hierarchical depth of the page. The depth is the number ofgetParent()
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
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
ValueMap getProperties(java.lang.String relPath)
Returns a value map of the address content of the page. If the addressed content does not exit,null
is returned. IfrelPath
isnull
or an empty string the toplevel content properties are returned.- Parameters:
relPath
- relative path to the content- Returns:
- a property map or
null
- Throws:
java.lang.IllegalArgumentException
- of the given path is not relative.
-
getName
java.lang.String getName()
Returns the name of the page. this is the last path segment of the page path.- Specified by:
getName
in interfaceLabeledResource
- Returns:
- page name
-
getTitle
java.lang.String getTitle()
Returns the title of the page ornull
if none defined. The title is a short form of the page title, usually displayed in the site admin.- Specified by:
getTitle
in interfaceLabeledResource
- Returns:
- title of the page
-
getPageTitle
java.lang.String getPageTitle()
Returns the page title of the page ornull
if none defined.- Returns:
- page title
-
getNavigationTitle
java.lang.String getNavigationTitle()
Returns the navigation title of the page ornull
if none defined. The navigation title is usually used when drawing navigation links.- Returns:
- navigation title
-
isHideInNav
boolean isHideInNav()
Returns the "hideInNav" flag orfalse
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 contentLong.MIN_VALUE
is returned.- Returns:
- milliseconds until page gets valid.
-
getOnTime
java.util.Calendar getOnTime()
Returns theonTime
of the page. The onTime defines after which time it is valid. If no onTime is specifiednull
is returned and the onTime is not respected in theisValid()
calculation.- Returns:
- onTime or
null
-
getOffTime
java.util.Calendar getOffTime()
Returns theoffTime
of the page. The offTime defines before which time it is valid. If no offTime is specifiednull
is returned and the offTime is not respected in theisValid()
calculation.- Returns:
- offTime or
null
-
getDeleted
java.util.Calendar getDeleted()
Checks if the page is in a deletion process- Returns:
modification date
if the page is in process to be deletednull
otherwise.
-
getDeletedBy
java.lang.String getDeletedBy()
Return the user id that triggered the deletion of page ornull
if the page was not deleted.- Returns:
- user id or
null
-
getLastModifiedBy
java.lang.String getLastModifiedBy()
Return the user id that last modified the page ornull
if this information is not available or if the page has no content.- Returns:
- user id or
null
-
getLastModified
java.util.Calendar getLastModified()
Returns the time when the page was last modified ornull
if this information is not available or if the page has no content.- Returns:
- last modification date or
null
-
getVanityUrl
java.lang.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
java.lang.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 ornull
if none defined or the current user does not have read access to the template resource specified by the path in the page's template property. This is the case on publish instances using default ACL configuration (anonymous cannot read templates).- Returns:
- template or
null
-
getLanguage
java.util.Locale getLanguage(boolean ignoreContent)
Returns the content language of the page. The language is usually defined on the page content via ajcr: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. IfignoreConent
istrue
, 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
- iftrue
only the path is used to determine the language.- Returns:
- the language of the content
-
getLanguage
java.util.Locale getLanguage()
Returns the content language of the page. The language is usually defined on the page content via ajcr: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. Note that this has nothing to do with i18n of the cq5 itself.- Returns:
- the language of the content
-
-