Package com.day.cq.wcm.api
Interface Page
-
- All Superinterfaces:
Adaptable,LabeledResource
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 booleancanUnlock()Return a flag indicating whether the current user can unlock a page.PagegetAbsoluteParent(int level)Returns the absolute parent page.ResourcegetContentResource()Returns the resource of the page's content ornullif the page has no content.ResourcegetContentResource(java.lang.String relPath)Returns the addressed resource of the page's content ornullif the respective resource does not exist.java.util.CalendargetDeleted()Checks if the page is in a deletion processjava.lang.StringgetDeletedBy()Return the user id that triggered the deletion of page ornullif the page was not deleted.intgetDepth()Returns the hierarchical depth of the page.java.util.LocalegetLanguage()Returns the content language of the page.java.util.LocalegetLanguage(boolean ignoreContent)Returns the content language of the page.java.util.CalendargetLastModified()Returns the time when the page was last modified ornullif this information is not available or if the page has no content.java.lang.StringgetLastModifiedBy()Return the user id that last modified the page ornullif this information is not available or if the page has no content.java.lang.StringgetLockOwner()Return the lock owner of a page.java.lang.StringgetName()Returns the name of the page.java.lang.StringgetNavigationTitle()Returns the navigation title of the page ornullif none defined.java.util.CalendargetOffTime()Returns theoffTimeof the page.java.util.CalendargetOnTime()Returns theonTimeof the page.PageManagergetPageManager()Convenience method that returns the manager of this page.java.lang.StringgetPageTitle()Returns the page title of the page ornullif none defined.PagegetParent()Returns the parent page if it's resource adapts to page.PagegetParent(int level)Returns the relative parent page.java.lang.StringgetPath()Returns the path of the page.ValueMapgetProperties()Returns a value map of the page content.ValueMapgetProperties(java.lang.String relPath)Returns a value map of the address content of the page.Tag[]getTags()Returns the tags set on this page.TemplategetTemplate()Returns the template that was used to create this page ornullif 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.StringgetTitle()Returns the title of the page ornullif none defined.java.lang.StringgetVanityUrl()Returns the vanity url.booleanhasChild(java.lang.String name)Checks if the page has a child page namednamebooleanhasContent()Checks if the page has content attached.booleanisHideInNav()Returns the "hideInNav" flag orfalseif non defined.booleanisLocked()Checks if this page is locked.booleanisValid()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.voidlock()Lock a page.longtimeUntilValid()Returns the number of milliseconds when this page gets valid.voidunlock()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:
getPathin 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 ornullif 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 ornullif the respective resource does not exist. IfrelPathisnullor 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 benulldeep- 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:
trueif the page has this child;falseotherwise.
-
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,nullis 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,nullis 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,nullis returned. IfrelPathisnullor 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:
getNamein interfaceLabeledResource- Returns:
- page name
-
getTitle
java.lang.String getTitle()
Returns the title of the page ornullif none defined. The title is a short form of the page title, usually displayed in the site admin.- Specified by:
getTitlein interfaceLabeledResource- Returns:
- title of the page
-
getPageTitle
java.lang.String getPageTitle()
Returns the page title of the page ornullif none defined.- Returns:
- page title
-
getNavigationTitle
java.lang.String getNavigationTitle()
Returns the navigation title of the page ornullif none defined. The navigation title is usually used when drawing navigation links.- Returns:
- navigation title
-
isHideInNav
boolean isHideInNav()
Returns the "hideInNav" flag orfalseif 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:
trueif the page has content;falseotherwise.
-
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:
trueif the page is valid;falseotherwise.
-
timeUntilValid
long timeUntilValid()
Returns the number of milliseconds when this page gets valid. If the page is already valid,0is 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_VALUEis returned.- Returns:
- milliseconds until page gets valid.
-
getOnTime
java.util.Calendar getOnTime()
Returns theonTimeof the page. The onTime defines after which time it is valid. If no onTime is specifiednullis returned and the onTime is not respected in theisValid()calculation.- Returns:
- onTime or
null
-
getOffTime
java.util.Calendar getOffTime()
Returns theoffTimeof the page. The offTime defines before which time it is valid. If no offTime is specifiednullis 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 dateif the page is in process to be deletednullotherwise.
-
getDeletedBy
java.lang.String getDeletedBy()
Return the user id that triggered the deletion of page ornullif the page was not deleted.- Returns:
- user id or
null
-
getLastModifiedBy
java.lang.String getLastModifiedBy()
Return the user id that last modified the page ornullif 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 ornullif 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:
trueif this page is locked.
-
getLockOwner
java.lang.String getLockOwner()
Return the lock owner of a page.- Returns:
- lock owner;
nullif the page is not locked
-
canUnlock
boolean canUnlock()
Return a flag indicating whether the current user can unlock a page.- Returns:
trueif the page can be unlocked;falseotherwise
-
unlock
void unlock() throws WCMExceptionUnlock a page.- Throws:
WCMException- if an error during this operation occurs.
-
getTemplate
Template getTemplate()
Returns the template that was used to create this page ornullif 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:languageproperty 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. IfignoreConentistrue, 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- iftrueonly 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:languageproperty 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
-
-