public interface

PageManager

implements ContentEntityManager
com.atlassian.confluence.pages.PageManager
Known Indirect Subclasses

Class Overview

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

Summary

[Expand]
Inherited Constants
From interface com.atlassian.confluence.core.ContentEntityManager
Public Methods
BlogPost findNextBlogPost(String key, Date time)
BlogPost findNextBlogPost(BlogPost post)
BlogPost findPreviousBlogPost(String key, Date time)
BlogPost findPreviousBlogPost(BlogPost post)
AbstractPage getAbstractPage(long id)
Retrieve the AbstractPage subclass with the given content ID.
AttachmentManager getAttachmentManager()
int getAuthoredPagesCountByUser(String username)
Get the number of pages that have been created by a particular user
BlogPost getBlogPost(String spaceKey, String pageTitle, 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.
BlogPost getBlogPost(long id)
Retrieve the blog post with the given content ID.
BlogPost getBlogPost(String spaceKey, String pageTitle, Calendar day)
Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.
List getBlogPosts(String spaceKey, Calendar postingDate, int period)
List<BlogPost> getBlogPosts(Space space, boolean currentOnly)
int getCommentCountOnPage(long pageId)
Counts the number of comments on the page specified by the given id.
Collection getDescendentIds(Page page)
List getDescendents(Page page)
NotificationManager getNotificationManager()
List getOrphanedPages(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(String spaceKey, String pageTitle)
Retrieve the latest version of a page by its space key and title.
@Deprecated Page getPage(String spaceKey, String pageTitle, boolean eagerLoadComments)
This method is deprecated. since 3.0, use getPageWithComments(String, String) instead.
AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
returns the historical version of a page
Collection<Long> getPageIds(Space space)
Get the ids of all pages (current and historical) in the given space.
List getPageInTrash(String spaceKey, String title)
Page getPageWithComments(String spaceKey, String pageTitle)
Retrieve the latest version of a page by its space key and title.
List<Page> getPages(Space space, boolean currentOnly)
List getPagesCreatedOrUpdatedSinceDate(Date date)
Get the list of all pages created or updated since a particular date.
List getPagesStartingWith(Space space, String s)
List getPermissionPages(Space space)
Retrieve all pages within a particular space that have page level permissions applied to them.
List<AbstractPage> getPossibleBlogRedirectsInSpace(Space space, String blogTitle, int maxResultCount)
Searches for blogs in the space specified, looking for those that have the given title in a previous version.
@Deprecated List getPossibleRedirects(String pageTitle)
@Deprecated List getPossibleRedirectsForSpace(Space space, String pageTitle)
List<AbstractPage> getPossibleRedirectsInSpace(Space space, String pageTitle, int maxResultCount)
Searches for pages in the space specified, looking for those that have the given title in a previous version.
List<AbstractPage> getPossibleRedirectsNotInSpace(Space space, 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.
List getRecentlyAddedBlogPosts(int maxPosts, Date timeSince, String spaceKey)
List getRecentlyAddedBlogPosts(int maxCount, String spaceKey)
Retrieve the most recently created blog posts in a given space.
List getRecentlyAddedPages(int maxCount, String spaceKey)
Retrieve the most recently created pages in a given space.
List getRecentlyUpdatedPages(int maxCount, String spaceKey)
Retrieve the most recently modified pages in a given space.
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.
List getUndefinedPages(String spaceKey)
Retrieve a list of link destinations in a given space that do not have pages.
boolean isPageRecentlyUpdatedForUser(Page page, User user)
Returns true if the page has been created or modified since the user last logged in.
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, ProgressMeter progress)
Removes all pages in the space.
void removeAllPages(Space space)
Removes all pages in the space.
void removePageFromAncestorCollections(Page page)
Removes the page and its ancestors from the ancestor collection of all descendants.
void renamePage(AbstractPage page, String newPageTitle)
Call this function if you want to rename the page only.
void renamePageWithoutNotifications(AbstractPage page, String newPageTitle)
Call this function if you want to rename the page only, and don't want notifications generated.
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, List<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(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.
[Expand]
Inherited Methods
From interface com.atlassian.confluence.core.ContentEntityManager

Public Methods

public BlogPost findNextBlogPost (String key, Date time)

public BlogPost findNextBlogPost (BlogPost post)

public BlogPost findPreviousBlogPost (String key, Date time)

public BlogPost findPreviousBlogPost (BlogPost post)

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

public AttachmentManager getAttachmentManager ()

public int getAuthoredPagesCountByUser (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.

public BlogPost getBlogPost (String spaceKey, String pageTitle, 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.

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

public BlogPost getBlogPost (String spaceKey, String pageTitle, 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.

public List getBlogPosts (String spaceKey, Calendar postingDate, int period)

public List<BlogPost> getBlogPosts (Space space, boolean currentOnly)

public 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

public Collection getDescendentIds (Page page)

public List getDescendents (Page page)

public NotificationManager getNotificationManager ()

public List getOrphanedPages (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

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

public Page getPage (String spaceKey, 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.

@Deprecated public Page getPage (String spaceKey, String pageTitle, boolean eagerLoadComments)

This method is 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.

public 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

public Collection<Long> getPageIds (Space space)

Get the ids of all pages (current and historical) in the given space.

Parameters
space space to retrieve page ids from, can not be null.
Returns
  • a Collection of ids for pages.

public List getPageInTrash (String spaceKey, String title)

public Page getPageWithComments (String spaceKey, 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.

public List<Page> getPages (Space space, boolean currentOnly)

public List getPagesCreatedOrUpdatedSinceDate (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

public List getPagesStartingWith (Space space, String s)

public 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

public List<AbstractPage> getPossibleBlogRedirectsInSpace (Space space, String blogTitle, int maxResultCount)

Searches for blogs 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.
blogTitle title of a blog in a previous version.
maxResultCount maximum blogs to return

@Deprecated public List getPossibleRedirects (String pageTitle)

@Deprecated public List getPossibleRedirectsForSpace (Space space, String pageTitle)

public List<AbstractPage> getPossibleRedirectsInSpace (Space space, 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

public List<AbstractPage> getPossibleRedirectsNotInSpace (Space space, 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

public List getRecentlyAddedBlogPosts (int maxPosts, Date timeSince, String spaceKey)

public List getRecentlyAddedBlogPosts (int maxCount, 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.

For queries like this, you're probably much better off using the SearchManager
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

public List getRecentlyAddedPages (int maxCount, 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.

For queries like this, you're probably much better off using the SearchManager
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

public List getRecentlyUpdatedPages (int maxCount, 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.

For queries like this, you're probably much better off using the SearchManager
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

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

public 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

public List getUndefinedPages (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

public boolean isPageRecentlyUpdatedForUser (Page page, User user)

Returns true if the page has been created or modified since the user last logged in. If the user has no last login time, returns false. For an anonymous user returns false.

Parameters
page the page in question
user the user or null if it is the anonymous user
Returns
  • true if the page has been created or modified since the user's last login, false otherwise

public 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

public 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

public 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

public 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

public void removeAllBlogPosts (Space space)

public void removeAllPages (Space space, ProgressMeter progress)

Removes all pages in the space. This can be a lengthy operation and should be performed in a long running task.

Parameters
space the space to remove pages from.
progress progress meter to report progress on, can not be null.

public void removeAllPages (Space space)

Removes all pages in the space. This can be a lengthy operation and should be performed in a long running task.

Parameters
space the space to remove pages from.

public void removePageFromAncestorCollections (Page page)

Removes the page and its ancestors from the ancestor collection of all descendants.

public void renamePage (AbstractPage page, String newPageTitle)

Call this function if you want to rename the page only. If you want to update not only the title, but the content and other attributes, modify the entity and call save instead.

Parameters
page to rename
newPageTitle new title for page

public void renamePageWithoutNotifications (AbstractPage page, String newPageTitle)

Call this function if you want to rename the page only, and don't want notifications generated. If you want to update not only the title, but the content and other attributes, modify the entity and call save instead.

Parameters
page to rename
newPageTitle new title for page

public 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

public void revertChildPageOrder (Page parentPage)

Removes manual ordering of child pages.

Parameters
parentPage the page for which children should be unordered.

public void setAttachmentManager (AttachmentManager attachmentManager)

public void setChildPageOrder (Page parentPage, List<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

public void setNotificationManager (NotificationManager notificationManager)

public boolean spaceHasBlogPosts (String spaceKey)

public void trashPage (AbstractPage page)

public 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