Interface PageManager
-
- All Superinterfaces:
ContentEntityManager
- All Known Subinterfaces:
PageManagerInternal
- All Known Implementing Classes:
DefaultPageManager
@ParametersAreNonnullByDefault 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
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description int
countBlogsWithUnpublishedChanges()
Counts the number of published blog posts that have unpublished changes.int
countCurrentBlogs()
Counts the total number of current blog posts across all spacesint
countCurrentPages()
Counts the total number of current pages across all spacesint
countDraftBlogs()
Counts the number of blog posts that are drafts.int
countDraftPages()
Counts the number of pages that are drafts.int
countPagesInSubtree(Page page)
Get number of descendant page including the input pageint
countPagesWithUnpublishedChanges()
Counts the number of published pages that have unpublished changes.void
deepCopyPage(PageCopyOptions option, Page originalPage, Page destinationPage)
Copy child page of originalPage to destinationPagevoid
deepDeletePage(PageDeleteOptions options, Page targetPage)
Deletes a page hierarchy@Nullable BlogPost
findNextBlogPost(BlogPost post)
@Nullable BlogPost
findNextBlogPost(String key, Date time)
@Nullable BlogPost
findPreviousBlogPost(BlogPost post)
@Nullable BlogPost
findPreviousBlogPost(String key, Date time)
@Nullable AbstractPage
getAbstractPage(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@NonNull List<AbstractPage>
getAbstractPages(Iterable<Long> ids)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableint
getAuthoredPagesCountByUser(String username)
Get the number of pages that have been created by a particular user@Nullable BlogPost
getBlogPost(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@Nullable BlogPost
getBlogPost(String spaceKey, String pageTitle, Calendar day)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@Nullable BlogPost
getBlogPost(String spaceKey, String pageTitle, Calendar day, boolean eagerLoadComments)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicablelong
getBlogPostCount(String key, @Nullable Calendar postingDay, int period)
Get total number of blogPost.@NonNull List<Date>
getBlogPostDates(String spaceKey)
Returns a list of creation dates for all the blog posts in a space.@NonNull List<Date>
getBlogPostDates(String spaceKey, Calendar date, int period)
Returns a list of creation dates for all the blog posts in a space for a particular period.@NonNull List<BlogPost>
getBlogPosts(Space space, boolean currentOnly)
@NonNull List
getBlogPosts(String spaceKey, Calendar postingDate, int period)
Get list of blogPost by Date.@NonNull List
getBlogPosts(String spaceKey, Calendar postingDate, int period, int startIndex, int maxResultCount)
Get list of blogPost by Date.@NonNull List<BlogPost>
getBlogPostsInTrash(String spaceKey, String title)
Gets a blog post that is in the trash for a given space that matches the given title.Optional<BlogPostStatisticsDTO>
getBlogStatistics()
Fetches statistics about blogsint
getCommentCountOnBlog(long blogpostId)
Counts the number of comments on the blogpost specified by the given id.int
getCommentCountOnPage(long pageId)
Counts the number of comments on the page specified by the given id.int
getCountOfLatestXhtmlContent(long endContentId)
Count the number of AbstractPages that have an ID lower than the specified ID, excluding older versions.@NonNull Collection<Long>
getDescendantIds(Page page)
Finds the ids of a page's descendants@NonNull List<Page>
getDescendants(Page page)
Finds all descendant pages of the given page@NonNull List<String>
getDescendantTitles(Page page)
Finds all descendant titles of the given page@NonNull List
getDescendents(Page page)
Deprecated.since 5.5.1.PageResponse<Page>
getDraftChildren(Page page, LimitedRequest pageRequest, Depth depth)
Returns the children of a page which have a status of DRAFT, limited to the pagination requested.long
getHighestCeoId()
Get the highest content ID in the database, excluding older versions of content.@NonNull Set<Date>
getMonthsWithBlogPosts(String spaceKey, Calendar year)
Returns the set of months in the specified year (represented as a Calendar with the year and month fields populated) for which blog posts exist in the specified space.@Nullable BlogPost
getNewestBlogPost(@Nullable String spaceKey)
Retrieves the most recently created blog post in the given space.default NotificationManager
getNotificationManager()
Deprecated.since 5.8 do not use.@NonNull List<ContentEntityObject>
getOrderedXhtmlContentFromContentId(long startContentId, long endContentId, int maxRows)
Gets the latest versions of AbstractPages between the given IDs limited by the specified number of rows.@NonNull List
getOrphanedPages(@Nullable String spaceKey)
Deprecated.since 7.0.0 , no replacement This should be removed as the result of this ticket https://jira.atlassian.com/browse/CONFSRVDEV-10111@Nullable Page
getPage(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@Nullable Page
getPage(String spaceKey, String pageTitle)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@Nullable AbstractPage
getPageByVersion(AbstractPage mostRecentPage, int version)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicablelong
getPageCount(@NonNull String spaceKey)
Get total number of current pages in a space@NonNull Collection<Long>
getPageIds(Space space)
Get the ids of all pages (current and historical) in the given space.@NonNull List
getPageInTrash(String spaceKey, String title)
@NonNull List<Page>
getPages(@Nullable Space space, boolean currentOnly)
@NonNull List<Page>
getPages(Iterable<Long> ids)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@NonNull List
getPagesCreatedOrUpdatedSinceDate(Date date)
Get the list of all pages created or updated since a particular date.@NonNull List
getPagesStartingWith(Space space, String s)
Optional<PageStatisticsDTO>
getPageStatistics()
Fetches statistics about pagesList<Page>
getPagesWithPermissions(@NonNull Space space)
Get all current pages in a space and eagerly fetch permissions at the same time.@Nullable Page
getPageWithComments(String spaceKey, String pageTitle)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicable@NonNull List
getPermissionPages(Space space)
Retrieve all pages within a particular space that have page level permissions applied to them.@NonNull 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.@NonNull List<AbstractPage>
getPossibleBlogRedirectsNotInSpace(Space space, String blogTitle, int maxResultCount)
Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.@NonNull 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.@NonNull 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.@NonNull List<ContentEntityObject>
getPreviousVersionsOfPageWithTaskId(long pageId, long taskId, int maxRows)
Get previous versions of a CEO that contain the given task ID sorted by versions in descending order.@NonNull List
getRecentlyAddedBlogPosts(int maxCount, @Nullable String spaceKey)
Retrieve the most recently created blog posts in a given space.@NonNull List
getRecentlyAddedBlogPosts(int maxPosts, @Nullable Date timeSince, String spaceKey)
@NonNull List
getRecentlyAddedPages(int maxCount, @Nullable String spaceKey)
Retrieve the most recently created pages in a given space.@NonNull List
getRecentlyUpdatedPages(int maxCount, @Nullable String spaceKey)
Retrieve the most recently modified pages in a given space.@NonNull List
getTopLevelPages(Space space)
Get all the pages in a space that do not have a parent page.@NonNull ListBuilder<Page>
getTopLevelPagesBuilder(Space space)
Get the pages in a space that do not have a parent page.List<OutgoingLink>
getUndefinedLinks(@Nullable String spaceKey)
Retrieve a list of link destinations in a given space that do not have pages.@NonNull List
getUndefinedPages(@Nullable String spaceKey)
Deprecated.since 6.6.0, usegetUndefinedLinks(String)
@NonNull Set<Date>
getYearsWithBlogPosts(String spaceKey)
Returns the set of years (represented as a Date with the year field populated) for which blog posts exist in the specified space.boolean
isPageRecentlyUpdatedForUser(Page page, @Nullable com.atlassian.user.User user)
Returns true if the page has been created or modified since the user last logged in.void
moveBlogPostToTopLevel(BlogPost blogPost, Space space)
Move a blog post to the top level oftargetSpace
.void
moveChildrenToNewParent(Page oldParent, Page newParent)
Moves all the children from one page to another The new parent should NOT be the child of the old parent, this method will return with no operation in that casevoid
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 oftargetSpace
.void
refreshPage(ContentEntityObject page)
Refresh the page object in the hibernate session.void
removeAllBlogPosts(Space space)
void
removeAllBlogPosts(Space spaceToBeRemoved, com.atlassian.core.util.ProgressMeter progress)
Remove all blog posts in a space with a progress metervoid
removeAllPages(Space space)
Removes all pages in the space.void
removeAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)
Removes all pages in the space.void
removePageFromAncestorCollections(Page page)
Removes the page and its ancestors from the ancestor collection of all descendants.int
removeStaleSharedDrafts()
Removes any stale shared drafts.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
setChildPageOrder(Page parentPage, List<Long> childIds)
Sets ordering of child pages for a supplied page, based on a map of child ids to positions.default void
setNotificationManager(NotificationManager notificationManager)
Deprecated.since 5.8 do not use.boolean
spaceHasBlogPosts(String spaceKey)
void
trashPage(AbstractPage page)
Deprecated.since 6.0 UsetrashPage(AbstractPage, DeleteContext)
void
trashPage(AbstractPage page, @NonNull DeleteContext deleteContext)
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
getById, getContributionStatusByUser, getNextVersion, getOtherVersion, getPageAndBlogPostsVersionsLastEditedByUser, getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, getVersionsLastEditedByUser, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion
-
-
-
-
Method Detail
-
getPage
@Deprecated @Nullable Page getPage(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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)
-
getPages
@Deprecated @NonNull List<Page> getPages(Iterable<Long> ids)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve a collection of pages with the given content IDs.- Parameters:
ids
- an Iterable of content IDs for the pages to return- Returns:
- pages found with those ids, or an empty list if no pages were found
-
getAbstractPage
@Deprecated @Nullable AbstractPage getAbstractPage(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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.
-
getAbstractPages
@Deprecated @NonNull List<AbstractPage> getAbstractPages(Iterable<Long> ids)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve a collection of the AbstractPage subclass with the given content IDs. This can contain both pages or a blogposts, depending on the type of the database entity.- Parameters:
ids
- an Iterable of content IDs for the pages or blogposts to return- Returns:
- pages and blogposts found with those ids, or an empty list if none was found.
-
getBlogPost
@Deprecated @Nullable BlogPost getBlogPost(long id)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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
@Deprecated @Nullable Page getPage(String spaceKey, String pageTitle)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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
@Deprecated @Nullable Page getPageWithComments(String spaceKey, String pageTitle)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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
-
getCommentCountOnBlog
int getCommentCountOnBlog(long blogpostId)
Counts the number of comments on the blogpost specified by the given id.- Parameters:
blogpostId
- the id to check for comments on- Returns:
- a count of the total number of comments on this blogpost
-
getBlogPost
@Deprecated @Nullable BlogPost getBlogPost(String spaceKey, String pageTitle, Calendar day)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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
@Deprecated @Nullable BlogPost getBlogPost(String spaceKey, String pageTitle, Calendar day, boolean eagerLoadComments)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicableRetrieve 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.
-
getNewestBlogPost
@Nullable BlogPost getNewestBlogPost(@Nullable String spaceKey)
Retrieves the most recently created blog post in the given space. Only the latest version of the blog post is returned. blog posts that are not current (i.e. in the trash) are not considered.- Parameters:
spaceKey
- the key of the space to retrieve the most recently created blog post for.- Returns:
- the most recently created blog post in the given space, or null if the space contains no blog posts.
-
getRecentlyAddedBlogPosts
@NonNull List getRecentlyAddedBlogPosts(int maxCount, @Nullable 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 retrievespaceKey
- 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
@NonNull List getRecentlyAddedPages(int maxCount, @Nullable 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 retrievespaceKey
- 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
@NonNull List getRecentlyUpdatedPages(int maxCount, @Nullable 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 retrievespaceKey
- 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
@Deprecated @NonNull List getOrphanedPages(@Nullable String spaceKey)
Deprecated.since 7.0.0 , no replacement This should be removed as the result of this ticket https://jira.atlassian.com/browse/CONFSRVDEV-10111Retrieve 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
@Deprecated @NonNull List getUndefinedPages(@Nullable String spaceKey)
Deprecated.since 6.6.0, usegetUndefinedLinks(String)
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
-
getUndefinedLinks
List<OutgoingLink> getUndefinedLinks(@Nullable 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 link destinations
- Since:
- 6.6.0
-
getPermissionPages
@NonNull 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(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.
-
isPageRecentlyUpdatedForUser
boolean isPageRecentlyUpdatedForUser(Page page, @Nullable com.atlassian.user.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 questionuser
- 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
-
getPagesCreatedOrUpdatedSinceDate
@NonNull 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
-
getBlogPosts
@NonNull List getBlogPosts(String spaceKey, Calendar postingDate, int period)
Get list of blogPost by Date.- Parameters:
spaceKey
- the space to look for posts inpostingDate
- a calendar object representing the date range we are looking for. Any part of the calendar more specific than the supplied period will be ignored.period
- one of the Calendar constants specifying the granularity of the search. currently, only Calendar.MONTH and Calendar.DATE are supported- Returns:
- a list of blogPost
-
getBlogPosts
@NonNull List getBlogPosts(String spaceKey, Calendar postingDate, int period, int startIndex, int maxResultCount)
Get list of blogPost by Date.- Parameters:
spaceKey
- the space to look for posts inpostingDate
- a calendar object representing the date range we are looking for. Any part of the calendar more specific than the supplied period will be ignored.period
- one of the Calendar constants specifying the granularity of the search. currently, only Calendar.MONTH and Calendar.DATE are supportedstartIndex
- start number of postsmaxResultCount
- Maximum number of posts to return- Returns:
- a list of blogPost
-
getYearsWithBlogPosts
@NonNull Set<Date> getYearsWithBlogPosts(String spaceKey)
Returns the set of years (represented as a Date with the year field populated) for which blog posts exist in the specified space.- Parameters:
spaceKey
- the key of the space to look for blog posts in.- Returns:
- the set of years for which blog posts exist.
-
getMonthsWithBlogPosts
@NonNull Set<Date> getMonthsWithBlogPosts(String spaceKey, Calendar year)
Returns the set of months in the specified year (represented as a Calendar with the year and month fields populated) for which blog posts exist in the specified space.- Parameters:
spaceKey
- the key of the space to look for blog posts in.year
- the year to examine blog posts for, represented as a Calendar with the year field specified.- Returns:
- the set of months for which blog posts exist.
-
getBlogPostDates
@NonNull List<Date> getBlogPostDates(String spaceKey)
Returns a list of creation dates for all the blog posts in a space.- Parameters:
spaceKey
- the key of the space to look for blog posts in.- Returns:
- the list of dates for which blog posts exist.
- Since:
- 7.19.9
-
getBlogPostDates
@NonNull List<Date> getBlogPostDates(String spaceKey, Calendar date, int period)
Returns a list of creation dates for all the blog posts in a space for a particular period.- Parameters:
spaceKey
- the space to look for posts in.date
- a calendar object representing the date range we are looking for. Any part of the calendar more specific than the supplied period will be ignored.period
- one of the Calendar constants specifying the granularity of the search. currently, only Calendar.YEAR, Calendar.MONTH and Calendar.DATE are supported- Returns:
- a list of creation dates for the blog posts created in the time-range. The list may be empty but will never be null
- Since:
- 7.19.9
-
getPagesWithPermissions
List<Page> getPagesWithPermissions(@NonNull Space space)
Get all current pages in a space and eagerly fetch permissions at the same time. This is an optimisation for when you known that permissions will need to be fetched for all or most of the pages later.- Parameters:
space
-- Returns:
- a list of all the current pages in a space
- Since:
- 6.1.3
-
getPageIds
@NonNull 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.
- Since:
- 4.2
-
getNotificationManager
@Deprecated default NotificationManager getNotificationManager()
Deprecated.since 5.8 do not use. Implementation detail mistakenly added to manager interface.
-
setNotificationManager
@Deprecated default void setNotificationManager(NotificationManager notificationManager)
Deprecated.since 5.8 do not use. Implementation detail mistakenly added to manager interface.
-
renamePage
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 renamenewPageTitle
- new title for page
-
renamePageWithoutNotifications
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 renamenewPageTitle
- new title for page
-
getPossibleRedirectsNotInSpace
@NonNull 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
-
getPossibleRedirectsInSpace
@NonNull 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
-
getPossibleBlogRedirectsInSpace
@NonNull 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
-
getPossibleBlogRedirectsNotInSpace
@NonNull List<AbstractPage> getPossibleBlogRedirectsNotInSpace(Space space, String blogTitle, 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.blogTitle
- title of a blog post to locatemaxResultCount
- maximum blog posts to return- Since:
- 5.6.2
-
getRecentlyAddedBlogPosts
@NonNull List getRecentlyAddedBlogPosts(int maxPosts, @Nullable Date timeSince, String spaceKey)
-
getBlogPostsInTrash
@NonNull List<BlogPost> getBlogPostsInTrash(String spaceKey, String title)
Gets a blog post that is in the trash for a given space that matches the given title.- Parameters:
spaceKey
- The space key (case-insensitive) in which to look for the blogtitle
- The title (case-insensitive) of the blog to look for- Returns:
- a list of blog posts in the trash that have the given title and space key.
- Since:
- 6.2
-
spaceHasBlogPosts
boolean spaceHasBlogPosts(String spaceKey)
-
getDescendents
@Deprecated @NonNull List getDescendents(Page page)
Deprecated.since 5.5.1. UsegetDescendants(Page)
-
getDescendants
@NonNull List<Page> getDescendants(Page page)
Finds all descendant pages of the given page- Parameters:
page
-- Returns:
- a List of descendant pages
-
getDescendantTitles
@NonNull List<String> getDescendantTitles(Page page)
Finds all descendant titles of the given page- Parameters:
page
-- Returns:
- a List of descendant titles
-
getDraftChildren
PageResponse<Page> getDraftChildren(Page page, LimitedRequest pageRequest, Depth depth)
Returns the children of a page which have a status of DRAFT, limited to the pagination requested. Will fetch drafts all drafts regardless of whether the current authenticated user has permission to view the drafts- Parameters:
page
- the page to find children forpageRequest
- the pagination requesteddepth
- the depth to return children to- Returns:
- the paginated response of Page entities
-
removeStaleSharedDrafts
int removeStaleSharedDrafts()
Removes any stale shared drafts. Stale shared drafts are pages with a content_status 'draft' and which have a last modified date that is earlier than or equal to the last modified date on the published page.- Returns:
- The number of pages removed
- Since:
- 6.0.2
-
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 ancestorsparentPage
- 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.
-
getDescendantIds
@NonNull Collection<Long> getDescendantIds(Page page)
Finds the ids of a page's descendants- Parameters:
page
-- Returns:
- a collection of page ids
-
getTopLevelPages
@NonNull 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
@Deprecated @Nullable AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
Deprecated.since 7.3.0, useContentService.find(Expansion...)
from plugins, or usePageManagerInternal
in core where applicablereturns 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)
Removes all pages in the space.This can be a lengthy operation and should be performed in a long running task. Current Hibernate session will be cleared as part of this method.
- Parameters:
space
- the space to remove pages from.
-
removeAllPages
void removeAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)
Removes all pages in the space.This can be a lengthy operation and should be performed in a long running task. Current Hibernate session will be cleared as part of this method.
- Parameters:
space
- the space to remove pages from.progress
- progress meter to report progress on, can not be null.- Since:
- 4.2
-
removeAllBlogPosts
void removeAllBlogPosts(Space space)
-
removeAllBlogPosts
void removeAllBlogPosts(Space spaceToBeRemoved, com.atlassian.core.util.ProgressMeter progress)
Remove all blog posts in a space with a progress meter- Parameters:
spaceToBeRemoved
- the space to remove blog posts fromprogress
- progress meter to report progress on, can not be null.- Since:
- 7.14.0
-
trashPage
@Deprecated void trashPage(AbstractPage page)
Deprecated.since 6.0 UsetrashPage(AbstractPage, DeleteContext)
-
trashPage
void trashPage(AbstractPage page, @NonNull DeleteContext deleteContext)
- Parameters:
page
- page to be trasheddeleteContext
- context aDeleteContext
holding additional parameters for the manager to use when trashing the page.- Since:
- 6.0
-
getTopLevelPagesBuilder
@NonNull 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
-
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 moverefPage
- 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 moverefPage
- 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 moverefPage
- the page which the first page will be made a child of
-
moveChildrenToNewParent
void moveChildrenToNewParent(Page oldParent, Page newParent)
Moves all the children from one page to another The new parent should NOT be the child of the old parent, this method will return with no operation in that caseThe location of the children under their new parent is dependent on the new parent's existing order. If they are not explicitly ordered, the children will be in their default location in the list. If the new parent have an existing order, the children will be ordered under the new parent.
- Parameters:
oldParent
- the page whose children you want to movenewParent
- the page whose the children will now belong to
-
movePageToTopLevel
void movePageToTopLevel(Page page, Space space)
Move a page to the top level oftargetSpace
. 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 movespace
- the space to move the page to
-
moveBlogPostToTopLevel
void moveBlogPostToTopLevel(BlogPost blogPost, Space space)
Move a blog post to the top level oftargetSpace
.- Parameters:
blogPost
- the blogPost to movespace
- the space to move the page to
-
setChildPageOrder
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
-
revertChildPageOrder
void revertChildPageOrder(Page parentPage)
Removes manual ordering of child pages.- Parameters:
parentPage
- the page for which children should be unordered.
-
getOrderedXhtmlContentFromContentId
@NonNull List<ContentEntityObject> getOrderedXhtmlContentFromContentId(long startContentId, long endContentId, int maxRows)
Gets the latest versions of AbstractPages between the given IDs limited by the specified number of rows. Sorted by IDs in ascending order.- Parameters:
startContentId
- The minimum IDendContentId
- The maximum IDmaxRows
- The maximum number of rows to return- Returns:
- A list of CEOs that match the criteria.
-
countPagesInSubtree
int countPagesInSubtree(Page page)
Get number of descendant page including the input page- Parameters:
page
-- Returns:
- total descendant page
-
getCountOfLatestXhtmlContent
int getCountOfLatestXhtmlContent(long endContentId)
Count the number of AbstractPages that have an ID lower than the specified ID, excluding older versions.- Parameters:
endContentId
- The maximum ID- Returns:
- The number of AbstractPages that have IDs lower than the specified ID
-
getHighestCeoId
long getHighestCeoId()
Get the highest content ID in the database, excluding older versions of content.- Returns:
- The highest content ID
-
getPreviousVersionsOfPageWithTaskId
@NonNull List<ContentEntityObject> getPreviousVersionsOfPageWithTaskId(long pageId, long taskId, int maxRows)
Get previous versions of a CEO that contain the given task ID sorted by versions in descending order.- Parameters:
pageId
- The ID of the latest version of the pagetaskId
- The task ID to look for in previous versionsmaxRows
- The maximum number of previous versions to return- Returns:
- A maximum of maxRows previous versions of the page that contain the given taskId
-
getBlogPostCount
long getBlogPostCount(String key, @Nullable Calendar postingDay, int period)
Get total number of blogPost.- Parameters:
key
- the space to look for posts inpostingDay
- a calendar object representing the date range we are looking for. Any part of the calendar more specific than the supplied period will be ignored.period
- one of the Calendar constants specifying the granularity of the search. currently, only Calendar.MONTH and Calendar.DATE are supported- Returns:
- a count number of blogPosts
-
getPageCount
long getPageCount(@NonNull String spaceKey)
Get total number of current pages in a space- Parameters:
spaceKey
- the space to look for posts in- Returns:
- a count number of pages
- Since:
- 6.1.3
-
countCurrentPages
int countCurrentPages()
Counts the total number of current pages across all spaces- Returns:
- the number of current pages
- Since:
- 6.3.1
-
countDraftPages
int countDraftPages()
Counts the number of pages that are drafts. This does not include drafts of pages that have already been published (i.e. pages with unpublished changes).- Returns:
- the number of draft pages
- Since:
- 6.3.1
-
countPagesWithUnpublishedChanges
int countPagesWithUnpublishedChanges()
Counts the number of published pages that have unpublished changes.- Returns:
- the number of pages with unpublished changes.
- Since:
- 6.3.1
-
getPageStatistics
Optional<PageStatisticsDTO> getPageStatistics()
Fetches statistics about pages- Returns:
- a PageStatisticsDTO object with statistics about pages such as total, current, and draft count
- Since:
- 6.11.0
-
countCurrentBlogs
int countCurrentBlogs()
Counts the total number of current blog posts across all spaces- Returns:
- the number of current blog posts
- Since:
- 6.3.1
-
countDraftBlogs
int countDraftBlogs()
Counts the number of blog posts that are drafts. This does not include drafts of blog posts that have already been published (i.e. blog posts with unpublished changes).- Returns:
- the number of draft blog posts
- Since:
- 6.3.1
-
countBlogsWithUnpublishedChanges
int countBlogsWithUnpublishedChanges()
Counts the number of published blog posts that have unpublished changes.- Returns:
- the number of blog posts with unpublished changes.
- Since:
- 6.3.1
-
getBlogStatistics
Optional<BlogPostStatisticsDTO> getBlogStatistics()
Fetches statistics about blogs- Returns:
- a BlogStatisticsDTO object with statistics about blogs such as total, current, and draft count
- Since:
- 6.11.0
-
refreshPage
void refreshPage(ContentEntityObject page)
Refresh the page object in the hibernate session. This might be necessary if the page object has become stale.- Parameters:
page
- the page to refresh
-
deepCopyPage
void deepCopyPage(PageCopyOptions option, Page originalPage, Page destinationPage)
Copy child page of originalPage to destinationPage- Parameters:
option
- hint for us how we should copy page. Need to have READ permission on this page and all its child pagesoriginalPage
- source page. Need to have CREATE permission on itdestinationPage
- destination page- Since:
- 5.10
-
deepDeletePage
void deepDeletePage(PageDeleteOptions options, Page targetPage)
Deletes a page hierarchy- Parameters:
options
- options for bulk delete pagestargetPage
- target page hierarchy to be deleted
-
-