Interface PageManager


@ProviderType public interface PageManager
The page manager provides methods for page level operations.
  • Method Details

    • 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. Changes are automatically saved.
      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

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

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

      Resource override(PageManager.CopyOptions options) throws WCMException
      Overrides the given page.
      Parameters:
      options - the options for this override operation. page or resource are required to be defined, as well as destination. Also, it is important to define overridePage in 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. page or resource are required defined, as well as destination.
      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 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

      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 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.
    • 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 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.
    • 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 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.
      autoSave - if true 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 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(Page page, boolean shallow, boolean autoSave) 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
      autoSave - if true 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 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.
    • delete

      void delete(Resource resource, boolean shallow, boolean autoSave) 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.
      autoSave - if true 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 delete
      shallow - if true only the content of the resource is deleted but not it's child resources. only supported for pages.
      autoSave - if true saves the modifications.
      archive - if true saves the version for deleted resource.
      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. Changes are automatically saved.
      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(Page page, String beforeName, boolean autoSave) 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
      autoSave - if true saves the modifications.
      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. Changes are automatically saved.
      Parameters:
      resource - the resource to order
      beforeName - the name of the next resource
      Throws:
      WCMException - if an error during this operation occurs.
    • order

      void order(Resource resource, String beforeName, boolean autoSave) 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
      autoSave - if true saves the modifications.
      Throws:
      WCMException - if an error during this operation occurs.
    • getTemplate

      Template getTemplate(String templatePath)
      Deprecated.
      Returns the template with the given name or null 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

      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:
    • getBlueprints

      @Deprecated Collection<Blueprint> getBlueprints(String parentPath)
      Deprecated.
      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:
    • 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, 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. 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

      Collection<Revision> getRevisions(String path, 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 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:
      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. If includeNoLocal 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 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
      includeNoLocal - if true 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

      Collection<Revision> getChildRevisions(String parentPath, 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 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:
      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. If includeNoLocal is true, also those revisions are included that where not versioned below the indicated parent path.
      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
      includeNoLocal - if true 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

      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 than cal all revisions below the specified treeRoot are respected. But only those revisions are returned that match the given parentPath
      Parameters:
      parentPath - the path of the parent page
      treeRoot - root of the tree
      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:
      Collection of revisions
      Throws:
      WCMException - if an error during this operation occurs.
    • restore

      Page restore(String path, 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 the path 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 specified path 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 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.
    • restoreTree

      Page restoreTree(String path, 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 page
      date - calendar date to restore to
      preserveNV - if true 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, Calendar now, boolean clearRepl) throws WCMException
      Touches the given page by setting the last modified date and user and clears the replication status. if now is null the last modified status is not changed. if clearRepl is false the replication status is not changed.
      Parameters:
      page - the page to touch
      shallow - if true not recursion
      now - current date
      clearRepl - flag indicates if replication status is to be cleared
      Throws:
      WCMException - if an error occurs