Package com.day.cq.wcm.api
Interface PageManager
-
@ProviderType public interface PageManager
The page manager provides methods for page level operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PageManager.CopyOptions
Options object used forcopy(CopyOptions)
.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Resource
copy(PageManager.CopyOptions options)
Copies the given page to the new destination.Page
copy(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict)
Copies the given page to the new destination and automatically saves the modificationsPage
copy(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave)
Copies the given page to the new destinationResource
copy(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict)
Copies the given resource to the new destination and automatically saves the modificationsResource
copy(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave)
Copies the given resource to the new destinationPage
create(java.lang.String parentPath, java.lang.String pageName, java.lang.String template, java.lang.String title)
Creates a new page at the given path using the provided template as content template.Page
create(java.lang.String parentPath, java.lang.String pageName, java.lang.String template, java.lang.String title, boolean autoSave)
Creates a new page at the given path using the provided template as content template.Revision
createRevision(Page page)
Create a revision of some page.Revision
createRevision(Page page, java.lang.String label, java.lang.String comment)
Create a revision of some page.void
delete(Page page, boolean shallow)
Deletes the page and saves the change.void
delete(Page page, boolean shallow, boolean autoSave)
Deletes the page.void
delete(Resource resource, boolean shallow)
Deletes the resource and saves the change.void
delete(Resource resource, boolean shallow, boolean autoSave)
Deletes the resource.void
delete(Resource resource, boolean shallow, boolean autoSave, boolean archive)
Deletes the resource.java.util.Collection<Blueprint>
getBlueprints(java.lang.String parentPath)
Deprecated.since 5.4 useBlueprintManager.getBlueprints()
java.util.Collection<Revision>
getChildRevisions(java.lang.String parentPath, java.lang.String treeRoot, java.util.Calendar cal)
Return all revisions of child pages below the indicated path.java.util.Collection<Revision>
getChildRevisions(java.lang.String parentPath, java.util.Calendar cal)
Return all revisions of child pages below the indicated path.java.util.Collection<Revision>
getChildRevisions(java.lang.String parentPath, java.util.Calendar cal, boolean includeNoLocal)
Return all revisions of child pages below the indicated path.Page
getContainingPage(java.lang.String path)
Returns the page that contains the resource at the given path.Page
getContainingPage(Resource resource)
Returns the page that contains this resource.Page
getPage(java.lang.String path)
Convenience method that returns the page at the given path.java.util.Collection<Revision>
getRevisions(java.lang.String path, java.util.Calendar cal)
Return all revisions of the page at the indicated path.java.util.Collection<Revision>
getRevisions(java.lang.String path, java.util.Calendar cal, boolean includeNoLocal)
Return all revisions of the page at the indicated path.Template
getTemplate(java.lang.String templatePath)
Deprecated.UseTemplateManager.getTemplate(String)
instead.java.util.Collection<Template>
getTemplates(java.lang.String parentPath)
Deprecated.Page
move(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs)
Moves the given page to the new destination and automatically saves the changes.Page
move(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs, java.lang.String[] publishRefs)
Moves the given page to the new destination and automatically saves the changes.Resource
move(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs)
Moves the given resource to the new destination and automatically saves the changes.Resource
move(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs, java.lang.String[] publishRefs)
Moves the given resource to the new destination and automatically saves the changes.void
order(Page page, java.lang.String beforeName)
Orders the given page before the one with the name specified bybeforeName
if it'snull
the page is ordered at the end of its siblings.void
order(Page page, java.lang.String beforeName, boolean autoSave)
Orders the given page before the one with the name specified bybeforeName
if it'snull
the page is ordered at the end of its siblings.void
order(Resource resource, java.lang.String beforeName)
Orders the given resource before the one with the name specified bybeforeName
if it'snull
the resource is ordered at the end of its siblings.void
order(Resource resource, java.lang.String beforeName, boolean autoSave)
Orders the given resource before the one with the name specified bybeforeName
if it'snull
the resource is ordered at the end of its siblings.Page
restore(java.lang.String path, java.lang.String revisionId)
Restore a revision of a page.Page
restoreTree(java.lang.String path, java.util.Calendar date)
Restore a tree.Page
restoreTree(java.lang.String path, java.util.Calendar date, boolean preserveNV)
Restore a tree.void
touch(Node page, boolean shallow, java.util.Calendar now, boolean clearRepl)
Touches the given page by setting the last modified date and user and clears the replication status.
-
-
-
Method Detail
-
getPage
Page getPage(java.lang.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.- Parameters:
path
- path of the page- Returns:
- page or
null
-
getContainingPage
Page 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.- Parameters:
resource
- resource to find the page for- Returns:
- page or
null
if not found.
-
getContainingPage
Page getContainingPage(java.lang.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.- Parameters:
path
- path to find the page for- Returns:
- page or
null
if not found.
-
create
Page create(java.lang.String parentPath, java.lang.String pageName, java.lang.String template, java.lang.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. 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(java.lang.String parentPath, java.lang.String pageName, java.lang.String template, java.lang.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
- iftrue
saves the modifications.- Returns:
- the page that was created
- Throws:
WCMException
- if an error during this operation occurs.
-
move
Page move(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.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. ifnull
the page is ordered at the end.shallow
- iftrue
only the page content is movedresolveConflict
- iftrue
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.
-
move
Page move(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs, java.lang.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. ifnull
the page is ordered at the end.shallow
- iftrue
only the page content is movedresolveConflict
- iftrue
resolves 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, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.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. ifnull
the resource is ordered at the end.shallow
- iftrue
only the resource content is moved. this is currently only supported for pages.resolveConflict
- iftrue
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 resource at the new location
- Throws:
WCMException
- if an error during this operation occurs.
-
move
Resource move(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, java.lang.String[] adjustRefs, java.lang.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. ifnull
the resource is ordered at the end.shallow
- iftrue
only the resource content is moved. this is currently only supported for pages.resolveConflict
- iftrue
resolves 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.
-
copy
Resource copy(PageManager.CopyOptions options) throws WCMException
Copies the given page to the new destination.- Parameters:
options
- the options for this copy operation.page
orresource
are required defined, as well asdestination
.- Returns:
- the copied page
- Throws:
WCMException
- if an error during this operation occurs.
-
copy
Page copy(Page page, java.lang.String destination, java.lang.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. ifnull
the page is ordered at the end.shallow
- iftrue
a non-recursive copy is performed.resolveConflict
- iftrue
resolves name conflict if destination already exists.- Returns:
- the copied page
- Throws:
WCMException
- if an error during this operation occurs.
-
copy
Page copy(Page page, java.lang.String destination, java.lang.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. ifnull
the page is ordered at the end.shallow
- iftrue
a non-recursive copy is performed.resolveConflict
- iftrue
resolves name conflict if destination already exists.autoSave
- iftrue
saves the modifications.- Returns:
- the copied page
- Throws:
WCMException
- if an error during this operation occurs.
-
copy
Resource copy(Resource resource, java.lang.String destination, java.lang.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. ifnull
the resource is ordered at the end.shallow
- iftrue
a non-recursive copy is performed. this is currently only supported for pages.resolveConflict
- iftrue
resolves name conflict if destination already exists.- Returns:
- the copied resource
- Throws:
WCMException
- if an error during this operation occurs.
-
copy
Resource copy(Resource resource, java.lang.String destination, java.lang.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. ifnull
the resource is ordered at the end.shallow
- iftrue
a non-recursive copy is performed. this is currently only supported for pages.resolveConflict
- iftrue
resolves name conflict if destination already exists.autoSave
- iftrue
saves the modifications.- Returns:
- the copied resource
- Throws:
WCMException
- if an error during this operation occurs.
-
delete
void delete(Page page, boolean shallow) throws WCMException
Deletes the page and saves the change.- Parameters:
page
- the page to deleteshallow
- iftrue
only the content of the page is deleted but not it's child pages- Throws:
WCMException
- if an error during this operation occurs.
-
delete
void delete(Page page, boolean shallow, boolean autoSave) throws WCMException
Deletes the page.- Parameters:
page
- the page to deleteshallow
- iftrue
only the content of the page is deleted but not it's child pagesautoSave
- iftrue
saves the modifications.- Throws:
WCMException
- if an error during this operation occurs.
-
delete
void delete(Resource resource, boolean shallow) throws WCMException
Deletes the resource and saves the change.- Parameters:
resource
- the resource to deleteshallow
- iftrue
only 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
void delete(Resource resource, boolean shallow, boolean autoSave) throws WCMException
Deletes the resource.- Parameters:
resource
- the resource to deleteshallow
- iftrue
only the content of the resource is deleted but not it's child resources. only supported for pages.autoSave
- iftrue
saves 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
- iftrue
only the content of the resource is deleted but not it's child resources. only supported for pages.autoSave
- iftrue
saves the modifications.archive
- iftrue
saves the version for deleted resource.- Throws:
WCMException
- if an error during this operation occurs.
-
order
void order(Page page, java.lang.String beforeName) throws WCMException
Orders the given page before the one with the name specified bybeforeName
if it'snull
the 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
void order(Page page, java.lang.String beforeName, boolean autoSave) throws WCMException
Orders the given page before the one with the name specified bybeforeName
if it'snull
the page is ordered at the end of its siblings.- Parameters:
page
- the page to orderbeforeName
- the name of the next pageautoSave
- iftrue
saves the modifications.- Throws:
WCMException
- if an error during this operation occurs.
-
order
void order(Resource resource, java.lang.String beforeName) throws WCMException
Orders the given resource before the one with the name specified bybeforeName
if it'snull
the 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
void order(Resource resource, java.lang.String beforeName, boolean autoSave) throws WCMException
Orders the given resource before the one with the name specified bybeforeName
if it'snull
the resource is ordered at the end of its siblings.- Parameters:
resource
- the resource to orderbeforeName
- the name of the next resourceautoSave
- iftrue
saves the modifications.- Throws:
WCMException
- if an error during this operation occurs.
-
getTemplate
Template getTemplate(java.lang.String templatePath)
Deprecated.UseTemplateManager.getTemplate(String)
instead.Returns the template with the given name ornull
if 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
java.util.Collection<Template> getTemplates(java.lang.String parentPath)
Deprecated.Returns a collection of all available templates. If the given path is notnull
only 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:
Template.isAllowed(String)
-
getBlueprints
@Deprecated java.util.Collection<Blueprint> getBlueprints(java.lang.String parentPath)
Deprecated.since 5.4 useBlueprintManager.getBlueprints()
Returns a collection of all available site templates. If the given path is notnull
only 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:
Template.isAllowed(String)
-
createRevision
Revision createRevision(Page page) throws WCMException
Create a revision of some page.- Parameters:
page
- the page to create a revision for- Returns:
- page revision or
null
if no revision was created - Throws:
WCMException
- if an error during this operation occurs.
-
createRevision
Revision createRevision(Page page, java.lang.String label, java.lang.String comment) throws WCMException
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
null
if no revision was created - Throws:
WCMException
- if an error during this operation occurs.- Since:
- 5.2
-
getRevisions
java.util.Collection<Revision> getRevisions(java.lang.String path, java.util.Calendar cal) throws WCMException
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
java.util.Collection<Revision> getRevisions(java.lang.String path, java.util.Calendar cal, boolean includeNoLocal) throws WCMException
Return all revisions of the page at the indicated path. IfincludeNoLocal
is 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
- iftrue
revisions 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
java.util.Collection<Revision> getChildRevisions(java.lang.String parentPath, java.util.Calendar cal) 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.- 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
java.util.Collection<Revision> getChildRevisions(java.lang.String parentPath, java.util.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. IfincludeNoLocal
is 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
- iftrue
revisions 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
java.util.Collection<Revision> getChildRevisions(java.lang.String parentPath, java.lang.String treeRoot, java.util.Calendar cal) throws WCMException
Return all revisions of child pages below the indicated path. For calculating the best latest revision older thancal
all revisions below the specifiedtreeRoot
are respected. But only those revisions are returned that match the givenparentPath
- 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 valuetreeRoot
- root of the tree- Returns:
- Collection of revisions
- Throws:
WCMException
- if an error during this operation occurs.
-
restore
Page restore(java.lang.String path, java.lang.String revisionId) throws WCMException
Restore a revision of a page. If a page content already exists for the specified revision id, its content is restored if thepath
either 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 specifiedpath
and 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
Page restoreTree(java.lang.String path, java.util.Calendar date) throws WCMException
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
Page restoreTree(java.lang.String path, java.util.Calendar date, boolean preserveNV) throws WCMException
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
- iftrue
non versionable nodes are preserved- Returns:
- the page that was restored
- Throws:
WCMException
- if an error during this operation occurs.
-
touch
void touch(Node page, boolean shallow, java.util.Calendar now, boolean clearRepl) throws WCMException
Touches the given page by setting the last modified date and user and clears the replication status. ifnow
isnull
the last modified status is not changed. ifclearRepl
isfalse
the replication status is not changed.- Parameters:
page
- the page to touchshallow
- iftrue
not recursionnow
- current dateclearRepl
- flag indicates if replication status is to be cleared- Throws:
WCMException
- if an error occurs
-
-