Package com.day.cq.wcm.api
Interface PageManager
The page manager provides methods for page level operations.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncopy(PageManager.CopyOptions options) Copies the given page to the new destination.Copies the given page to the new destination and automatically saves the modificationscopy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave) Copies the given page to the new destinationcopy(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict) Copies the given resource to the new destination and automatically saves the modificationscopy(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave) Copies the given resource to the new destinationCreates a new page at the given path using the provided template as content template.Creates a new page at the given path using the provided template as content template.createRevision(Page page) Create a revision of some page.createRevision(Page page, String label, String comment) Create a revision of some page.voidDeletes the page and saves the change.voidDeletes the page.voidDeletes the resource and saves the change.voidDeletes the resource.voidDeletes the resource.getBlueprints(String parentPath) Deprecated.getChildRevisions(String parentPath, String treeRoot, Calendar cal) Return all revisions of child pages below the indicated path.getChildRevisions(String parentPath, Calendar cal) Return all revisions of child pages below the indicated path.getChildRevisions(String parentPath, Calendar cal, boolean includeNoLocal) Return all revisions of child pages below the indicated path.getContainingPage(String path) Returns the page that contains the resource at the given path.getContainingPage(Resource resource) Returns the page that contains this resource.Convenience method that returns the page at the given path.getRevisions(String path, Calendar cal) Return all revisions of the page at the indicated path.getRevisions(String path, Calendar cal, boolean includeNoLocal) Return all revisions of the page at the indicated path.getTemplate(String templatePath) Deprecated.UseTemplateManager.getTemplate(String)instead.getTemplates(String parentPath) Deprecated.move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs) Moves the given page to the new destination and automatically saves the changes.move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs, String[] publishRefs) Moves the given page to the new destination and automatically saves the changes.move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs) Moves the given resource to the new destination and automatically saves the changes.move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs, String[] publishRefs) Moves the given resource to the new destination and automatically saves the changes.voidOrders the given page before the one with the name specified bybeforeNameif it'snullthe page is ordered at the end of its siblings.voidOrders the given page before the one with the name specified bybeforeNameif it'snullthe page is ordered at the end of its siblings.voidOrders the given resource before the one with the name specified bybeforeNameif it'snullthe resource is ordered at the end of its siblings.voidOrders the given resource before the one with the name specified bybeforeNameif it'snullthe resource is ordered at the end of its siblings.override(PageManager.CopyOptions options) Overrides the given page.Restore a revision of a page.restoreTree(String path, Calendar date) Restore a tree.restoreTree(String path, Calendar date, boolean preserveNV) Restore a tree.voidTouches the given page by setting the last modified date and user and clears the replication status.
-
Method Details
-
getPage
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,nullis returned.- Parameters:
path- path of the page- Returns:
- page or
null
-
getContainingPage
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.- Parameters:
resource- resource to find the page for- Returns:
- page or
nullif not found.
-
getContainingPage
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.- Parameters:
path- path to find the page for- Returns:
- page or
nullif not found.
-
create
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. Changes are automatically saved.- Parameters:
parentPath- the path of the parent pagepageName- the name of the new pagetemplate- the template for the new pagetitle- the title of the new page- Returns:
- the page that was created
- Throws:
WCMException- if an error during this operation occurs.
-
create
Page 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.- Parameters:
parentPath- the path of the parent pagepageName- the name of the new pagetemplate- the template for the new pagetitle- the title of the new pageautoSave- iftruesaves the modifications.- Returns:
- the page that was created
- Throws:
WCMException- if an error during this operation occurs.
-
move
Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs) throws WCMException Moves the given page to the new destination and automatically saves the changes. If source and destination are equals the page is just ordered.- Parameters:
page- the page to movedestination- the path of the new destinationbeforeName- the name of the next page. ifnullthe page is ordered at the end.shallow- iftrueonly the page content is movedresolveConflict- iftrueresolves 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.
-
move
Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs, String[] publishRefs) throws WCMException Moves the given page to the new destination and automatically saves the changes. If source and destination are equals the page is just ordered.- Parameters:
page- the page to movedestination- the path of the new destinationbeforeName- the name of the next page. ifnullthe page is ordered at the end.shallow- iftrueonly the page content is movedresolveConflict- iftrueresolves name conflict if destination already exists.adjustRefs- list of paths to pages that refer to the moved one. those references will be adjusted.publishRefs- list of referencing paths that will be republished.- Returns:
- the new page at the new location
- Throws:
WCMException- if an error during this operation occurs.
-
move
Resource move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs) throws WCMException Moves the given resource to the new destination and automatically saves the changes. If source and destination are equals the resource is just ordered.- Parameters:
resource- the resource to movedestination- the path of the new destinationbeforeName- the name of the next resource. ifnullthe resource is ordered at the end.shallow- iftrueonly the resource content is moved. this is currently only supported for pages.resolveConflict- iftrueresolves 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 resource at the new location
- Throws:
WCMException- if an error during this operation occurs.
-
move
Resource move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs, String[] publishRefs) throws WCMException Moves the given resource to the new destination and automatically saves the changes. If source and destination are equals the resource is just ordered.- Parameters:
resource- the resource to movedestination- the path of the new destinationbeforeName- the name of the next resource. ifnullthe resource is ordered at the end.shallow- iftrueonly the resource content is moved. this is currently only supported for pages.resolveConflict- iftrueresolves name conflict if destination already exists.adjustRefs- list of paths to pages that refer to the moved one. those references will be adjusted.publishRefs- list of referencing paths that will be republished.- Returns:
- the new resource at the new location
- Throws:
WCMException- if an error during this operation occurs.
-
override
Overrides the given page.- Parameters:
options- the options for this override operation.pageorresourceare required to be defined, as well asdestination. Also, it is important to defineoverridePagein case the page already exists and needs to be overridden- Returns:
- the overridden page
- Throws:
WCMException- if an error during this operation occurs.
-
copy
Copies the given page to the new destination.- Parameters:
options- the options for this copy operation.pageorresourceare required defined, as well asdestination.- Returns:
- the copied page
- Throws:
WCMException- if an error during this operation occurs.
-
copy
Page 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- Parameters:
page- the page to copydestination- the destinationbeforeName- the name of the next page. ifnullthe page is ordered at the end.shallow- iftruea non-recursive copy is performed.resolveConflict- iftrueresolves name conflict if destination already exists.- Returns:
- the copied page
- Throws:
WCMException- if an error during this operation occurs.
-
copy
Page copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave) throws WCMException Copies the given page to the new destination- Parameters:
page- the page to copydestination- the destinationbeforeName- the name of the next page. ifnullthe page is ordered at the end.shallow- iftruea non-recursive copy is performed.resolveConflict- iftrueresolves name conflict if destination already exists.autoSave- iftruesaves the modifications.- Returns:
- the copied page
- Throws:
WCMException- if an error during this operation occurs.
-
copy
Resource copy(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict) throws WCMException Copies the given resource to the new destination and automatically saves the modifications- Parameters:
resource- the resource to copydestination- the destinationbeforeName- the name of the next resource. ifnullthe resource is ordered at the end.shallow- iftruea non-recursive copy is performed. this is currently only supported for pages.resolveConflict- iftrueresolves name conflict if destination already exists.- Returns:
- the copied resource
- Throws:
WCMException- if an error during this operation occurs.
-
copy
Resource copy(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave) throws WCMException Copies the given resource to the new destination- Parameters:
resource- the resource to copydestination- the destinationbeforeName- the name of the next resource. ifnullthe resource is ordered at the end.shallow- iftruea non-recursive copy is performed. this is currently only supported for pages.resolveConflict- iftrueresolves name conflict if destination already exists.autoSave- iftruesaves the modifications.- Returns:
- the copied resource
- Throws:
WCMException- if an error during this operation occurs.
-
delete
Deletes the page and saves the change.- Parameters:
page- the page to deleteshallow- iftrueonly the content of the page is deleted but not it's child pages- Throws:
WCMException- if an error during this operation occurs.
-
delete
Deletes the page.- Parameters:
page- the page to deleteshallow- iftrueonly the content of the page is deleted but not it's child pagesautoSave- iftruesaves the modifications.- Throws:
WCMException- if an error during this operation occurs.
-
delete
Deletes the resource and saves the change.- Parameters:
resource- the resource to deleteshallow- iftrueonly the content of the resource is deleted but not it's child resources. only supported for pages.- Throws:
WCMException- if an error during this operation occurs.
-
delete
Deletes the resource.- Parameters:
resource- the resource to deleteshallow- iftrueonly the content of the resource is deleted but not it's child resources. only supported for pages.autoSave- iftruesaves the modifications.- Throws:
WCMException- if an error during this operation occurs.
-
delete
void delete(Resource resource, boolean shallow, boolean autoSave, boolean archive) throws WCMException Deletes the resource.- Parameters:
resource- the resource to deleteshallow- iftrueonly the content of the resource is deleted but not it's child resources. only supported for pages.autoSave- iftruesaves the modifications.archive- iftruesaves the version for deleted resource.- Throws:
WCMException- if an error during this operation occurs.
-
order
Orders the given page before the one with the name specified bybeforeNameif it'snullthe page is ordered at the end of its siblings. Changes are automatically saved.- Parameters:
page- the page to orderbeforeName- the name of the next page- Throws:
WCMException- if an error during this operation occurs.
-
order
Orders the given page before the one with the name specified bybeforeNameif it'snullthe page is ordered at the end of its siblings.- Parameters:
page- the page to orderbeforeName- the name of the next pageautoSave- iftruesaves the modifications.- Throws:
WCMException- if an error during this operation occurs.
-
order
Orders the given resource before the one with the name specified bybeforeNameif it'snullthe resource is ordered at the end of its siblings. Changes are automatically saved.- Parameters:
resource- the resource to orderbeforeName- the name of the next resource- Throws:
WCMException- if an error during this operation occurs.
-
order
Orders the given resource before the one with the name specified bybeforeNameif it'snullthe resource is ordered at the end of its siblings.- Parameters:
resource- the resource to orderbeforeName- the name of the next resourceautoSave- iftruesaves the modifications.- Throws:
WCMException- if an error during this operation occurs.
-
getTemplate
Deprecated.UseTemplateManager.getTemplate(String)instead.Returns the template with the given name ornullif the template doesn't exist or the current user does not have read access on the template resource identified by the given path. This is the case on publish instances using default ACL configuration (anonymous cannot read templates).- Parameters:
templatePath- the name of the template- Returns:
- the new template
-
getTemplates
Deprecated.Returns a collection of all available templates. If the given path is notnullonly those templates are returned that are allowed to be used as page templates below that path.- Parameters:
parentPath- path of the parent page ornull- Returns:
- a collection of templates
- See Also:
-
getBlueprints
Deprecated.since 5.4 useBlueprintManager.getBlueprints()Returns a collection of all available site templates. If the given path is notnullonly those templates are returned that are allowed to be used as page templates below that path.- Parameters:
parentPath- path of the parent page ornull- Returns:
- a collection of templates
- See Also:
-
createRevision
Create a revision of some page.- Parameters:
page- the page to create a revision for- Returns:
- page revision or
nullif no revision was created - Throws:
WCMException- if an error during this operation occurs.
-
createRevision
Create a revision of some page.- Parameters:
page- the page to create a revision forlabel- the optional label for the revision. Note that the version label must be unique across all versions.comment- the optional comment for the revision- Returns:
- page revision or
nullif no revision was created - Throws:
WCMException- if an error during this operation occurs.- Since:
- 5.2
-
getRevisions
Return all revisions of the page at the indicated path. Note that only those revisions are returned that have a parent path matching the parent of the indicated page.- Parameters:
path- the path to return revisions forcal- optional calendar value; if notnull, return the revision of a page that has the latest creation date below or equal to this value- Returns:
- Collection of revisions
- Throws:
WCMException- if an error during this operation occurs.
-
getRevisions
Collection<Revision> getRevisions(String path, Calendar cal, boolean includeNoLocal) throws WCMException Return all revisions of the page at the indicated path. IfincludeNoLocalis true, revisions that have a prent path not matching the parent of the indicated page are included as well.- Parameters:
path- the path to return revisions forcal- optional calendar value; if notnull, return the revision of a page that has the latest creation date below or equal to this valueincludeNoLocal- iftruerevisions that have a prent path not matching the parent of the indicated page are included as well- Returns:
- Collection of revisions
- Throws:
WCMException- if an error during this operation occurs.
-
getChildRevisions
Return all revisions of child pages below the indicated path. Only those revisions are included that have a parent path matching the indicated parent path and that don't have an existing node other than below this parent.- Parameters:
parentPath- the path of the parent pagecal- optional calendar value; if notnull, return the revision of a page that has the latest creation date below or equal to this value- Returns:
- Collection of revisions
- Throws:
WCMException- if an error during this operation occurs.
-
getChildRevisions
Collection<Revision> getChildRevisions(String parentPath, Calendar cal, boolean includeNoLocal) throws WCMException Return all revisions of child pages below the indicated path. Only those revisions are included that have a parent path matching the indicated parent path and that don't have an existing node other than below this parent. IfincludeNoLocalis true, also those revisions are included that where not versioned below the indicated parent path.- Parameters:
parentPath- the path of the parent pagecal- optional calendar value; if notnull, return the revision of a page that has the latest creation date below or equal to this valueincludeNoLocal- iftruerevisions that have a prent path not matching the parent of the indicated page are included as well- Returns:
- Collection of revisions
- Throws:
WCMException- if an error during this operation occurs.
-
getChildRevisions
Collection<Revision> getChildRevisions(String parentPath, String treeRoot, Calendar cal) throws WCMException Return all revisions of child pages below the indicated path. For calculating the best latest revision older thancalall revisions below the specifiedtreeRootare respected. But only those revisions are returned that match the givenparentPath- Parameters:
parentPath- the path of the parent pagetreeRoot- root of the treecal- optional calendar value; if notnull, return the revision of a page that has the latest creation date below or equal to this value- Returns:
- Collection of revisions
- Throws:
WCMException- if an error during this operation occurs.
-
restore
Restore a revision of a page. If a page content already exists for the specified revision id, its content is restored if thepatheither addresses that page or its parent page, otherwise a WCMException is thrown. If the page does not exist then the a new page is created underneath the specifiedpathand its content is restored accordingly. If there already exists a page with the same name as the one recorded in the version then a non-colliding name is generated.- Parameters:
path- path to the page or to the parent pagerevisionId- revision id to restore- Returns:
- the page that was restored
- Throws:
WCMException- if an error during this operation occurs.
-
restoreTree
Restore a tree. Restores this page and its subtree to the versions of the given date.- Parameters:
path- path to pagedate- calendar date to restore to- Returns:
- the page that was restored
- Throws:
WCMException- if an error during this operation occurs.
-
restoreTree
Restore a tree. Restores this page and its subtree to the versions of the given date.- Parameters:
path- path to pagedate- calendar date to restore topreserveNV- iftruenon versionable nodes are preserved- Returns:
- the page that was restored
- Throws:
WCMException- if an error during this operation occurs.
-
touch
Touches the given page by setting the last modified date and user and clears the replication status. ifnowisnullthe last modified status is not changed. ifclearReplisfalsethe replication status is not changed.- Parameters:
page- the page to touchshallow- iftruenot recursionnow- current dateclearRepl- flag indicates if replication status is to be cleared- Throws:
WCMException- if an error occurs
-
BlueprintManager.getBlueprints()