Interface PageManager


  • @ProviderType
    public interface PageManager
    The page manager provides methods for page level operations.
    • 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 modifications
      Page copy​(Page page, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave)
      Copies the given page to the new destination
      Resource 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 modifications
      Resource copy​(Resource resource, java.lang.String destination, java.lang.String beforeName, boolean shallow, boolean resolveConflict, boolean autoSave)
      Copies the given resource to the new destination
      Page 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.
      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.
      java.util.Collection<Template> getTemplates​(java.lang.String parentPath)
      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 by beforeName if it's null 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 by beforeName if it's null 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 by beforeName if it's null 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 by beforeName if it's null 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 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​(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 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,
                  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 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,
                  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 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,
                      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 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,
                      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 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.
      • 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 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,
                  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 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,
                  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 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,
                      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 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,
                      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 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,
                   java.lang.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,
                   java.lang.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,
                   java.lang.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,
                   java.lang.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​(java.lang.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
      • getBlueprints

        @Deprecated
        java.util.Collection<Blueprint> getBlueprints​(java.lang.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:
        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 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

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

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

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

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

        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 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
        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
        treeRoot - 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 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​(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 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​(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 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,
                   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. 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