Class DefaultPageManager
- java.lang.Object
-
- com.atlassian.confluence.impl.content.DefaultContentEntityManager
-
- com.atlassian.confluence.impl.content.DefaultPageManager
-
- All Implemented Interfaces:
ContentEntityManager,ContentDraftManagerInternal,ContentEntityManagerInternal,PageManagerInternal,PageManager
@ParametersAreNonnullByDefault public class DefaultPageManager extends DefaultContentEntityManager implements PageManagerInternal
- Since:
- 7.15
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCERPT_KEYstatic StringSTALE_DRAFT_REMOVE_BATCH_SIZE-
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
-
-
Constructor Summary
Constructors Constructor Description DefaultPageManager(PageDaoInternal pageDao, AttachmentManager attachmentManager, HibernateSessionManager5 hibernateSessionManager5, WikiToStorageConverter wikiToStorageConverter, com.atlassian.event.api.EventPublisher eventPublisher, BlogPostDao blogPostDao, AbstractPageDaoInternal abstractPageDao, SpaceDao spaceDao, ContentPropertyManager contentPropertyManager, PermissionManager permissionManager, LoginManager loginManager, ExceptionTolerantMigrator revertedContentMigrator, CollaborativeEditingHelper collaborativeEditingHelper, RelationManager relationManager, SpacePermissionQueryManager spacePermissionQueryManager, ContentPermissionManager contentPermissionManager, com.atlassian.beehive.ClusterLockService clusterLockService, LinksUpdater linksUpdater, SpacePermissionManager spacePermissionManager, org.springframework.transaction.PlatformTransactionManager transactionManager, AuditingContext auditingContext, RetentionFeatureChecker retentionFeatureChecker, ContentReconciliationManager reconciliationManager, UpdateAttachmentsOnFilesystemOnPageMoveHandler updateAttachmentsOnFilesystemOnPageMoveHandler, org.hibernate.SessionFactory sessionFactory)Deprecated.since 7.19.6DefaultPageManager(PageDaoInternal pageDao, AttachmentManager attachmentManager, HibernateSessionManager5 hibernateSessionManager5, WikiToStorageConverter wikiToStorageConverter, com.atlassian.event.api.EventPublisher eventPublisher, BlogPostDao blogPostDao, AbstractPageDaoInternal abstractPageDao, SpaceDao spaceDao, ContentPropertyManager contentPropertyManager, PermissionManager permissionManager, LoginManager loginManager, ExceptionTolerantMigrator revertedContentMigrator, CollaborativeEditingHelper collaborativeEditingHelper, RelationManager relationManager, SpacePermissionQueryManager spacePermissionQueryManager, ContentPermissionManager contentPermissionManager, com.atlassian.beehive.ClusterLockService clusterLockService, LinksUpdater linksUpdater, SpacePermissionManager spacePermissionManager, org.springframework.transaction.PlatformTransactionManager transactionManager, AuditingContext auditingContext, RetentionFeatureChecker retentionFeatureChecker, ContentReconciliationManager reconciliationManager, UpdateAttachmentsOnFilesystemOnPageMoveHandler updateAttachmentsOnFilesystemOnPageMoveHandler, org.hibernate.SessionFactory sessionFactory, ContentPropertyService contentPropertyService)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcountBlogsWithUnpublishedChanges()Counts the number of published blog posts that have unpublished changes.intcountCurrentBlogs()Counts the total number of current blog posts across all spacesintcountCurrentPages()Counts the total number of current pages across all spacesintcountDraftBlogs()Counts the number of blog posts that are drafts.intcountDraftPages()Counts the number of pages that are drafts.intcountPagesInSubtree(Page page)Get number of descendant page including the input pageintcountPagesWithUnpublishedChanges()Counts the number of published pages that have unpublished changes.AbstractPagecreateDraft(String contentType, String spaceKey)This method creates a draftAbstractPagecreateDraft(String contentType, String spaceKey, long parentPageId)This method creates a draft.AbstractPagecreateOrFindDraftFor(@NonNull AbstractPage page)Retrieves the draft for the given AbstractPage if exists.voiddeepCopyPage(PageCopyOptions pageCopyOptions, Page originalPage, Page destinationPage)Copy child page of originalPage to destinationPagevoiddeepDeletePage(PageDeleteOptions options, Page targetPage)Deletes a page hierarchyList<ContentPermissionSummary>findContentPermissionSummaryByIds(Collection<Long> ids)Get ContentPermissionSummary for bulk permission checking@Nullable BlogPostfindNextBlogPost(BlogPost post)@Nullable BlogPostfindNextBlogPost(String key, Date time)@Nullable BlogPostfindPreviousBlogPost(BlogPost post)@Nullable BlogPostfindPreviousBlogPost(String key, Date time)@Nullable AbstractPagegetAbstractPage(long id)Retrieve the AbstractPage subclass with the given content ID.@NonNull PageResponse<AbstractPage>getAbstractPages(Space space, String title, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<AbstractPage>getAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull List<AbstractPage>getAbstractPages(Iterable<Long> ids)Retrieve a collection of the AbstractPage subclass with the given content IDs.@NonNull PageResponse<AbstractPage>getAbstractPages(String title, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<AbstractPage>getAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<AbstractPage>getAbstractPages(org.joda.time.DateTime date, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<AbstractPage>getAbstractPagesByCreationDate(org.joda.time.DateTime date, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<AbstractPage>getAbstractPagesByTitle(String title, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)Deprecated.since 7.0.1.@NonNull PageResponse<Page>getAllChildren(Page page, LimitedRequest pageRequest, Depth depth)Returns all the children of a page (including drafts), limited to the pagination requestedintgetAuthoredPagesCountByUser(String username)Get the number of pages that have been created by a particular user@Nullable BlogPostgetBlogPost(long id)Retrieve the blog post with the given content ID.@Nullable BlogPostgetBlogPost(String spaceKey, String postTitle, Calendar day)Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.@Nullable BlogPostgetBlogPost(String spaceKey, String postTitle, 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.longgetBlogPostCount(String spaceKey, @Nullable Calendar postingDate, 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 PageResponse<BlogPost>getBlogPosts(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super BlogPost>... filters)Deprecated.since 7.0.1.@NonNull ListgetBlogPosts(String spaceKey, Calendar postingDate, int period)Get list of blogPost by Date.@NonNull ListgetBlogPosts(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 blogs@Nullable AbstractPagegetById(long id)Override default implementation to explicitly return an AbstractPage.@NonNull PageResponse<Page>getChildren(Page page, LimitedRequest pageRequest, Depth depth)Returns the children of a page which have a status of CURRENT, limited to the pagination requested.intgetCommentCountOnBlog(long blogId)Counts the number of comments on the blogpost specified by the given id.intgetCommentCountOnPage(long pageId)Counts the number of comments on the page specified by the given id.intgetCountOfLatestXhtmlContent(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 ListgetDescendents(Page page)Deprecated.since 5.5.1.@NonNull 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.longgetHighestCeoId()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 BlogPostgetNewestBlogPost(@Nullable String spaceKey)Retrieves the most recently created blog post in the given space.@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 ListgetOrphanedPages(@Nullable String spaceKey)Retrieve a list of pages in a given space that are not linked to.@Nullable PagegetPage(long id)Retrieve the page with the given content ID.@Nullable PagegetPage(String spaceKey, String pageTitle)Retrieve the latest version of a page by its space key and title.@Nullable AbstractPagegetPageByVersion(AbstractPage mostRecentPage, int version)returns the historical version of a pagelonggetPageCount(@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 ListgetPageInTrash(String spaceKey, String title)@NonNull List<Page>getPages(@Nullable Space space, boolean currentOnly)@NonNull PageResponse<Page>getPages(LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)Deprecated.since 7.0.1.@NonNull PageResponse<Page>getPages(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)Deprecated.since 7.0.1.@NonNull List<Page>getPages(Iterable<Long> ids)Retrieve a collection of pages with the given content IDs.@NonNull ListgetPagesCreatedOrUpdatedSinceDate(Date previousLoginDate)Get the list of all pages created or updated since a particular date.@NonNull ListgetPagesStartingWith(Space space, String s)Optional<PageStatisticsDTO>getPageStatistics()Fetches statistics about pages@NonNull List<Page>getPagesWithPermissions(Space space)Get all current pages in a space and eagerly fetch permissions at the same time.@Nullable PagegetPageWithComments(String spaceKey, String pageTitle)Retrieve the latest version of a page by its space key and title.@NonNull ListgetPermissionPages(Space space)Retrieve all pages within a particular space that have page level permissions applied to them.Collection<Page>getPermissionPages(Space space, LimitedRequest limitedRequest)Pagination permission pages for particular SpacelonggetPermissionPagesCount(Space space)Get total number of permission pages for particular Space@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 ListgetRecentlyAddedBlogPosts(int maxCount, @Nullable String spaceKey)Retrieve the most recently created blog posts in a given space.@NonNull ListgetRecentlyAddedBlogPosts(int maxPosts, @Nullable Date timeSince, String spaceKey)@NonNull ListgetRecentlyAddedPages(int maxCount, @Nullable String spaceKey)Retrieve the most recently created pages in a given space.@NonNull ListgetRecentlyUpdatedPages(int maxCount, @Nullable String spaceKey)Retrieve the most recently modified pages in a given space.@NonNull List<Page>getTopLevelPages(Space space)Get all the pages in a space that do not have a parent page.@NonNull PageResponse<Page>getTopLevelPages(Space space, LimitedRequest pageRequest)Returns the current top-level pages in a space, limited to the pagination requested.@NonNull ListBuilder<Page>getTopLevelPagesBuilder(Space space)NOTE: Despite our best intentions, we still have to retrieve all the top level pages and order them outside the database.List<OutgoingLink>getUndefinedLinks(@Nullable String spaceKey)Retrieve a list of link destinations in a given space that do not have pages.@NonNull List<OutgoingLink>getUndefinedPages(@Nullable String spaceKey)Retrieve a list of link destinations in a given space that do not have pages.@NonNull List<Page>getUnsortedTopLevelPages(Space space)@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.booleanisPageRecentlyUpdatedForUser(Page page, @Nullable com.atlassian.user.User user)Returns true if the page has been created or modified since the user last logged in.voidmoveBlogPostToTopLevel(BlogPost blogPost, Space space)Move a blog post to the top level oftargetSpace.voidmoveChildrenToNewParent(Page oldPage, 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 casevoidmovePageAfter(Page page, Page refPage)Move the provided page (first argument) after the reference page (second argument).voidmovePageAsChild(Page page, Page newParent)Move the source page to the end of targetPage's children list.voidmovePageBefore(Page page, Page refPage)Move the provided page (first argument) before the reference page (second argument).voidmovePageToTopLevel(Page oldPage, Space destinationSpace)Move a page to the top level oftargetSpace.voidreconcileIfNeeded(AbstractPage content, @Nullable SaveContext saveContext)This method triggersSynchronyRecoveryEventif collab editing is turned on and data recovery is needed.voidrefreshPage(ContentEntityObject page)Refresh the page object in the hibernate session.voidremoveAllBlogPosts(Space space)voidremoveAllBlogPosts(Space space, com.atlassian.core.util.ProgressMeter progress)Remove all blog posts in a space with a progress metervoidremoveAllPages(Space space)Removes all pages in the space.voidremoveAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)removes all the pages in a space (including all dependencies like attachments and notifications)voidremovePageFromAncestorCollections(Page page)Removes the page and its ancestors from the ancestor collection of all descendants.intremoveStaleSharedDrafts()Removes any stale shared drafts.voidrenamePage(AbstractPage page, String newPageTitle)Call this function if you want to rename the page only.voidrenamePageWithoutNotifications(AbstractPage page, String newPageTitle)Call this function if you want to rename the page only, and don't want notifications generated.voidrestorePage(AbstractPage page)Restores a trashed page, effectively moving it out of the trash and promoting it back to being normal page.voidrevertChildPageOrder(Page parentPage)Removes manual ordering of child pages.voidrevertContentEntityBackToVersion(ContentEntityObject entity, int version, @Nullable String revertComment, boolean revertTitle)Reverts aContentEntityObjectback to its state at the version specified byversion.voidsaveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)In order to create a history for this object, we need to pass in the modified as well as the original version of the object.voidsaveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)<T extends ContentEntityObject>
voidsaveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)Applies the state changes supplied by modification and persists those changes to a new version.@NonNull PageResponse<Page>scanFilteredPages(Space space, List<ContentStatus> statuses, LimitedRequest pageRequest, Predicate<? super Page>... filter)Returns all pages in the space which has specified content statuses, limited to the pagination request.@NonNull PageResponse<Page>scanFilteredPages(List<ContentStatus> statuses, LimitedRequest pageRequest, Predicate<? super Page>... filter)Returns all pages with specified content statuses, limited to the pagination request.voidsetChildPageOrder(Page parentPage, List<Long> childIds)Sets ordering of child pages for a supplied page, based on a map of child ids to positions.booleanspaceHasBlogPosts(String spaceKey)voidtrashPage(AbstractPage page)voidtrashPage(AbstractPage page, @NonNull DeleteContext deleteContext)voidupdatePageInAncestorCollections(Page page, @Nullable Page newParent)Updates the ancestors of a page and all it's descendant pages with the new parent page and its ancestors.-
Methods inherited from class com.atlassian.confluence.impl.content.DefaultContentEntityManager
convertFromWikiToStorageFormatIfRequired, createDraft, findAllDraftsFor, findAllDraftsWithUnpublishedChangesForUser, findDraftFor, findDraftFor, findUnpublishedContentWithUserContributions, getById, getById, getByIds, getContributionStatusByUser, getNextVersion, getOtherVersion, getPageAndBlogPostsVersionsLastEditedByUser, getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, getVersionHistorySummaries, getVersionsLastEditedByUser, publishCreateEvent, publishRemoveEvent, publishUpdateEvent, refreshContentEntity, removeContentEntities, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveNewVersion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getContributionStatusByUser, getNextVersion, getOtherVersion, getPageAndBlogPostsVersionsLastEditedByUser, getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, getVersionsLastEditedByUser, refreshContentEntity, removeContentEntity, removeHistoricalVersion, saveNewVersion
-
Methods inherited from interface com.atlassian.confluence.internal.ContentEntityManagerInternal
getByIdsAndFilters
-
Methods inherited from interface com.atlassian.confluence.pages.PageManager
getNotificationManager, setNotificationManager
-
Methods inherited from interface com.atlassian.confluence.internal.pages.PageManagerInternal
getFilteredAbstractPages, getFilteredAbstractPages, getFilteredAbstractPages, getFilteredAbstractPages, getFilteredAbstractPages, getFilteredAbstractPagesByCreationDate, getFilteredAbstractPagesByTitle, getFilteredBlogPosts, getFilteredPages, getFilteredPages
-
-
-
-
Field Detail
-
EXCERPT_KEY
public static final String EXCERPT_KEY
- See Also:
- Constant Field Values
-
STALE_DRAFT_REMOVE_BATCH_SIZE
public static final String STALE_DRAFT_REMOVE_BATCH_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultPageManager
public DefaultPageManager(PageDaoInternal pageDao, AttachmentManager attachmentManager, HibernateSessionManager5 hibernateSessionManager5, WikiToStorageConverter wikiToStorageConverter, com.atlassian.event.api.EventPublisher eventPublisher, BlogPostDao blogPostDao, AbstractPageDaoInternal abstractPageDao, SpaceDao spaceDao, ContentPropertyManager contentPropertyManager, PermissionManager permissionManager, LoginManager loginManager, ExceptionTolerantMigrator revertedContentMigrator, CollaborativeEditingHelper collaborativeEditingHelper, RelationManager relationManager, SpacePermissionQueryManager spacePermissionQueryManager, ContentPermissionManager contentPermissionManager, com.atlassian.beehive.ClusterLockService clusterLockService, LinksUpdater linksUpdater, SpacePermissionManager spacePermissionManager, org.springframework.transaction.PlatformTransactionManager transactionManager, AuditingContext auditingContext, RetentionFeatureChecker retentionFeatureChecker, ContentReconciliationManager reconciliationManager, UpdateAttachmentsOnFilesystemOnPageMoveHandler updateAttachmentsOnFilesystemOnPageMoveHandler, org.hibernate.SessionFactory sessionFactory, ContentPropertyService contentPropertyService)
- Since:
- 7.19.6
-
DefaultPageManager
@Deprecated public DefaultPageManager(PageDaoInternal pageDao, AttachmentManager attachmentManager, HibernateSessionManager5 hibernateSessionManager5, WikiToStorageConverter wikiToStorageConverter, com.atlassian.event.api.EventPublisher eventPublisher, BlogPostDao blogPostDao, AbstractPageDaoInternal abstractPageDao, SpaceDao spaceDao, ContentPropertyManager contentPropertyManager, PermissionManager permissionManager, LoginManager loginManager, ExceptionTolerantMigrator revertedContentMigrator, CollaborativeEditingHelper collaborativeEditingHelper, RelationManager relationManager, SpacePermissionQueryManager spacePermissionQueryManager, ContentPermissionManager contentPermissionManager, com.atlassian.beehive.ClusterLockService clusterLockService, LinksUpdater linksUpdater, SpacePermissionManager spacePermissionManager, org.springframework.transaction.PlatformTransactionManager transactionManager, AuditingContext auditingContext, RetentionFeatureChecker retentionFeatureChecker, ContentReconciliationManager reconciliationManager, UpdateAttachmentsOnFilesystemOnPageMoveHandler updateAttachmentsOnFilesystemOnPageMoveHandler, org.hibernate.SessionFactory sessionFactory)
Deprecated.since 7.19.6- Since:
- 7.16
-
-
Method Detail
-
createDraft
public AbstractPage createDraft(String contentType, String spaceKey)
Description copied from interface:PageManagerInternalThis method creates a draft- Specified by:
createDraftin interfacePageManagerInternal- Parameters:
contentType- - content type of the draft to create: page or blogpostspaceKey- - space key of the space to create the draft into- Returns:
- the obj created as draft
- See Also:
ContentEntityObject.DRAFT
-
createDraft
public AbstractPage createDraft(String contentType, String spaceKey, long parentPageId)
Description copied from interface:PageManagerInternalThis method creates a draft. The draft is created as a child of the parentPage- Specified by:
createDraftin interfacePageManagerInternal- Parameters:
contentType- - content type of the draft to create: page or blogpostspaceKey- - space key of the space to create the draft intoparentPageId- - parent page ID of the newly created draft- Returns:
- the obj created as draft
-
createOrFindDraftFor
public AbstractPage createOrFindDraftFor(@NonNull AbstractPage page)
Description copied from interface:PageManagerInternalRetrieves the draft for the given AbstractPage if exists.- Specified by:
createOrFindDraftForin interfacePageManagerInternal- Parameters:
page- the AbstractPage to retrieve the draft for- Returns:
- the draft for the given AbstractPage if exists, null otherwise
- See Also:
ContentEntityObject.DRAFT
-
renamePage
public void renamePage(AbstractPage page, String newPageTitle)
Description copied from interface:PageManagerCall 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.- Specified by:
renamePagein interfacePageManager- Parameters:
page- to renamenewPageTitle- new title for page
-
renamePageWithoutNotifications
public void renamePageWithoutNotifications(AbstractPage page, String newPageTitle)
Description copied from interface:PageManagerCall 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.- Specified by:
renamePageWithoutNotificationsin interfacePageManager- Parameters:
page- to renamenewPageTitle- new title for page
-
getBlogPosts
public @NonNull List<BlogPost> getBlogPosts(Space space, boolean currentOnly)
- Specified by:
getBlogPostsin interfacePageManager
-
getPossibleRedirectsInSpace
public @NonNull List<AbstractPage> getPossibleRedirectsInSpace(Space space, String pageTitle, int maxResultCount)
Description copied from interface:PageManagerSearches for pages in the space specified, looking for those that have the given title in a previous version.- Specified by:
getPossibleRedirectsInSpacein interfacePageManager- Parameters:
space- Space to search. Must not be null.pageTitle- title of a page in a previous version.maxResultCount- maximum pages to return
-
getPossibleBlogRedirectsInSpace
public @NonNull List<AbstractPage> getPossibleBlogRedirectsInSpace(Space space, String blogTitle, int maxResultCount)
Description copied from interface:PageManagerSearches for blogs in the space specified, looking for those that have the given title in a previous version.- Specified by:
getPossibleBlogRedirectsInSpacein interfacePageManager- Parameters:
space- Space to search. Must not be null.blogTitle- title of a blog in a previous version.maxResultCount- maximum blogs to return
-
getPossibleBlogRedirectsNotInSpace
public @NonNull List<AbstractPage> getPossibleBlogRedirectsNotInSpace(Space space, String blogTitle, int maxResultCount)
Description copied from interface:PageManagerSearches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.- Specified by:
getPossibleBlogRedirectsNotInSpacein interfacePageManager- 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
-
getPossibleRedirectsNotInSpace
public @NonNull List<AbstractPage> getPossibleRedirectsNotInSpace(Space space, String pageTitle, int maxResultCount)
Description copied from interface:PageManagerSearches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.- Specified by:
getPossibleRedirectsNotInSpacein interfacePageManager- 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
-
getRecentlyAddedBlogPosts
public @NonNull List getRecentlyAddedBlogPosts(int maxPosts, @Nullable Date timeSince, String spaceKey)
- Specified by:
getRecentlyAddedBlogPostsin interfacePageManager
-
getPage
public @Nullable Page getPage(long id)
Description copied from interface:PageManagerRetrieve the page with the given content ID.- Specified by:
getPagein interfacePageManager- 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
public @NonNull List<Page> getPages(Iterable<Long> ids)
Description copied from interface:PageManagerRetrieve a collection of pages with the given content IDs.- Specified by:
getPagesin interfacePageManager- 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
public @Nullable AbstractPage getAbstractPage(long id)
Description copied from interface:PageManagerRetrieve 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.- Specified by:
getAbstractPagein interfacePageManager- 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
public @NonNull List<AbstractPage> getAbstractPages(Iterable<Long> ids)
Description copied from interface:PageManagerRetrieve 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.- Specified by:
getAbstractPagesin interfacePageManager- 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.
-
getById
public @Nullable AbstractPage getById(long id)
Override default implementation to explicitly return an AbstractPage.- Specified by:
getByIdin interfaceContentEntityManager- Overrides:
getByIdin classDefaultContentEntityManager- Returns:
- an AbstractPage with the given id.
-
getBlogPost
public @Nullable BlogPost getBlogPost(long id)
Description copied from interface:PageManagerRetrieve the blog post with the given content ID.- Specified by:
getBlogPostin interfacePageManager- 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
public @Nullable Page getPage(String spaceKey, String pageTitle)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getPagein interfacePageManager- Returns:
- the page specified by the spaceKey and pageTitle, or null if the page cannot be found, or is in the trash.
-
getPageWithComments
public @Nullable Page getPageWithComments(String spaceKey, String pageTitle)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getPageWithCommentsin interfacePageManager- Returns:
- the page specified by the spaceKey and pageTitle, or null if the page cannot be found, or is in the trash.
-
getAbstractPagesByTitle
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPagesByTitle(String title, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns all current pages and blog posts that exactly match the given title, that also match the given predicate, limited to the pagination request.- Specified by:
getAbstractPagesByTitlein interfacePageManagerInternal- Parameters:
title- the title of the page or blog post to matchpageRequest- the pagination requestedfilter- a predicate to apply to the results before returning- Returns:
- the paginated list of AbstractPages by title
-
getAbstractPagesByCreationDate
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPagesByCreationDate(org.joda.time.DateTime date, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns the pages and blog posts created on the given date, that also match the given predicate, limited to the page request.- Specified by:
getAbstractPagesByCreationDatein interfacePageManagerInternal- Parameters:
date- the creation date of the page or blog postpageRequest- the pagination requestfilter- a predicate to apply to the results before returning- Returns:
- the paginated list of AbstractPages created on the given date
-
getAbstractPages
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns all content in the instance within any of the specified statuses, limited to the specified content types and the pagination request.- Specified by:
getAbstractPagesin interfacePageManagerInternal- Parameters:
contentTypes- types of the content to fetch, pages and or blog postsstatuses- list of statuses the content can be inpageRequest- the pagination requestedfilter- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities in the given space
-
getAbstractPages
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns all content in the space within any of the specified statuses and content types, limited to the pagination request.- Specified by:
getAbstractPagesin interfacePageManagerInternal- Parameters:
space- the space to locate pages incontentTypes- types of the content to fetch, pages and or blog postsstatuses- list of statuses the content can be inpageRequest- the pagination requestedfilter- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities in the given space
-
getAbstractPages
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPages(org.joda.time.DateTime date, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns pages and blog posts created on the specified date, that are in any of the given statuses, and also match the given predicate, limited to the page request.- Specified by:
getAbstractPagesin interfacePageManagerInternal- Parameters:
date- the creation date to matchstatuses- list of statuses the content can be inpageRequest- the pagination requestfilter- a predicate to apply to the results before returning- Returns:
- the paginated list of AbstractPages created on the given date
-
getAbstractPages
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPages(Space space, String title, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns pages and blog posts that belong to the space, exactly match the given title, are in any of the specified statuses, and match the given predicate, limited to the pagination request.- Specified by:
getAbstractPagesin interfacePageManagerInternal- Parameters:
space- space the content belongs totitle- the title of the page to matchstatuses- list of statuses the content can be inpageRequest- the pagination requestedfilter- a Predicate to apply to the results before returning- Returns:
- the paginated list of AbstractPages that have a title, are in the specified statuses, and belong to the given space
-
getAbstractPages
@Deprecated public @NonNull PageResponse<AbstractPage> getAbstractPages(String title, List<ContentStatus> statuses, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
Deprecated.Description copied from interface:PageManagerInternalReturns pages and blog posts that exactly match the given title, are in any of the specified statuses, and match the given predicate, limited to the pagination request.- Specified by:
getAbstractPagesin interfacePageManagerInternal- Parameters:
title- the title of the page to matchstatuses- list of statuses the content can be inpageRequest- the pagination requestedfilter- a predicate to apply to the results before returning- Returns:
- the paginated list of AbstractPages by title
-
findContentPermissionSummaryByIds
public List<ContentPermissionSummary> findContentPermissionSummaryByIds(Collection<Long> ids)
Description copied from interface:PageManagerInternalGet ContentPermissionSummary for bulk permission checking- Specified by:
findContentPermissionSummaryByIdsin interfacePageManagerInternal- Parameters:
ids- of Content- Returns:
- List of ContentPermissionSummary
-
getCommentCountOnPage
public int getCommentCountOnPage(long pageId)
Description copied from interface:PageManagerCounts the number of comments on the page specified by the given id.- Specified by:
getCommentCountOnPagein interfacePageManager- Parameters:
pageId- the id to check for comments on- Returns:
- a count of the total number of comments on this page
-
getCommentCountOnBlog
public int getCommentCountOnBlog(long blogId)
Description copied from interface:PageManagerCounts the number of comments on the blogpost specified by the given id.- Specified by:
getCommentCountOnBlogin interfacePageManager- Parameters:
blogId- the id to check for comments on- Returns:
- a count of the total number of comments on this blogpost
-
getPageInTrash
public @NonNull List getPageInTrash(String spaceKey, String title)
- Specified by:
getPageInTrashin interfacePageManager
-
getBlogPostsInTrash
public @NonNull List<BlogPost> getBlogPostsInTrash(String spaceKey, String title)
Description copied from interface:PageManagerGets a blog post that is in the trash for a given space that matches the given title.- Specified by:
getBlogPostsInTrashin interfacePageManager- 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.
-
spaceHasBlogPosts
public boolean spaceHasBlogPosts(String spaceKey)
- Specified by:
spaceHasBlogPostsin interfacePageManager
-
getDescendants
public @NonNull List<Page> getDescendants(Page page)
Description copied from interface:PageManagerFinds all descendant pages of the given page- Specified by:
getDescendantsin interfacePageManager- Returns:
- a List of descendant pages
-
getDescendantTitles
public @NonNull List<String> getDescendantTitles(Page page)
Description copied from interface:PageManagerFinds all descendant titles of the given page- Specified by:
getDescendantTitlesin interfacePageManager- Returns:
- a List of descendant titles
-
getDescendents
@Deprecated public @NonNull List getDescendents(Page page)
Deprecated.since 5.5.1. UsegetDescendants(Page)- Specified by:
getDescendentsin interfacePageManager
-
updatePageInAncestorCollections
public void updatePageInAncestorCollections(Page page, @Nullable Page newParent)
Description copied from interface:PageManagerUpdates the ancestors of a page and all it's descendant pages with the new parent page and its ancestors.- Specified by:
updatePageInAncestorCollectionsin interfacePageManager- Parameters:
page- the page being updated with new ancestorsnewParent- the new parent page of the page being updated
-
removePageFromAncestorCollections
public void removePageFromAncestorCollections(Page page)
Description copied from interface:PageManagerRemoves the page and its ancestors from the ancestor collection of all descendants.- Specified by:
removePageFromAncestorCollectionsin interfacePageManager
-
removeAllPages
public void removeAllPages(Space space)
Description copied from interface:PageManagerRemoves 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.
- Specified by:
removeAllPagesin interfacePageManager- Parameters:
space- the space to remove pages from.
-
removeAllPages
public void removeAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)
removes all the pages in a space (including all dependencies like attachments and notifications)- Specified by:
removeAllPagesin interfacePageManager- Parameters:
space- the space to remove all pages for.progress- progress meter to report progress on, can not be null.
-
removeAllBlogPosts
public void removeAllBlogPosts(Space space)
- Specified by:
removeAllBlogPostsin interfacePageManager
-
removeAllBlogPosts
public void removeAllBlogPosts(Space space, com.atlassian.core.util.ProgressMeter progress)
Description copied from interface:PageManagerRemove all blog posts in a space with a progress meter- Specified by:
removeAllBlogPostsin interfacePageManager- Parameters:
space- the space to remove blog posts fromprogress- progress meter to report progress on, can not be null.
-
refreshPage
public void refreshPage(ContentEntityObject page)
Description copied from interface:PageManagerRefresh the page object in the hibernate session. This might be necessary if the page object has become stale.- Specified by:
refreshPagein interfacePageManager- Parameters:
page- the page to refresh
-
deepCopyPage
public void deepCopyPage(PageCopyOptions pageCopyOptions, Page originalPage, Page destinationPage)
Description copied from interface:PageManagerCopy child page of originalPage to destinationPage- Specified by:
deepCopyPagein interfacePageManager- Parameters:
pageCopyOptions- 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
-
deepDeletePage
public final void deepDeletePage(PageDeleteOptions options, Page targetPage)
Description copied from interface:PageManagerDeletes a page hierarchy- Specified by:
deepDeletePagein interfacePageManager- Parameters:
options- options for bulk delete pagestargetPage- target page hierarchy to be deleted
-
countPagesInSubtree
public int countPagesInSubtree(Page page)
Description copied from interface:PageManagerGet number of descendant page including the input page- Specified by:
countPagesInSubtreein interfacePageManager- Returns:
- total descendant page
-
getDescendantIds
public @NonNull Collection<Long> getDescendantIds(Page page)
Description copied from interface:PageManagerFinds the ids of a page's descendants- Specified by:
getDescendantIdsin interfacePageManager- Returns:
- a collection of page ids
-
getTopLevelPages
public @NonNull List<Page> getTopLevelPages(Space space)
Description copied from interface:PageManagerGet 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.- Specified by:
getTopLevelPagesin interfacePageManager
-
getTopLevelPagesBuilder
public @NonNull ListBuilder<Page> getTopLevelPagesBuilder(Space space)
NOTE: Despite our best intentions, we still have to retrieve all the top level pages and order them outside the database. It would be nice if page ordering could be fixed so that this was not necessary, but for now we will fix the interface so that if we ever fix the implementation clients will already be taking advantage of it.- Specified by:
getTopLevelPagesBuilderin interfacePageManager- Parameters:
space- the space in which to look for pages- Returns:
- the new list builder.
-
getTopLevelPages
public @NonNull PageResponse<Page> getTopLevelPages(Space space, LimitedRequest pageRequest)
Description copied from interface:PageManagerInternalReturns the current top-level pages in a space, limited to the pagination requested.- Specified by:
getTopLevelPagesin interfacePageManagerInternal- Parameters:
space- the space to locate pages inpageRequest- the pagination requested- Returns:
- the paginated response of Page entities
-
getChildren
public @NonNull PageResponse<Page> getChildren(Page page, LimitedRequest pageRequest, Depth depth)
Description copied from interface:PageManagerInternalReturns the children of a page which have a status of CURRENT, limited to the pagination requested.- Specified by:
getChildrenin interfacePageManagerInternal- Parameters:
page- the page to find children forpageRequest- the pagination requesteddepth- the depth to return children to- Returns:
- the paginated response of Page entities
-
getDraftChildren
public @NonNull PageResponse<Page> getDraftChildren(Page page, LimitedRequest pageRequest, Depth depth)
Description copied from interface:PageManagerReturns 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- Specified by:
getDraftChildrenin interfacePageManager- Parameters:
page- the page to find children forpageRequest- the pagination requesteddepth- the depth to return children to- Returns:
- the paginated response of Page entities
-
getAllChildren
public @NonNull PageResponse<Page> getAllChildren(Page page, LimitedRequest pageRequest, Depth depth)
Description copied from interface:PageManagerInternalReturns all the children of a page (including drafts), limited to the pagination requested- Specified by:
getAllChildrenin interfacePageManagerInternal- 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
public int removeStaleSharedDrafts()
Description copied from interface:PageManagerRemoves 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.- Specified by:
removeStaleSharedDraftsin interfacePageManager- Returns:
- The number of pages removed
-
findPreviousBlogPost
public @Nullable BlogPost findPreviousBlogPost(String key, Date time)
- Specified by:
findPreviousBlogPostin interfacePageManager
-
findNextBlogPost
public @Nullable BlogPost findNextBlogPost(String key, Date time)
- Specified by:
findNextBlogPostin interfacePageManager
-
trashPage
public void trashPage(AbstractPage page)
- Specified by:
trashPagein interfacePageManager
-
trashPage
public final void trashPage(AbstractPage page, @NonNull DeleteContext deleteContext)
- Specified by:
trashPagein interfacePageManager- Parameters:
page- page to be trasheddeleteContext- context aDeleteContextholding additional parameters for the manager to use when trashing the page.
-
restorePage
public void restorePage(AbstractPage page)
Description copied from interface:PageManagerRestores a trashed page, effectively moving it out of the trash and promoting it back to being normal page.- Specified by:
restorePagein interfacePageManager- Parameters:
page- a trashed page
-
movePageToTopLevel
public void movePageToTopLevel(Page oldPage, Space destinationSpace)
Description copied from interface:PageManagerMove 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.- Specified by:
movePageToTopLevelin interfacePageManager- Parameters:
oldPage- the page to movedestinationSpace- the space to move the page to
-
moveBlogPostToTopLevel
public void moveBlogPostToTopLevel(BlogPost blogPost, Space space)
Description copied from interface:PageManagerMove a blog post to the top level oftargetSpace.- Specified by:
moveBlogPostToTopLevelin interfacePageManager- Parameters:
blogPost- the blogPost to movespace- the space to move the page to
-
movePageAfter
public void movePageAfter(Page page, Page refPage)
Description copied from interface:PageManagerMove 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.- Specified by:
movePageAfterin interfacePageManager- Parameters:
page- the page to moverefPage- the page which the first page will be placed after
-
movePageBefore
public void movePageBefore(Page page, Page refPage)
Description copied from interface:PageManagerMove 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.- Specified by:
movePageBeforein interfacePageManager- Parameters:
page- the page to moverefPage- the page which the first page will be placed before
-
movePageAsChild
public void movePageAsChild(Page page, Page newParent)
Move the source page to the end of targetPage's children list.- Specified by:
movePageAsChildin interfacePageManager- Parameters:
page- the page to movenewParent- the page which the first page will be made a child of
-
moveChildrenToNewParent
public void moveChildrenToNewParent(Page oldPage, Page newParent)
Description copied from interface:PageManagerMoves 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.
- Specified by:
moveChildrenToNewParentin interfacePageManager- Parameters:
oldPage- the page whose children you want to movenewParent- the page whose the children will now belong to
-
setChildPageOrder
public void setChildPageOrder(Page parentPage, List<Long> childIds)
Description copied from interface:PageManagerSets ordering of child pages for a supplied page, based on a map of child ids to positions.- Specified by:
setChildPageOrderin interfacePageManager- Parameters:
parentPage- the page for which children should be ordered.childIds- children page IDs in the new order
-
revertChildPageOrder
public void revertChildPageOrder(Page parentPage)
Description copied from interface:PageManagerRemoves manual ordering of child pages.- Specified by:
revertChildPageOrderin interfacePageManager- Parameters:
parentPage- the page for which children should be unordered.
-
getOrderedXhtmlContentFromContentId
public @NonNull List<ContentEntityObject> getOrderedXhtmlContentFromContentId(long startContentId, long endContentId, int maxRows)
Description copied from interface:PageManagerGets the latest versions of AbstractPages between the given IDs limited by the specified number of rows. Sorted by IDs in ascending order.- Specified by:
getOrderedXhtmlContentFromContentIdin interfacePageManager- Parameters:
startContentId- The minimum IDendContentId- The maximum IDmaxRows- The maximum number of rows to return- Returns:
- A list of CEOs that match the criteria.
-
getCountOfLatestXhtmlContent
public int getCountOfLatestXhtmlContent(long endContentId)
Description copied from interface:PageManagerCount the number of AbstractPages that have an ID lower than the specified ID, excluding older versions.- Specified by:
getCountOfLatestXhtmlContentin interfacePageManager- Parameters:
endContentId- The maximum ID- Returns:
- The number of AbstractPages that have IDs lower than the specified ID
-
getHighestCeoId
public long getHighestCeoId()
Description copied from interface:PageManagerGet the highest content ID in the database, excluding older versions of content.- Specified by:
getHighestCeoIdin interfacePageManager- Returns:
- The highest content ID
-
getPreviousVersionsOfPageWithTaskId
public @NonNull List<ContentEntityObject> getPreviousVersionsOfPageWithTaskId(long pageId, long taskId, int maxRows)
Description copied from interface:PageManagerGet previous versions of a CEO that contain the given task ID sorted by versions in descending order.- Specified by:
getPreviousVersionsOfPageWithTaskIdin interfacePageManager- 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
-
getPageByVersion
public @Nullable AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
Description copied from interface:PageManagerreturns the historical version of a page- Specified by:
getPageByVersionin interfacePageManager- 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
-
getBlogPost
public @Nullable BlogPost getBlogPost(String spaceKey, String postTitle, Calendar day)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getBlogPostin interfacePageManager- Returns:
- the appropriate blog post, or null if none can be found, or the post is in the trash.
-
getBlogPost
public @Nullable BlogPost getBlogPost(String spaceKey, String postTitle, Calendar day, boolean eagerLoadComments)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getBlogPostin interfacePageManager- Returns:
- the appropriate blog post, or null if none can be found, or the post is in the trash.
-
getNewestBlogPost
public @Nullable BlogPost getNewestBlogPost(@Nullable String spaceKey)
Description copied from interface:PageManagerRetrieves 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.- Specified by:
getNewestBlogPostin interfacePageManager- 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
public @NonNull List getRecentlyAddedBlogPosts(int maxCount, @Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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- Specified by:
getRecentlyAddedBlogPostsin interfacePageManager- 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
public @NonNull List getRecentlyAddedPages(int maxCount, @Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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- Specified by:
getRecentlyAddedPagesin interfacePageManager- 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
public @NonNull List getRecentlyUpdatedPages(int maxCount, @Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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- Specified by:
getRecentlyUpdatedPagesin interfacePageManager- 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
public @NonNull List getOrphanedPages(@Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getOrphanedPagesin interfacePageManager- 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
public @NonNull List<OutgoingLink> getUndefinedPages(@Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getUndefinedPagesin interfacePageManager- 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
public final List<OutgoingLink> getUndefinedLinks(@Nullable String spaceKey)
Description copied from interface:PageManagerRetrieve 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.
- Specified by:
getUndefinedLinksin interfacePageManager- 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
-
getPermissionPages
public @NonNull List getPermissionPages(Space space)
Description copied from interface:PageManagerRetrieve 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.- Specified by:
getPermissionPagesin interfacePageManager- Parameters:
space- the space to search- Returns:
- the list of all pages in that space with page-level permissions
-
getPermissionPages
public Collection<Page> getPermissionPages(Space space, LimitedRequest limitedRequest)
Description copied from interface:PageManagerInternalPagination permission pages for particular Space- Specified by:
getPermissionPagesin interfacePageManagerInternal- Returns:
- Collection of permission pages within the request range
-
getPermissionPagesCount
public long getPermissionPagesCount(Space space)
Description copied from interface:PageManagerInternalGet total number of permission pages for particular Space- Specified by:
getPermissionPagesCountin interfacePageManagerInternal- Returns:
- the count
-
saveContentEntity
public void saveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)
- Specified by:
saveContentEntityin interfaceContentEntityManager- Overrides:
saveContentEntityin classDefaultContentEntityManager- Parameters:
obj- - theContentEntityObjectto savesaveContext- - aSaveContextholding additional parameters for the manager to use when saving.- Throws:
DuplicateDataRuntimeException- if the supplied page has a duplicate title.
-
saveContentEntity
public void saveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
Description copied from interface:ContentEntityManagerIn order to create a history for this object, we need to pass in the modified as well as the original version of the object.- Specified by:
saveContentEntityin interfaceContentEntityManager- Overrides:
saveContentEntityin classDefaultContentEntityManagersaveContext- - aSaveContextholding additional parameters for the manager to use when saving.- Throws:
DuplicateDataRuntimeException- if the supplied page has a duplicate title.
-
saveNewVersion
public <T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)
Description copied from interface:ContentEntityManagerApplies the state changes supplied by modification and persists those changes to a new version.manager.<Page>saveNewVersion(page, new Modification<Page>() { public void modify(Page page) { page.setTitle("foobar"); } }, new DefaultSaveContext());- Specified by:
saveNewVersionin interfaceContentEntityManager- Overrides:
saveNewVersionin classDefaultContentEntityManager- Type Parameters:
T- the type content. This ensures that the type of current is the same as the type passed to the modification- Parameters:
current- the current / latest versionmodification- an implementation ofModificationwhich describes the state changes you requiresaveContext- the save context (null if you have no specific requirements - or just useContentEntityManager.saveNewVersion(ContentEntityObject, Modification)).
-
reconcileIfNeeded
public void reconcileIfNeeded(AbstractPage content, @Nullable SaveContext saveContext)
Description copied from interface:PageManagerInternalThis method triggersSynchronyRecoveryEventif collab editing is turned on and data recovery is needed. Recovery is needed when:contentis the latest version of the page or blog post AND- content is not reconciled (
'sync-rev-source'content property is not empty and not equals to neither'synchrony'or'synchrony-ack') AND - update trigger of
saveContextis not equal toPageUpdateTrigger.LINK_REFACTORING
- Specified by:
reconcileIfNeededin interfacePageManagerInternal- Parameters:
content- content to be recoveredsaveContext- context of operation
-
getAuthoredPagesCountByUser
public int getAuthoredPagesCountByUser(String username)
Description copied from interface:PageManagerGet the number of pages that have been created by a particular user- Specified by:
getAuthoredPagesCountByUserin interfacePageManager- Parameters:
username- the username of the user to search for- Returns:
- the number of pages that have been created by that user.
-
isPageRecentlyUpdatedForUser
public boolean isPageRecentlyUpdatedForUser(Page page, @Nullable com.atlassian.user.User user)
Description copied from interface:PageManagerReturns 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.- Specified by:
isPageRecentlyUpdatedForUserin interfacePageManager- 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
-
revertContentEntityBackToVersion
public void revertContentEntityBackToVersion(ContentEntityObject entity, int version, @Nullable String revertComment, boolean revertTitle)
Description copied from interface:ContentEntityManagerReverts a
ContentEntityObjectback to its state at the version specified byversion. Creates a new latest version that resembles the previous state.Since Confluence 4.0 most ContentEntityObjects are assumed to be XHTML formatted. So in reverting a ContentEntityObject which actually has a WIKI
BodyTypethis will be migrated on the fly to XHTML.- Specified by:
revertContentEntityBackToVersionin interfaceContentEntityManager- Overrides:
revertContentEntityBackToVersionin classDefaultContentEntityManager- Parameters:
entity- The ContentEntityObject to revertversion- The version to revert torevertComment- A comment to be associated with the revertrevertTitle- If true, the ContentEntityObject title will be reverted to the old state
-
getPagesCreatedOrUpdatedSinceDate
public @NonNull List getPagesCreatedOrUpdatedSinceDate(Date previousLoginDate)
Description copied from interface:PageManagerGet the list of all pages created or updated since a particular date.- Specified by:
getPagesCreatedOrUpdatedSinceDatein interfacePageManager- Parameters:
previousLoginDate- the date the pages must have been created or edited after- Returns:
- all pages created or edited since that date
-
getBlogPosts
public @NonNull List getBlogPosts(String spaceKey, Calendar postingDate, int period)
Description copied from interface:PageManagerGet list of blogPost by Date.- Specified by:
getBlogPostsin interfacePageManager- 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
public @NonNull List getBlogPosts(String spaceKey, Calendar postingDate, int period, int startIndex, int maxResultCount)
Description copied from interface:PageManagerGet list of blogPost by Date.- Specified by:
getBlogPostsin interfacePageManager- 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
-
getBlogPostCount
public long getBlogPostCount(String spaceKey, @Nullable Calendar postingDate, int period)
Description copied from interface:PageManagerGet total number of blogPost.- Specified by:
getBlogPostCountin interfacePageManager- 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 count number of blogPosts
-
getPageCount
public long getPageCount(@NonNull String spaceKey)
Description copied from interface:PageManagerGet total number of current pages in a space- Specified by:
getPageCountin interfacePageManager- Parameters:
spaceKey- the space to look for posts in- Returns:
- a count number of pages
-
countCurrentPages
public int countCurrentPages()
Description copied from interface:PageManagerCounts the total number of current pages across all spaces- Specified by:
countCurrentPagesin interfacePageManager- Returns:
- the number of current pages
-
countDraftPages
public int countDraftPages()
Description copied from interface:PageManagerCounts 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).- Specified by:
countDraftPagesin interfacePageManager- Returns:
- the number of draft pages
-
countPagesWithUnpublishedChanges
public int countPagesWithUnpublishedChanges()
Description copied from interface:PageManagerCounts the number of published pages that have unpublished changes.- Specified by:
countPagesWithUnpublishedChangesin interfacePageManager- Returns:
- the number of pages with unpublished changes.
-
getPageStatistics
public Optional<PageStatisticsDTO> getPageStatistics()
Description copied from interface:PageManagerFetches statistics about pages- Specified by:
getPageStatisticsin interfacePageManager- Returns:
- a PageStatisticsDTO object with statistics about pages such as total, current, and draft count
-
countCurrentBlogs
public int countCurrentBlogs()
Description copied from interface:PageManagerCounts the total number of current blog posts across all spaces- Specified by:
countCurrentBlogsin interfacePageManager- Returns:
- the number of current blog posts
-
countDraftBlogs
public int countDraftBlogs()
Description copied from interface:PageManagerCounts 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).- Specified by:
countDraftBlogsin interfacePageManager- Returns:
- the number of draft blog posts
-
countBlogsWithUnpublishedChanges
public int countBlogsWithUnpublishedChanges()
Description copied from interface:PageManagerCounts the number of published blog posts that have unpublished changes.- Specified by:
countBlogsWithUnpublishedChangesin interfacePageManager- Returns:
- the number of blog posts with unpublished changes.
-
getBlogStatistics
public Optional<BlogPostStatisticsDTO> getBlogStatistics()
Description copied from interface:PageManagerFetches statistics about blogs- Specified by:
getBlogStatisticsin interfacePageManager- Returns:
- a BlogStatisticsDTO object with statistics about blogs such as total, current, and draft count
-
getYearsWithBlogPosts
public @NonNull Set<Date> getYearsWithBlogPosts(String spaceKey)
Description copied from interface:PageManagerReturns the set of years (represented as a Date with the year field populated) for which blog posts exist in the specified space.- Specified by:
getYearsWithBlogPostsin interfacePageManager- Parameters:
spaceKey- the key of the space to look for blog posts in.- Returns:
- the set of years for which blog posts exist.
-
getBlogPostDates
public @NonNull List<Date> getBlogPostDates(String spaceKey)
Description copied from interface:PageManagerReturns a list of creation dates for all the blog posts in a space.- Specified by:
getBlogPostDatesin interfacePageManager- Parameters:
spaceKey- the key of the space to look for blog posts in.- Returns:
- the list of dates for which blog posts exist.
-
getBlogPostDates
public @NonNull List<Date> getBlogPostDates(String spaceKey, Calendar date, int period)
Description copied from interface:PageManagerReturns a list of creation dates for all the blog posts in a space for a particular period.- Specified by:
getBlogPostDatesin interfacePageManager- 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
-
getMonthsWithBlogPosts
public @NonNull Set<Date> getMonthsWithBlogPosts(String spaceKey, Calendar year)
Description copied from interface:PageManagerReturns 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.- Specified by:
getMonthsWithBlogPostsin interfacePageManager- 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.
-
getPages
public @NonNull List<Page> getPages(@Nullable Space space, boolean currentOnly)
- Specified by:
getPagesin interfacePageManager
-
getPagesWithPermissions
public @NonNull List<Page> getPagesWithPermissions(Space space)
Description copied from interface:PageManagerGet 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.- Specified by:
getPagesWithPermissionsin interfacePageManager- Returns:
- a list of all the current pages in a space
-
getPages
@Deprecated public @NonNull PageResponse<Page> getPages(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)
Deprecated.Description copied from interface:PageManagerInternalReturns all the current pages in the space, limited to the pagination request.- Specified by:
getPagesin interfacePageManagerInternal- Parameters:
space- the space to locate pages inpageRequest- the pagination requestedfilters- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities in the given space
-
getPages
@Deprecated public @NonNull PageResponse<Page> getPages(LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)
Deprecated.Description copied from interface:PageManagerInternalReturns all the current pages in this instance of confluence, limited to the pagination request.- Specified by:
getPagesin interfacePageManagerInternal- Parameters:
pageRequest- the pagination requestedfilters- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities
-
scanFilteredPages
public @NonNull PageResponse<Page> scanFilteredPages(List<ContentStatus> statuses, LimitedRequest pageRequest, Predicate<? super Page>... filter)
Description copied from interface:PageManagerInternalReturns all pages with specified content statuses, limited to the pagination request.- Specified by:
scanFilteredPagesin interfacePageManagerInternal- Parameters:
statuses- list of content status which we are interested to fetchpageRequest- the pagination requestedfilter- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities
-
scanFilteredPages
public @NonNull PageResponse<Page> scanFilteredPages(Space space, List<ContentStatus> statuses, LimitedRequest pageRequest, Predicate<? super Page>... filter)
Description copied from interface:PageManagerInternalReturns all pages in the space which has specified content statuses, limited to the pagination request.- Specified by:
scanFilteredPagesin interfacePageManagerInternal- Parameters:
space- the space to locate pages instatuses- list of content status which we are interested to fetchpageRequest- the pagination requestedfilter- a Predicate to apply to the results before returning- Returns:
- the paginated response of Page entities in the given space
-
getBlogPosts
@Deprecated public @NonNull PageResponse<BlogPost> getBlogPosts(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super BlogPost>... filters)
Deprecated.Description copied from interface:PageManagerInternalReturns all the current blog posts in the space, limited to the pagination request.- Specified by:
getBlogPostsin interfacePageManagerInternal- Parameters:
space- the space to locate blog posts inpageRequest- the pagination requested- Returns:
- the paginated response of BlogPost entities
-
getPageIds
public @NonNull Collection<Long> getPageIds(Space space)
Description copied from interface:PageManagerGet the ids of all pages (current and historical) in the given space.- Specified by:
getPageIdsin interfacePageManager- Parameters:
space- space to retrieve page ids from, can not be null.- Returns:
- a Collection of ids for pages.
-
getPagesStartingWith
public @NonNull List getPagesStartingWith(Space space, String s)
- Specified by:
getPagesStartingWithin interfacePageManager
-
findPreviousBlogPost
public @Nullable BlogPost findPreviousBlogPost(BlogPost post)
- Specified by:
findPreviousBlogPostin interfacePageManager
-
findNextBlogPost
public @Nullable BlogPost findNextBlogPost(BlogPost post)
- Specified by:
findNextBlogPostin interfacePageManager
-
-