com.citytechinc.aem.bedrock.api.page
Interface PageManagerDecorator

All Superinterfaces:
PageManager

public interface PageManagerDecorator
extends PageManager

Decorates the CQ PageManager interface with additional methods for finding pages using queries, tags, and template paths.


Method Summary
 PageDecorator copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict)
          Copies the given page to the new destination and automatically saves the modifications
 PageDecorator copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave)
          Copies the given page to the new destination
 PageDecorator create(String parentPath, String pageName, String template, String title)
          Creates a new page at the given path using the provided template as content template.
 PageDecorator create(String parentPath, String pageName, String template, String title, boolean autoSave)
          Creates a new page at the given path using the provided template as content template.
 List<PageDecorator> findPages(String rootPath, Collection<String> tagIds, boolean matchOne)
          Find all descendant pages of the given path containing the specified tags.
 List<PageDecorator> findPages(String rootPath, Predicate<PageDecorator> predicate)
          Find all descendant pages of the given path that match the predicate.
 List<PageDecorator> findPages(String rootPath, String templatePath)
          Find all descendant pages of the given path matching the template path.
 PageDecorator getContainingPage(Resource resource)
          Returns the page that contains this resource.
 PageDecorator getContainingPage(String path)
          Returns the page that contains the resource at the given path.
 PageDecorator getPage(Page page)
          Decorate the given page.
 PageDecorator getPage(String path)
          Convenience method that returns the page at the given path.
 PageDecorator move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs)
          Moves the given page to the new destination.
 PageDecorator restore(String path, String revisionId)
          Restore a revision of some page.
 PageDecorator restoreTree(String path, Calendar date)
          Restore a tree.
 List<PageDecorator> search(Query query)
          Search for pages using a query.
 List<PageDecorator> search(Query query, int limit)
          Search for pages using a query with the given result limit.
 
Methods inherited from interface com.day.cq.wcm.api.PageManager
copy, copy, createRevision, createRevision, delete, delete, delete, delete, getBlueprints, getChildRevisions, getChildRevisions, getChildRevisions, getRevisions, getRevisions, getTemplate, getTemplates, move, order, order, order, order, restoreTree, touch
 

Method Detail

copy

PageDecorator copy(Page page,
                   String destination,
                   String beforeName,
                   boolean shallow,
                   boolean resolveConflict)
                   throws WCMException
Copies the given page to the new destination and automatically saves the modifications

Specified by:
copy in interface PageManager
Parameters:
page - the page to copy
destination - the destination
beforeName - the name of the next page. if null the page is ordered at the end.
shallow - if true a non-recursive copy is performed.
resolveConflict - if true resolves name conflict if destination already exists.
Returns:
the copied page
Throws:
WCMException - if an error during this operation occurs.

copy

PageDecorator copy(Page page,
                   String destination,
                   String beforeName,
                   boolean shallow,
                   boolean resolveConflict,
                   boolean autoSave)
                   throws WCMException
Copies the given page to the new destination

Specified by:
copy in interface PageManager
Parameters:
page - the page to copy
destination - the destination
beforeName - the name of the next page. if null the page is ordered at the end.
shallow - if true a non-recursive copy is performed.
resolveConflict - if true resolves name conflict if destination already exists.
autoSave - if true saves the modifications.
Returns:
the copied page
Throws:
WCMException - if an error during this operation occurs.

create

PageDecorator create(String parentPath,
                     String pageName,
                     String template,
                     String title)
                     throws WCMException
Creates a new page at the given path using the provided template as content template. If a no pageName is given but a title, then the title is used as hint for the name of the new page.

Specified by:
create in interface PageManager
Parameters:
parentPath - the path of the parent page
pageName - the name of the new page
template - the template for the new page
title - the title of the new page
Returns:
the page that was created
Throws:
WCMException - if an error during this operation occurs.

create

PageDecorator create(String parentPath,
                     String pageName,
                     String template,
                     String title,
                     boolean autoSave)
                     throws WCMException
Creates a new page at the given path using the provided template as content template. If a no pageName is given but a title, then the title is used as hint for the name of the new page.

Specified by:
create in interface PageManager
Parameters:
parentPath - the path of the parent page
pageName - the name of the new page
template - the template for the new page
title - the title of the new page
autoSave - if true saves the modifications.
Returns:
the page that was created
Throws:
WCMException - if an error during this operation occurs.

findPages

List<PageDecorator> findPages(String rootPath,
                              Collection<String> tagIds,
                              boolean matchOne)
Find all descendant pages of the given path containing the specified tags.

Parameters:
rootPath - root path
tagIds - set of tag IDs
matchOne - if true, 'OR' the specified tag IDs, 'AND' otherwise
Returns:
pages containing specified tags

findPages

List<PageDecorator> findPages(String rootPath,
                              String templatePath)
Find all descendant pages of the given path matching the template path.

Parameters:
rootPath - root path
templatePath - template path
Returns:
pages matching specified template

findPages

List<PageDecorator> findPages(String rootPath,
                              Predicate<PageDecorator> predicate)
Find all descendant pages of the given path that match the predicate.

Parameters:
rootPath - root path
predicate - predicate to determine if a page should be included in the result list
Returns:
pages matching filter criteria

getContainingPage

PageDecorator getContainingPage(Resource resource)
Returns the page that contains this resource. If the resource is a page the resource is returned. Otherwise it walks up the parent resources until a page is found.

Specified by:
getContainingPage in interface PageManager
Parameters:
resource - resource to find the page for
Returns:
page or null if not found.

getContainingPage

PageDecorator getContainingPage(String path)
Returns the page that contains the resource at the given path. If the path addresses a page, that page is returned. Otherwise it walks up the parent resources until a page is found.

Specified by:
getContainingPage in interface PageManager
Parameters:
path - path to find the page for
Returns:
page or null if not found.

getPage

PageDecorator getPage(Page page)
Decorate the given page.

Parameters:
page - non-null CQ page
Returns:
decorated page

getPage

PageDecorator getPage(String path)
Convenience method that returns the page at the given path. If the resource at that path does not exist or is not adaptable to Page, null is returned.

Specified by:
getPage in interface PageManager
Parameters:
path - path of the page
Returns:
page or null

move

PageDecorator move(Page page,
                   String destination,
                   String beforeName,
                   boolean shallow,
                   boolean resolveConflict,
                   String[] adjustRefs)
                   throws WCMException
Moves the given page to the new destination. If source and destination are equals the page is just ordered.

Specified by:
move in interface PageManager
Parameters:
page - the page to move
destination - the path of the new destination
beforeName - the name of the next page. if null the page is ordered at the end.
shallow - if true only the page content is moved
resolveConflict - if true resolves name conflict if destination already exists.
adjustRefs - list of paths to pages that refer to the moved one. those references will be adjusted.
Returns:
the new page at the new location
Throws:
WCMException - if an error during this operation occurs.

restore

PageDecorator restore(String path,
                      String revisionId)
                      throws WCMException
Restore a revision of some page.

Specified by:
restore in interface PageManager
Parameters:
path - path to the page or to the parent page
revisionId - revision id to restore
Returns:
the page that was restored
Throws:
WCMException - if an error during this operation occurs.

restoreTree

PageDecorator restoreTree(String path,
                          Calendar date)
                          throws WCMException
Restore a tree. Restores this page and its subtree to the versions of the given date.

Specified by:
restoreTree in interface PageManager
Parameters:
path - path to page
date - calendar date to restore to
Returns:
the page that was restored
Throws:
WCMException - if an error during this operation occurs.

search

List<PageDecorator> search(Query query)
Search for pages using a query.

Parameters:
query - JCR query
Returns:
list of pages for the query result

search

List<PageDecorator> search(Query query,
                           int limit)
Search for pages using a query with the given result limit.

Parameters:
query - JCR query
limit - result limit
Returns:
list of pages for the query result


Copyright © 2015 CITYTECH, Inc.. All rights reserved.