com.atlassian.confluence.pages
Interface PageManager

All Superinterfaces:
ContentEntityManager
All Known Implementing Classes:
DefaultPageManager

public interface PageManager
extends ContentEntityManager

Manages the retrieval and manipulation both pages and blog entries. (Really this class manages "AbstractPage", but calling it AbstractPageManager would be just as confusing).


Field Summary
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Method Summary
 void appendPage(Page sourcePage, Page targetPage)
          Deprecated. since 2.9 use movePageAsChild(Page, Page)
 BlogPost findNextBlogPost(BlogPost post)
           
 BlogPost findNextBlogPost(java.lang.String key, java.util.Date time)
           
 BlogPost findPreviousBlogPost(BlogPost post)
           
 BlogPost findPreviousBlogPost(java.lang.String key, java.util.Date time)
           
 AbstractPage getAbstractPage(long id)
          Retrieve the AbstractPage subclass with the given content ID.
 AttachmentManager getAttachmentManager()
           
 int getAuthoredPagesCountByUser(java.lang.String username)
          Get the number of pages that have been created by a particular user
 BlogPost getBlogPost(long id)
          Retrieve the blog post with the given content ID.
 BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String pageTitle, java.util.Calendar day)
          Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.
 BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String pageTitle, java.util.Calendar day, boolean eagerLoadComments)
          Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.
 java.util.List getBlogPosts(Space space, boolean currentOnly)
           
 java.util.List getBlogPosts(java.lang.String spaceKey, java.util.Calendar postingDate, int period)
           
 int getCommentCountOnPage(long pageId)
          Counts the number of comments on the page specified by the given id.
 java.util.Collection getDescendentIds(Page page)
           
 java.util.List getDescendents(Page page)
           
 NotificationManager getNotificationManager()
           
 java.util.List getOrphanedPages(java.lang.String spaceKey)
          Retrieve a list of pages in a given space that are not linked to.
 Page getPage(long id)
          Retrieve the page with the given content ID.
 Page getPage(java.lang.String spaceKey, java.lang.String pageTitle)
          Retrieve the latest version of a page by its space key and title.
 Page getPage(java.lang.String spaceKey, java.lang.String pageTitle, boolean eagerLoadComments)
          Deprecated. since 3.0, use getPageWithComments(String, String) instead.
 AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
          returns the historical version of a page
 java.util.List getPageInTrash(java.lang.String spaceKey, java.lang.String title)
           
 java.util.List getPages(Space space, boolean currentOnly)
           
 java.util.List getPagesCreatedOrUpdatedSinceDate(java.util.Date date)
          Get the list of all pages created or updated since a particular date.
 java.util.List getPagesStartingWith(Space space, java.lang.String s)
           
 Page getPageWithComments(java.lang.String spaceKey, java.lang.String pageTitle)
          Retrieve the latest version of a page by its space key and title.
 java.util.List getPermissionPages(Space space)
          Retrieve all pages within a particular space that have page level permissions applied to them.
 java.util.List getPossibleRedirects(java.lang.String pageTitle)
          Deprecated. Since 3.1. Use getPossibleRedirectsInSpace(Space, String, int) or getPossibleRedirectsNotInSpace(Space, String, int)
 java.util.List getPossibleRedirectsForSpace(Space space, java.lang.String pageTitle)
          Deprecated. Since 3.1. Use getPossibleRedirectsInSpace(Space, String, int) or getPossibleRedirectsNotInSpace(Space, String, int)
 java.util.List<AbstractPage> getPossibleRedirectsInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
          Searches for pages in the space specified, looking for those that have the given title in a previous version.
 java.util.List<AbstractPage> getPossibleRedirectsNotInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
          Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.
 java.util.List getRecentlyAddedBlogPosts(int maxPosts, java.util.Date timeSince, java.lang.String spaceKey)
           
 java.util.List getRecentlyAddedBlogPosts(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently created blog posts in a given space.
 java.util.List getRecentlyAddedPages(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently created pages in a given space.
 java.util.List getRecentlyUpdatedPages(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently modified pages in a given space.
 java.util.List getTopLevelPages(Space space)
          Get all the pages in a space that do not have a parent page.
 ListBuilder<Page> getTopLevelPagesBuilder(Space space)
          Get the pages in a space that do not have a parent page.
 java.util.List getUndefinedPages(java.lang.String spaceKey)
          Retrieve a list of link destinations in a given space that do not have pages.
 void movePage(Page sourcePage, Page targetPage, int offset)
          Deprecated. since 2.9 use movePageAfter(Page, Page) or movePageBefore(Page, Page)
 void movePage(Page sourcePage, Space targetSpace)
          Deprecated. since 2.9 use movePageToTopLevel(Page, Space)
 void movePageAfter(Page page, Page refPage)
          Move the provided page (first argument) after the reference page (second argument).
 void movePageAsChild(Page page, Page refPage)
          Move the provided page (first argument) as a child of the reference page (second argument).
 void movePageBefore(Page page, Page refPage)
          Move the provided page (first argument) before the reference page (second argument).
 void movePageToTopLevel(Page page, Space space)
          Move a page to the top level of targetSpace.
 void removeAllBlogPosts(Space space)
           
 void removeAllPages(Space space)
           
 void removePageFromAncestorCollections(Page page)
          Removes the page and its ancestors from the ancestor collection of all descendants.
 void renamePage(AbstractPage page, java.lang.String newPageTitle)
           
 void restorePage(AbstractPage page)
          Restores a trashed page, effectively moving it out of the trash and promoting it back to being normal page.
 void revertChildPageOrder(Page parentPage)
          Removes manual ordering of child pages.
 void setAttachmentManager(AttachmentManager attachmentManager)
           
 void setChildPageOrder(Page parentPage, java.util.List<java.lang.Long> childIds)
          Sets ordering of child pages for a supplied page, based on a map of child ids to positions.
 void setNotificationManager(NotificationManager notificationManager)
           
 boolean spaceHasBlogPosts(java.lang.String spaceKey)
           
 void trashPage(AbstractPage page)
           
 void updatePageInAncestorCollections(Page page, Page parentPage)
          Updates the ancestors of a page and all it's descendant pages with the new parent page and its ancestors.
 
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getAllCurrentEntities, getById, getLockedBySpace, getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Method Detail

getPage

Page getPage(long id)
Retrieve the page with the given content ID.

Parameters:
id - the database content ID for the page to return
Returns:
the page with that id, or null if the page could not be found (or the object with that id is not a page)

getAbstractPage

AbstractPage getAbstractPage(long id)
Retrieve the AbstractPage subclass with the given content ID. This will return either a page or a blogpost, depending on the type of the database entity.

Parameters:
id - the database content ID for the page to return
Returns:
the abstractpage with that id, or null if there is no AbstractPage with that ID.

getBlogPost

BlogPost getBlogPost(long id)
Retrieve the blog post with the given content ID.

Parameters:
id - the database content ID for the blog post to return
Returns:
the page with that id, or null if the post could not be found (or the object with that id is not a blog post)

getPage

Page getPage(java.lang.String spaceKey,
             java.lang.String pageTitle)
Retrieve the latest version of a page by its space key and title. Pages that are not current (i.e. in the trash) will not be returned.

Both the space key and page title matches are case-insensitive.

Returns:
the page specified by the spaceKey and pageTitle, or null if the page cannot be found, or is in the trash.

getPageWithComments

Page getPageWithComments(java.lang.String spaceKey,
                         java.lang.String pageTitle)
Retrieve the latest version of a page by its space key and title. Pages that are not current (i.e. in the trash) will not be returned. This method will eager load comments for the page.

Both the space key and page title matches are case-insensitive.

Returns:
the page specified by the spaceKey and pageTitle, or null if the page cannot be found, or is in the trash.

getCommentCountOnPage

int getCommentCountOnPage(long pageId)
Counts the number of comments on the page specified by the given id.

Parameters:
pageId - the id to check for comments on
Returns:
a count of the total number of comments on this page

getPage

@Deprecated
Page getPage(java.lang.String spaceKey,
                        java.lang.String pageTitle,
                        boolean eagerLoadComments)
Deprecated. since 3.0, use getPageWithComments(String, String) instead.

Retrieve the latest version of a page by its space key and title. Pages that are not current (i.e. in the trash) will not be returned. Additionally, this method will eager load comments for the page if eagerLoadComments is true.

Both the space key and page title matches are case-insensitive.

Returns:
the page specified by the spaceKey and pageTitle, or null if the page cannot be found, or is in the trash.

getBlogPost

BlogPost getBlogPost(java.lang.String spaceKey,
                     java.lang.String pageTitle,
                     java.util.Calendar day)
Retrieve the latest version of a blog post by its space key, title, and the day on which it was published. Blog posts that are not current (i.e. in the trash) will not be returned.

Both the space key and page title matches are case-insensitive.

Returns:
the appropriate blog post, or null if none can be found, or the post is in the trash.

getBlogPost

BlogPost getBlogPost(java.lang.String spaceKey,
                     java.lang.String pageTitle,
                     java.util.Calendar day,
                     boolean eagerLoadComments)
Retrieve the latest version of a blog post by its space key, title, and the day on which it was published. Blog posts that are not current (i.e. in the trash) will not be returned. If eager load comments is true, the comments and their immediate children will also be eagerly loaded for this BlogPost.

Both the space key and page title matches are case-insensitive.

Returns:
the appropriate blog post, or null if none can be found, or the post is in the trash.

getRecentlyAddedBlogPosts

java.util.List getRecentlyAddedBlogPosts(int maxCount,
                                         java.lang.String spaceKey)
Retrieve the most recently created blog posts in a given space. If no space key is supplied, the most recent blog posts from all spaces are returned. Only the latest version of each post is returned. Posts that are not current (i.e. in the trash) are not included.

The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

Parameters:
maxCount - the maximum number of blog posts to retrieve
spaceKey - the key of the space to retrieve the posts from, or null to retrieve posts from all spaces
Returns:
a list of the most recently created blog posts in the given space

getRecentlyAddedPages

java.util.List getRecentlyAddedPages(int maxCount,
                                     java.lang.String spaceKey)
Retrieve the most recently created pages in a given space. If no space key is supplied, the most recent pages from all spaces are returned. Only the latest version of each page is returned. Pages that are not current (i.e. in the trash) are not included.

The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

Parameters:
maxCount - the maximum number of pages to retrieve
spaceKey - the key of the space to retrieve the pages from, or null to retrieve posts from all spaces
Returns:
a list of the most recently created pages in the given space

getRecentlyUpdatedPages

java.util.List getRecentlyUpdatedPages(int maxCount,
                                       java.lang.String spaceKey)
Retrieve the most recently modified pages in a given space. If no space key is supplied, the most recent pages from all spaces are returned. Only the latest version of each page is returned. Pages that are not current (i.e. in the trash) are not included.

The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

Parameters:
maxCount - the maximum number of pages to retrieve
spaceKey - the key of the space to retrieve the pages from, or null to retrieve posts from all spaces
Returns:
a list of the most recently updated pages in the given space

getOrphanedPages

java.util.List getOrphanedPages(java.lang.String spaceKey)
Retrieve a list of pages in a given space that are not linked to. If no space key is supplied, the search is performed across all spaces. Only the latest version of each page is returned. Pages that are not current (i.e. in the trash) are not returned.

The orphaned pages search is not 100% accurate, as the algorithm used to track links doesn't account for all links. Hopefully this can be fixed with future versions of the wiki renderer that allow more accurate tracking of link destinations.

Parameters:
spaceKey - the key of the space to look for orphans in, or null to search all spaces
Returns:
the list of orphaned pages

getUndefinedPages

java.util.List getUndefinedPages(java.lang.String spaceKey)
Retrieve a list of link destinations in a given space that do not have pages.

The undefined pages search is not 100% accurate, as the algorithm used to track links doesn't account for all links. Hopefully this can be fixed with future versions of the wiki renderer that allow more accurate tracking of link destinations.

Parameters:
spaceKey - the key of the space to look for undefined pages in, or null to search all spaces
Returns:
the list of undefined pages

getPermissionPages

java.util.List getPermissionPages(Space space)
Retrieve all pages within a particular space that have page level permissions applied to them. Only the latest version of each page is returned. Pages that are not current (i.e. in the trash) are not returned.

Parameters:
space - the space to search
Returns:
the list of all pages in that space with page-level permissions

getAuthoredPagesCountByUser

int getAuthoredPagesCountByUser(java.lang.String username)
Get the number of pages that have been created by a particular user

Parameters:
username - the username of the user to search for
Returns:
the number of pages that have been created by that user.

getPagesCreatedOrUpdatedSinceDate

java.util.List getPagesCreatedOrUpdatedSinceDate(java.util.Date date)
Get the list of all pages created or updated since a particular date.

Parameters:
date - the date the pages must have been created or edited after
Returns:
all pages created or edited since that date

getBlogPosts

java.util.List getBlogPosts(java.lang.String spaceKey,
                            java.util.Calendar postingDate,
                            int period)

getBlogPosts

java.util.List getBlogPosts(Space space,
                            boolean currentOnly)

getPages

java.util.List getPages(Space space,
                        boolean currentOnly)

getPagesStartingWith

java.util.List getPagesStartingWith(Space space,
                                    java.lang.String s)

findNextBlogPost

BlogPost findNextBlogPost(BlogPost post)

findPreviousBlogPost

BlogPost findPreviousBlogPost(BlogPost post)

getNotificationManager

NotificationManager getNotificationManager()

setNotificationManager

void setNotificationManager(NotificationManager notificationManager)

getAttachmentManager

AttachmentManager getAttachmentManager()

setAttachmentManager

void setAttachmentManager(AttachmentManager attachmentManager)

renamePage

void renamePage(AbstractPage page,
                java.lang.String newPageTitle)

getPossibleRedirectsForSpace

java.util.List getPossibleRedirectsForSpace(Space space,
                                            java.lang.String pageTitle)
Deprecated. Since 3.1. Use getPossibleRedirectsInSpace(Space, String, int) or getPossibleRedirectsNotInSpace(Space, String, int)


getPossibleRedirectsNotInSpace

java.util.List<AbstractPage> getPossibleRedirectsNotInSpace(Space space,
                                                            java.lang.String pageTitle,
                                                            int maxResultCount)
Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.

Parameters:
space - Space to exclude from search. If null, all spaces are searched.
pageTitle - title of a page in a previous version.
maxResultCount - maximum pages to return

getPossibleRedirectsInSpace

java.util.List<AbstractPage> getPossibleRedirectsInSpace(Space space,
                                                         java.lang.String pageTitle,
                                                         int maxResultCount)
Searches for pages in the space specified, looking for those that have the given title in a previous version.

Parameters:
space - Space to search. Must not be null.
pageTitle - title of a page in a previous version.
maxResultCount - maximum pages to return

getPossibleRedirects

java.util.List getPossibleRedirects(java.lang.String pageTitle)
Deprecated. Since 3.1. Use getPossibleRedirectsInSpace(Space, String, int) or getPossibleRedirectsNotInSpace(Space, String, int)


getRecentlyAddedBlogPosts

java.util.List getRecentlyAddedBlogPosts(int maxPosts,
                                         java.util.Date timeSince,
                                         java.lang.String spaceKey)

getPageInTrash

java.util.List getPageInTrash(java.lang.String spaceKey,
                              java.lang.String title)

spaceHasBlogPosts

boolean spaceHasBlogPosts(java.lang.String spaceKey)

getDescendents

java.util.List getDescendents(Page page)

updatePageInAncestorCollections

void updatePageInAncestorCollections(Page page,
                                     Page parentPage)
Updates the ancestors of a page and all it's descendant pages with the new parent page and its ancestors.

Parameters:
page - the page being updated with new ancestors
parentPage - the new parent page of the page being updated

removePageFromAncestorCollections

void removePageFromAncestorCollections(Page page)
Removes the page and its ancestors from the ancestor collection of all descendants.


getDescendentIds

java.util.Collection getDescendentIds(Page page)

getTopLevelPages

java.util.List getTopLevelPages(Space space)
Get all the pages in a space that do not have a parent page. Since there can be an arbitrary number of such pages it is NOT RECOMMENDED to call this method. Use the builder method instead.


getPageByVersion

AbstractPage getPageByVersion(AbstractPage mostRecentPage,
                              int version)
returns the historical version of a page

Parameters:
mostRecentPage - - must specify the most recent recent version of the page (page must be associated with a space)
version - - historical version to retrieve
Returns:
the specified version of the page

removeAllPages

void removeAllPages(Space space)

removeAllBlogPosts

void removeAllBlogPosts(Space space)

findPreviousBlogPost

BlogPost findPreviousBlogPost(java.lang.String key,
                              java.util.Date time)

findNextBlogPost

BlogPost findNextBlogPost(java.lang.String key,
                          java.util.Date time)

trashPage

void trashPage(AbstractPage page)

getTopLevelPagesBuilder

ListBuilder<Page> getTopLevelPagesBuilder(Space space)
Get the pages in a space that do not have a parent page. This method returns a list builder that can be used to paginate the results efficiently.

This method will return only pages the current user can view.

Parameters:
space - the space in which to look for pages
Returns:
a builder to paginate the result

restorePage

void restorePage(AbstractPage page)
Restores a trashed page, effectively moving it out of the trash and promoting it back to being normal page.

Parameters:
page - a trashed page

movePage

void movePage(Page sourcePage,
              Page targetPage,
              int offset)
Deprecated. since 2.9 use movePageAfter(Page, Page) or movePageBefore(Page, Page)


movePageAfter

void movePageAfter(Page page,
                   Page refPage)
Move the provided page (first argument) after the reference page (second argument). This may also mean moving the target page to another space, if the reference page is in another space.

Parameters:
page - the page to move
refPage - the page which the first page will be placed after

movePageBefore

void movePageBefore(Page page,
                    Page refPage)
Move the provided page (first argument) before the reference page (second argument). This may also mean moving the target page to another space, if the reference page is in another space.

Parameters:
page - the page to move
refPage - the page which the first page will be placed before

movePageAsChild

void movePageAsChild(Page page,
                     Page refPage)
Move the provided page (first argument) as a child of the reference page (second argument). This may also mean moving the target page to another space, if the reference page is in another space.

The location of the page in the reference page's children is dependent on their existing order. If they are not explicitly ordered, the page will have a default location in the list. If the children have an existing order, the page will be added as the last child of the reference page.

Parameters:
page - the page to move
refPage - the page which the first page will be made a child of

movePageToTopLevel

void movePageToTopLevel(Page page,
                        Space space)
Move a page to the top level of targetSpace. If the top-level pages are manually ordered, the page will be added to the end of the child pages.

Parameters:
page - the page to move
space - the space to move the page to

movePage

void movePage(Page sourcePage,
              Space targetSpace)
Deprecated. since 2.9 use movePageToTopLevel(Page, Space)


appendPage

void appendPage(Page sourcePage,
                Page targetPage)
Deprecated. since 2.9 use movePageAsChild(Page, Page)


setChildPageOrder

void setChildPageOrder(Page parentPage,
                       java.util.List<java.lang.Long> childIds)
Sets ordering of child pages for a supplied page, based on a map of child ids to positions.

Parameters:
parentPage - the page for which children should be ordered.
childIds - children page IDs in the new order

revertChildPageOrder

void revertChildPageOrder(Page parentPage)
Removes manual ordering of child pages.

Parameters:
parentPage - the page for which children should be unordered.


Copyright © 2003-2011 Atlassian. All Rights Reserved.