Package org.cid15.aem.veneer.api.page
Interface VeneeredPage
-
- All Superinterfaces:
Accessible
,Adaptable
,Inheritable
,com.day.cq.commons.LabeledResource
,Linkable
,Replicable
,Traversable<VeneeredPage>
public interface VeneeredPage extends Accessible, Inheritable, Linkable, Traversable<VeneeredPage>, Adaptable, com.day.cq.commons.LabeledResource, Replicable
Decorates the WCMPage
interface with additional convenience methods for traversing the content hierarchy and getters for Veneer classes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VeneeredPage
getAbsoluteParent(int level)
Returns the absolute parent page.Optional<VeneeredPage>
getChild(String name)
Get the child page of the current page by name.Optional<VeneeredResource>
getContentResource()
Get the veneered resource for the "jcr:content" node for this page.Optional<VeneeredResource>
getContentResource(String relativePath)
Get the veneered resource for the node at the given path relative to the "jcr:content" node for this page.Link
getLink(TitleType titleType)
Get a link with a specified title type for this item.LinkBuilder
getLinkBuilder(TitleType titleType)
Get a link builder for the current page path.Link
getNavigationLink(boolean isActive)
Get a navigation link for this page containing an active state.com.day.cq.wcm.api.Page
getPage()
Get the underlying WCM page.VeneeredPageManager
getPageManager()
Get the page manager for this page.VeneeredPage
getParent()
Returns the parent page if it's resource adapts to page.VeneeredPage
getParent(int level)
Returns the relative parent page.String
getTemplatePath()
Get the template path for this page.Optional<String>
getTitle(TitleType titleType)
Get the title with the given type for this page.Iterator<VeneeredPage>
listChildren()
List children of the current page.Iterator<VeneeredPage>
listChildren(Predicate<VeneeredPage> predicate)
List child pages of the current page filtered using the given predicate.Iterator<VeneeredPage>
listChildren(Predicate<VeneeredPage> predicate, boolean deep)
List child pages of the current page filtered using the given predicate.-
Methods inherited from interface org.cid15.aem.veneer.api.Accessible
get, get, getAsHref, getAsLink, getAsLinkBuilder, getAsList, getAsPage, getAsPageList, getAsResource, getAsResourceList, getAsType, getAsTypeList, getImageReference, getImageReference, getImageReference, getImageRendition, getImageRendition, getProperties, getTags, getTags, isHasImage, isHasImage
-
Methods inherited from interface org.cid15.aem.veneer.api.Inheritable
getAsHrefInherited, getAsLinkBuilderInherited, getAsLinkInherited, getAsListInherited, getAsPageInherited, getAsPageListInherited, getAsResourceInherited, getAsResourceListInherited, getAsTypeInherited, getAsTypeListInherited, getImageReferenceInherited, getImageReferenceInherited, getImageReferenceInherited, getInherited, getInherited, getResourceInherited, getResourcesInherited, getResourcesInherited, getResourcesInherited, getResourcesInherited, getTagsInherited, getTagsInherited
-
Methods inherited from interface com.day.cq.commons.LabeledResource
getDescription, getName, getPath, getTitle
-
Methods inherited from interface org.cid15.aem.veneer.api.Linkable
getHref, getLink, getLinkBuilder, getName, getPath
-
Methods inherited from interface org.cid15.aem.veneer.api.Replicable
getReplicationStatus
-
Methods inherited from interface org.cid15.aem.veneer.api.Traversable
findAncestor, findAncestor, findAncestorWithProperty, findAncestorWithProperty, findAncestorWithPropertyValue, findAncestorWithPropertyValue, findDescendants
-
-
-
-
Method Detail
-
getPage
com.day.cq.wcm.api.Page getPage()
Get the underlying WCM page.- Returns:
- page
-
listChildren
Iterator<VeneeredPage> listChildren()
List children of the current page.- Returns:
- iterator of child pages
-
listChildren
Iterator<VeneeredPage> listChildren(Predicate<VeneeredPage> predicate)
List child pages of the current page filtered using the given predicate.- Parameters:
predicate
- predicate to filter pages- Returns:
- filtered iterator of child pages
-
listChildren
Iterator<VeneeredPage> listChildren(Predicate<VeneeredPage> predicate, boolean deep)
List child pages of the current page filtered using the given predicate.- Parameters:
predicate
- predicate to filter pagesdeep
- if true, recursively iterate over all descendant pages- Returns:
- filtered iterator of child pages
-
getChild
Optional<VeneeredPage> getChild(String name)
Get the child page of the current page by name.- Parameters:
name
- name of the child- Returns:
- page or absent
Optional
-
getContentResource
Optional<VeneeredResource> getContentResource()
Get the veneered resource for the "jcr:content" node for this page. If the page does not have a content node, an "absent" Optional is returned.- Returns:
- optional veneered resource for page content
-
getContentResource
Optional<VeneeredResource> getContentResource(String relativePath)
Get the veneered resource for the node at the given path relative to the "jcr:content" node for this page. If the node does not exist, an "absent" Optional is returned.- Parameters:
relativePath
- relative path to resource- Returns:
- optional veneered resource for resource relative to page content
-
getLink
Link getLink(TitleType titleType)
Get a link with a specified title type for this item.- Parameters:
titleType
- type of title to set on link- Returns:
- link
-
getLinkBuilder
LinkBuilder getLinkBuilder(TitleType titleType)
Get a link builder for the current page path.- Parameters:
titleType
- type of title to set on builder- Returns:
- builder instance for this item
-
getNavigationLink
Link getNavigationLink(boolean isActive)
Get a navigation link for this page containing an active state. The returned link will use the navigation title as the link title, defaulting to the JCR title if it does not exist.- Parameters:
isActive
- active state to be set on returned link- Returns:
- navigation link
-
getTemplatePath
String getTemplatePath()
Get the template path for this page. This method is preferred over getTemplate().getPath(), which is dependent on access to /apps and will therefore fail in publish mode.- Returns:
- value of cq:template property or empty string if none exists
-
getTitle
Optional<String> getTitle(TitleType titleType)
Get the title with the given type for this page. If the title value is empty or non-existent, an absentOptional
is returned.- Parameters:
titleType
- type of title to retrieve- Returns:
- title value or absent
Optional
-
getAbsoluteParent
VeneeredPage 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
-
getParent
VeneeredPage getParent()
Returns the parent page if it's resource adapts to page.- Returns:
- the parent page or
null
-
getParent
VeneeredPage 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
-
getPageManager
VeneeredPageManager getPageManager()
Get the page manager for this page.- Returns:
- the page manager
-
-