com.day.cq.wcm.api
Interface PageManager


public interface PageManager

The page manager provides methods for page level operations.


Method Summary
 Page copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict)
          Copies the given page to the new destination
 Resource copy(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict)
          Copies the given resource to the new destination
 Page create(String parentPath, String pageName, String template, String title)
          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, String label, String comment)
          Create a revision of some page.
 void delete(Page page, boolean shallow)
          Deletes the page
 void delete(Resource resource, boolean shallow)
          Deletes the resource
 Collection<Blueprint> getBlueprints(String parentPath)
          Returns a collection of all available site templates.
 Collection<Revision> getChildRevisions(String parentPath, Calendar cal)
          Return all child revisions of some page.
 Page getContainingPage(Resource resource)
          Returns the page that contains this resource.
 Page getContainingPage(String path)
          Returns the page that contains the resource at the given path.
 Page getPage(String path)
          Convenience method that returns the page at the given path.
 Collection<Revision> getRevisions(String path, Calendar cal)
          Return all revisions of some page.
 Template getTemplate(String templatePath)
          Returns the template with the given name
 Collection<Template> getTemplates(String parentPath)
          Returns a collection of all available templates.
 Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs)
          Moves the given page to the new destination.
 Resource move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs)
          Moves the given resource to the new destination.
 void order(Page page, String beforeName)
          Orders the given page before the one with the name specified by beforeName if it's null the page is ordered at the end of its siblings.
 void order(Resource resource, String beforeName)
          Orders the given resource before the one with the name specified by beforeName if it's null the resource is ordered at the end of its siblings.
 Page restore(String path, String revisionId)
          Restore a revision of some page.
 Page restoreTree(String path, Calendar date)
          Restore a tree.
 

Method Detail

getPage

Page 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.

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(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(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.

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.

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. If source and destination are equals the page is just ordered.

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.

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. If source and destination are equals the resource is just ordered.

Parameters:
resource - the resource to move
destination - the path of the new destination
beforeName - the name of the next resource. if null the resource is ordered at the end.
shallow - if true only the resource content is moved. this is currently only supported for pages.
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 resource at the new location
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

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

Resource copy(Resource resource,
              String destination,
              String beforeName,
              boolean shallow,
              boolean resolveConflict)
              throws WCMException
Copies the given resource to the new destination

Parameters:
resource - the resource to copy
destination - the destination
beforeName - the name of the next resource. if null the resource is ordered at the end.
shallow - if true a non-recursive copy is performed. this is currently only supported for pages.
resolveConflict - if true resolves name conflict if destination already exists.
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

Parameters:
page - the page to delete
shallow - if true 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(Resource resource,
            boolean shallow)
            throws WCMException
Deletes the resource

Parameters:
resource - the resource to delete
shallow - if true 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.

order

void order(Page page,
           String beforeName)
           throws WCMException
Orders the given page before the one with the name specified by beforeName if it's null the page is ordered at the end of its siblings.

Parameters:
page - the page to order
beforeName - the name of the next page
Throws:
WCMException - if an error during this operation occurs.

order

void order(Resource resource,
           String beforeName)
           throws WCMException
Orders the given resource before the one with the name specified by beforeName if it's null the resource is ordered at the end of its siblings.

Parameters:
resource - the resource to order
beforeName - the name of the next resource
Throws:
WCMException - if an error during this operation occurs.

getTemplate

Template getTemplate(String templatePath)
Returns the template with the given name

Parameters:
templatePath - the name of the template
Returns:
the new template

getTemplates

Collection<Template> getTemplates(String parentPath)
Returns a collection of all available templates. If the given path is not null only those templates are returned that are allowed to be used as page templates below that path.

Parameters:
parentPath - path of the parent page or null
Returns:
a collection of templates
See Also:
Template.isAllowed(String)

getBlueprints

Collection<Blueprint> getBlueprints(String parentPath)
Returns a collection of all available site templates. If the given path is not null only those templates are returned that are allowed to be used as page templates below that path.

Parameters:
parentPath - path of the parent page or null
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 nullThrows:
WCMException - if an error during this operation occurs.

createRevision

Revision createRevision(Page page,
                        String label,
                        String comment)
                        throws WCMException
Create a revision of some page.

Parameters:
page - the page to create a revision for
label - the optional label for the revision.
comment - the optional comment for the revision
Returns:
page revision or nullThrows:
WCMException - if an error during this operation occurs.
Since:
5.2

getRevisions

Collection<Revision> getRevisions(String path,
                                  Calendar cal)
                                  throws WCMException
Return all revisions of some page.

Parameters:
path - the path to return revisions for
cal - optional calendar value; if not null, return the revision of a page that has the latest creation date below or equal to this value
Returns:
iterator over revisions
Throws:
WCMException - if an error during this operation occurs.

getChildRevisions

Collection<Revision> getChildRevisions(String parentPath,
                                       Calendar cal)
                                       throws WCMException
Return all child revisions of some page.

Parameters:
parentPath - the path of the parent page
cal - optional calendar value; if not null, return the revision of a page that has the latest creation date below or equal to this value
Returns:
iterator over revisions
Throws:
WCMException - if an error during this operation occurs.

restore

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

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

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

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.


Copyright © 1993-2010 Day Management AG. All Rights Reserved.