com.atlassian.confluence.pages
Class DefaultPageManager

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultContentEntityManager
      extended by com.atlassian.confluence.pages.DefaultPageManager
All Implemented Interfaces:
ContentEntityManager, ContentEntityManagerInternal, PageManagerInternal, PageManager

public class DefaultPageManager
extends DefaultContentEntityManager
implements PageManagerInternal


Field Summary
static java.lang.String EXCERPT_KEY
           
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
attachmentManager, contentEntityObjectDao, eventManager, hibernateSessionManager, indexer, labelManager, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultPageManager()
           
 
Method Summary
 BlogPost findNextBlogPost(BlogPost post)
           
 BlogPost findNextBlogPost(java.lang.String key, java.util.Date time)
           
 BlogPost findPreviousBlogPost(BlogPost post)
           
 BlogPost findPreviousBlogPost(java.lang.String key, java.util.Date time)
           
 AbstractPage getAbstractPage(long id)
          Retrieve the AbstractPage subclass with the given content ID.
 java.util.List<AbstractPage> getAbstractPages(java.lang.Iterable<java.lang.Long> ids)
          Retrieve a collection of the AbstractPage subclass with the given content IDs.
 PageResponse<AbstractPage> getAbstractPagesByCreationDate(org.joda.time.DateTime date, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
          Returns the pages and blogposts created on the given date, that also match the given predicate, limited to the page request
 PageResponse<AbstractPage> getAbstractPagesByTitle(java.lang.String title, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage>... filter)
          Returns the pages and blogposts that exactly match the given title, that also match the given predicate, limited to the pagination request
 AttachmentManager getAttachmentManager()
           
 int getAuthoredPagesCountByUser(java.lang.String username)
          Get the number of pages that have been created by a particular user
 BlogPost getBlogPost(long id)
          Retrieve the blog post with the given content ID.
 BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String postTitle, java.util.Calendar day)
          Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.
 BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String postTitle, java.util.Calendar day, boolean eagerLoadComments)
          Retrieve the latest version of a blog post by its space key, title, and the day on which it was published.
 long getBlogPostCount(java.lang.String spaceKey, java.util.Calendar postingDate, int period)
          Get total number of blogPost.
 java.util.List<BlogPost> getBlogPosts(Space space, boolean currentOnly)
           
 PageResponse<BlogPost> getBlogPosts(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super BlogPost>... filters)
          Returns all the current blogposts in the space, limited to the pagination request
 java.util.List getBlogPosts(java.lang.String spaceKey, java.util.Calendar postingDate, int period)
          Get list of blogPost by Date.
 java.util.List getBlogPosts(java.lang.String spaceKey, java.util.Calendar postingDate, int period, int startIndex, int maxResultCount)
          Get list of blogPost by Date.
protected  BodyContent getBodyContentForRevert(ContentEntityObject historicalVersion)
           
 AbstractPage getById(long id)
          Override default implementation to explicitly return an AbstractPage.
 PageResponse<Page> getChildren(Page page, LimitedRequest pageRequest, Depth depth)
          Returns the children of a page, limited to the pagination requested.
 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.
 java.util.Collection<java.lang.Long> getDescendantIds(Page page)
          Finds the ids of a page's descendants
 java.util.List<Page> getDescendants(Page page)
          Finds all descendant pages of the given page
 java.util.List<java.lang.String> getDescendantTitles(Page page)
          Finds all descendant titles of the given page
 java.util.Collection getDescendentIds(Page page)
           
 java.util.List getDescendents(Page page)
          Deprecated. since 5.5.1. Use getDescendants(Page)
 long getHighestCeoId()
          Get the highest content ID in the database, excluding older versions of content.
 java.util.Set<java.util.Date> getMonthsWithBlogPosts(java.lang.String spaceKey, java.util.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.
 BlogPost getNewestBlogPost(java.lang.String spaceKey)
          Retrieves the most recently created blog post in the given space.
 NotificationManager getNotificationManager()
           
 java.util.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.
 java.util.List getOrphanedPages(java.lang.String spaceKey)
          Retrieve a list of pages in a given space that are not linked to.
 Page getPage(long id)
          Retrieve the page with the given content ID.
 Page getPage(java.lang.String spaceKey, java.lang.String pageTitle)
          Retrieve the latest version of a page by its space key and title.
 Page getPage(java.lang.String spaceKey, java.lang.String pageTitle, boolean eagerLoadComments)
          Deprecated. 
 AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
          returns the historical version of a page
 java.util.Collection<java.lang.Long> getPageIds(Space space)
          Get the ids of all pages (current and historical) in the given space.
 java.util.List getPageInTrash(java.lang.String spaceKey, java.lang.String title)
           
 java.util.List<Page> getPages(java.lang.Iterable<java.lang.Long> ids)
          Retrieve a collection of pages with the given content IDs.
 PageResponse<Page> getPages(LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)
          Returns all the current pages in this instance of confluence, limited to the pagination request.
 java.util.List<Page> getPages(Space space, boolean currentOnly)
           
 PageResponse<Page> getPages(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super Page>... filters)
          Returns all the current pages in the space, limited to the pagination request
 java.util.List getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
          Get the list of all pages created or updated since a particular date.
 java.util.List getPagesStartingWith(Space space, java.lang.String s)
           
 Page getPageWithComments(java.lang.String spaceKey, java.lang.String pageTitle)
          Retrieve the latest version of a page by its space key and title.
 PermissionManager getPermissionManager()
           
 java.util.List getPermissionPages(Space space)
          Retrieve all pages within a particular space that have page level permissions applied to them.
 java.util.List<AbstractPage> getPossibleBlogRedirectsInSpace(Space space, java.lang.String blogTitle, int maxResultCount)
          Searches for blogs in the space specified, looking for those that have the given title in a previous version.
 java.util.List getPossibleRedirects(java.lang.String pageTitle)
           
 java.util.List<AbstractPage> getPossibleRedirectsForSpace(Space space, java.lang.String pageTitle)
           
 java.util.List<AbstractPage> getPossibleRedirectsInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
          Searches for pages in the space specified, looking for those that have the given title in a previous version.
 java.util.List<AbstractPage> getPossibleRedirectsNotInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
          Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version.
 java.util.List<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.
 java.util.List getRecentlyAddedBlogPosts(int maxPosts, java.util.Date timeSince, java.lang.String spaceKey)
           
 java.util.List getRecentlyAddedBlogPosts(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently created blog posts in a given space.
 java.util.List getRecentlyAddedPages(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently created pages in a given space.
 java.util.List getRecentlyUpdatedPages(int maxCount, java.lang.String spaceKey)
          Retrieve the most recently modified pages in a given space.
 java.util.List<Page> getTopLevelPages(Space space)
          Get all the pages in a space that do not have a parent page.
 PageResponse<Page> getTopLevelPages(Space space, LimitedRequest pageRequest)
          Returns the top-level pages in a space, limited to the pagination requested.
 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.
 java.util.List getUndefinedPages(java.lang.String spaceKey)
          Retrieve a list of link destinations in a given space that do not have pages.
 java.util.List<Page> getUnsortedTopLevelPages(Space space)
           
 java.util.Set<java.util.Date> getYearsWithBlogPosts(java.lang.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, 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 of targetSpace.
 void moveChildrenToNewParent(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 case The location of the children under their new parent is dependent on the new parent's existing order.
 void movePageAfter(Page page, Page refPage)
          Move the provided page (first argument) after the reference page (second argument).
 void movePageAsChild(Page page, Page newParent)
          Move the source page to the end of targetPage's children list.
 void movePageBefore(Page page, Page refPage)
          Move the provided page (first argument) before the reference page (second argument).
 void movePageToTopLevel(Page page, Space space)
          Move a page to the top level of targetSpace.
protected  void publishCreateEvent(ContentEntityObject obj)
          This method publishes *CreateEventss.
protected  void publishCreateEvent(ContentEntityObject obj, SaveContext saveContext)
           
protected  void publishRemoveEvent(ContentEntityObject obj)
          This method publishes *RemoveEvents.
protected  void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
          This method publishes *UpdateEvents.
 void removeAllBlogPosts(Space space)
           
 void removeAllPages(Space space)
          Removes all pages in the space.
 void removeAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)
          removes all the pages in a space (including all dependencies like attachments and notifications)
 void removePageFromAncestorCollections(Page page)
          Removes the page and its ancestors from the ancestor collection of all descendants.
 void renamePage(AbstractPage page, java.lang.String newPageTitle)
          Call this function if you want to rename the page only.
 void renamePageWithoutNotifications(AbstractPage page, java.lang.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 saveContentEntity(ContentEntityObject obj, ContentEntityObject origObj, 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.
 void saveContentEntity(ContentEntityObject obj, SaveContext saveContext)
           
 void setAbstractPageDao(AbstractPageDao abstractPageDao)
           
 void setBlogPostDao(BlogPostDao blogPostDao)
           
 void setChangeIndexer(ChangeIndexer changeIndexer)
           
 void setChildPageOrder(Page parentPage, java.util.List<java.lang.Long> childIds)
          Sets ordering of child pages for a supplied page, based on a map of child ids to positions.
 void setContentPropertyManager(ContentPropertyManager contentPropertyManager)
           
 void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setLoginManager(LoginManager loginManager)
           
 void setNotificationManager(NotificationManager notificationManager)
           
 void setRevertedContentMigratorRef(com.atlassian.util.concurrent.Supplier<ExceptionTolerantMigrator> migratorRef)
           
 void setSpaceDao(SpaceDao spaceDao)
           
 boolean spaceHasBlogPosts(java.lang.String spaceKey)
           
 void trashPage(AbstractPage page)
           
 void updatePageInAncestorCollections(Page page, 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.core.DefaultContentEntityManager
getById, getEventManager, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveNewVersion, saveNewVersion, setAttachmentManager, setContentEntityObjectDao, setEventManager, setHibernateSessionManager, setLabelManager, setLinkManager, suppressNotificationsOnEventIfRequired, updateContentLinkingTo, updateContentLinkingTo, updateOutgoingLinksInContent, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 
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.pages.PageManager
setAttachmentManager
 
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveNewVersion, saveNewVersion, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Field Detail

EXCERPT_KEY

public static final java.lang.String EXCERPT_KEY
See Also:
Constant Field Values
Constructor Detail

DefaultPageManager

public DefaultPageManager()
Method Detail

renamePage

public void renamePage(AbstractPage page,
                       java.lang.String newPageTitle)
Description copied from interface: PageManager
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.

Specified by:
renamePage in interface PageManager
Parameters:
page - to rename
newPageTitle - new title for page

renamePageWithoutNotifications

public void renamePageWithoutNotifications(AbstractPage page,
                                           java.lang.String newPageTitle)
Description copied from interface: PageManager
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.

Specified by:
renamePageWithoutNotifications in interface PageManager
Parameters:
page - to rename
newPageTitle - new title for page

getBlogPosts

public java.util.List<BlogPost> getBlogPosts(Space space,
                                             boolean currentOnly)
Specified by:
getBlogPosts in interface PageManager

getPossibleRedirectsForSpace

public java.util.List<AbstractPage> getPossibleRedirectsForSpace(Space space,
                                                                 java.lang.String pageTitle)
Specified by:
getPossibleRedirectsForSpace in interface PageManager

getPossibleRedirectsInSpace

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

Specified by:
getPossibleRedirectsInSpace in interface PageManager
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 java.util.List<AbstractPage> getPossibleBlogRedirectsInSpace(Space space,
                                                                    java.lang.String blogTitle,
                                                                    int maxResultCount)
Description copied from interface: PageManager
Searches for blogs in the space specified, looking for those that have the given title in a previous version.

Specified by:
getPossibleBlogRedirectsInSpace in interface PageManager
Parameters:
space - Space to search. Must not be null.
blogTitle - title of a blog in a previous version.
maxResultCount - maximum blogs to return

getPossibleRedirectsNotInSpace

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

Specified by:
getPossibleRedirectsNotInSpace in interface PageManager
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

getPossibleRedirects

public java.util.List getPossibleRedirects(java.lang.String pageTitle)
Specified by:
getPossibleRedirects in interface PageManager

getRecentlyAddedBlogPosts

public java.util.List getRecentlyAddedBlogPosts(int maxPosts,
                                                java.util.Date timeSince,
                                                java.lang.String spaceKey)
Specified by:
getRecentlyAddedBlogPosts in interface PageManager

setBlogPostDao

public void setBlogPostDao(BlogPostDao blogPostDao)

getPage

public Page getPage(long id)
Description copied from interface: PageManager
Retrieve the page with the given content ID.

Specified by:
getPage in interface PageManager
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 java.util.List<Page> getPages(java.lang.Iterable<java.lang.Long> ids)
Description copied from interface: PageManager
Retrieve a collection of pages with the given content IDs.

Specified by:
getPages in interface PageManager
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 AbstractPage getAbstractPage(long id)
Description copied from interface: PageManager
Retrieve the AbstractPage subclass with the given content ID. This will return either a page or a blogpost, depending on the type of the database entity.

Specified by:
getAbstractPage in interface PageManager
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 java.util.List<AbstractPage> getAbstractPages(java.lang.Iterable<java.lang.Long> ids)
Description copied from interface: PageManager
Retrieve 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:
getAbstractPages in interface PageManager
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 AbstractPage getById(long id)
Override default implementation to explicitly return an AbstractPage.

Specified by:
getById in interface ContentEntityManager
Overrides:
getById in class DefaultContentEntityManager
Returns:
an AbstractPage with the given id.

getBlogPost

public BlogPost getBlogPost(long id)
Description copied from interface: PageManager
Retrieve the blog post with the given content ID.

Specified by:
getBlogPost in interface PageManager
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 Page getPage(java.lang.String spaceKey,
                    java.lang.String pageTitle)
Description copied from interface: PageManager
Retrieve the latest version of a page by its space key and title. Pages that are not current (i.e. in the trash) will not be returned.

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

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

getPageWithComments

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

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

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

getAbstractPagesByTitle

public PageResponse<AbstractPage> getAbstractPagesByTitle(java.lang.String title,
                                                          LimitedRequest pageRequest,
                                                          com.google.common.base.Predicate<? super AbstractPage>... filter)
Description copied from interface: PageManagerInternal
Returns the pages and blogposts that exactly match the given title, that also match the given predicate, limited to the pagination request

Specified by:
getAbstractPagesByTitle in interface PageManagerInternal
Parameters:
title - the title of the page to match
pageRequest - the pagination requested
filter - a Predicate to apply to the results before returning
Returns:
the paginated list of AbstractPages by title

getAbstractPagesByCreationDate

public PageResponse<AbstractPage> getAbstractPagesByCreationDate(org.joda.time.DateTime date,
                                                                 LimitedRequest pageRequest,
                                                                 com.google.common.base.Predicate<? super AbstractPage>... filter)
Description copied from interface: PageManagerInternal
Returns the pages and blogposts created on the given date, that also match the given predicate, limited to the page request

Specified by:
getAbstractPagesByCreationDate in interface PageManagerInternal
Parameters:
date - - the creation date to match
pageRequest - the pagination request
filter - a Predicate to apply to the results before returning
Returns:
the paginated list of AbstractPages created on the given date

getCommentCountOnPage

public int getCommentCountOnPage(long pageId)
Description copied from interface: PageManager
Counts the number of comments on the page specified by the given id.

Specified by:
getCommentCountOnPage in interface PageManager
Parameters:
pageId - the id to check for comments on
Returns:
a count of the total number of comments on this page

getPage

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

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

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

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

getPageInTrash

public java.util.List getPageInTrash(java.lang.String spaceKey,
                                     java.lang.String title)
Specified by:
getPageInTrash in interface PageManager

spaceHasBlogPosts

public boolean spaceHasBlogPosts(java.lang.String spaceKey)
Specified by:
spaceHasBlogPosts in interface PageManager

getDescendants

public java.util.List<Page> getDescendants(Page page)
Description copied from interface: PageManager
Finds all descendant pages of the given page

Specified by:
getDescendants in interface PageManager
Returns:
a List of descendant pages

getDescendantTitles

public java.util.List<java.lang.String> getDescendantTitles(Page page)
Description copied from interface: PageManager
Finds all descendant titles of the given page

Specified by:
getDescendantTitles in interface PageManager
Returns:
a List of descendant titles

getDescendents

public java.util.List getDescendents(Page page)
Deprecated. since 5.5.1. Use getDescendants(Page)

Specified by:
getDescendents in interface PageManager

updatePageInAncestorCollections

public void updatePageInAncestorCollections(Page page,
                                            @Nullable
                                            Page newParent)
Description copied from interface: PageManager
Updates the ancestors of a page and all it's descendant pages with the new parent page and its ancestors.

Specified by:
updatePageInAncestorCollections in interface PageManager
Parameters:
page - the page being updated with new ancestors
newParent - the new parent page of the page being updated

removePageFromAncestorCollections

public void removePageFromAncestorCollections(Page page)
Description copied from interface: PageManager
Removes the page and its ancestors from the ancestor collection of all descendants.

Specified by:
removePageFromAncestorCollections in interface PageManager

removeAllPages

public void removeAllPages(Space space)
Description copied from interface: PageManager
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.

Specified by:
removeAllPages in interface PageManager
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:
removeAllPages in interface PageManager
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:
removeAllBlogPosts in interface PageManager

getDescendantIds

public java.util.Collection<java.lang.Long> getDescendantIds(Page page)
Description copied from interface: PageManager
Finds the ids of a page's descendants

Specified by:
getDescendantIds in interface PageManager
Returns:
a collection of page ids

getDescendentIds

public java.util.Collection getDescendentIds(Page page)
Specified by:
getDescendentIds in interface PageManager

getTopLevelPages

public java.util.List<Page> getTopLevelPages(Space space)
Description copied from interface: PageManager
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.

Specified by:
getTopLevelPages in interface PageManager

getUnsortedTopLevelPages

public java.util.List<Page> getUnsortedTopLevelPages(Space space)

getTopLevelPagesBuilder

public 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:
getTopLevelPagesBuilder in interface PageManager
Parameters:
space - the space in which to look for pages
Returns:
the new list builder.

getTopLevelPages

public PageResponse<Page> getTopLevelPages(Space space,
                                           LimitedRequest pageRequest)
Description copied from interface: PageManagerInternal
Returns the top-level pages in a space, limited to the pagination requested.

Specified by:
getTopLevelPages in interface PageManagerInternal
Parameters:
space - the space to locate pages in
pageRequest - the pagination requested
Returns:
the paginated response of Page entities

getChildren

public PageResponse<Page> getChildren(Page page,
                                      LimitedRequest pageRequest,
                                      Depth depth)
Description copied from interface: PageManagerInternal
Returns the children of a page, limited to the pagination requested.

Specified by:
getChildren in interface PageManagerInternal
Parameters:
page - the page to find children for
pageRequest - the pagination requested
depth - the depth to return children to
Returns:
the paginated response of Page entities

findPreviousBlogPost

public BlogPost findPreviousBlogPost(java.lang.String key,
                                     java.util.Date time)
Specified by:
findPreviousBlogPost in interface PageManager

findNextBlogPost

public BlogPost findNextBlogPost(java.lang.String key,
                                 java.util.Date time)
Specified by:
findNextBlogPost in interface PageManager

trashPage

public void trashPage(AbstractPage page)
Specified by:
trashPage in interface PageManager

restorePage

public void restorePage(AbstractPage page)
Description copied from interface: PageManager
Restores a trashed page, effectively moving it out of the trash and promoting it back to being normal page.

Specified by:
restorePage in interface PageManager
Parameters:
page - a trashed page

movePageToTopLevel

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

Specified by:
movePageToTopLevel in interface PageManager
Parameters:
page - the page to move
space - the space to move the page to

moveBlogPostToTopLevel

public void moveBlogPostToTopLevel(BlogPost blogPost,
                                   Space space)
Description copied from interface: PageManager
Move a blog post to the top level of targetSpace.

Specified by:
moveBlogPostToTopLevel in interface PageManager
Parameters:
blogPost - the blogPost to move
space - the space to move the page to

movePageAfter

public void movePageAfter(Page page,
                          Page refPage)
Description copied from interface: PageManager
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.

Specified by:
movePageAfter in interface PageManager
Parameters:
page - the page to move
refPage - the page which the first page will be placed after

movePageBefore

public void movePageBefore(Page page,
                           Page refPage)
Description copied from interface: PageManager
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.

Specified by:
movePageBefore in interface PageManager
Parameters:
page - the page to move
refPage - 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:
movePageAsChild in interface PageManager
Parameters:
page - the page to move
newParent - the page which the first page will be made a child of

moveChildrenToNewParent

public void moveChildrenToNewParent(Page oldPage,
                                    Page newParent)
Description copied from interface: PageManager
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 case The 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:
moveChildrenToNewParent in interface PageManager
Parameters:
oldPage - the page whose children you want to move
newParent - the page whose the children will now belong to

setChildPageOrder

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

Specified by:
setChildPageOrder in interface PageManager
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: PageManager
Removes manual ordering of child pages.

Specified by:
revertChildPageOrder in interface PageManager
Parameters:
parentPage - the page for which children should be unordered.

getOrderedXhtmlContentFromContentId

public java.util.List<ContentEntityObject> getOrderedXhtmlContentFromContentId(long startContentId,
                                                                               long endContentId,
                                                                               int maxRows)
Description copied from interface: PageManager
Gets the latest versions of AbstractPages between the given IDs limited by the specified number of rows. Sorted by IDs in ascending order.

Specified by:
getOrderedXhtmlContentFromContentId in interface PageManager
Parameters:
startContentId - The minimum ID
endContentId - The maximum ID
maxRows - 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: PageManager
Count the number of AbstractPages that have an ID lower than the specified ID, excluding older versions.

Specified by:
getCountOfLatestXhtmlContent in interface PageManager
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: PageManager
Get the highest content ID in the database, excluding older versions of content.

Specified by:
getHighestCeoId in interface PageManager
Returns:
The highest content ID

getPreviousVersionsOfPageWithTaskId

public java.util.List<ContentEntityObject> getPreviousVersionsOfPageWithTaskId(long pageId,
                                                                               long taskId,
                                                                               int maxRows)
Description copied from interface: PageManager
Get previous versions of a CEO that contain the given task ID sorted by versions in descending order.

Specified by:
getPreviousVersionsOfPageWithTaskId in interface PageManager
Parameters:
pageId - The ID of the latest version of the page
taskId - The task ID to look for in previous versions
maxRows - 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 AbstractPage getPageByVersion(AbstractPage mostRecentPage,
                                     int version)
Description copied from interface: PageManager
returns the historical version of a page

Specified by:
getPageByVersion in interface PageManager
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 BlogPost getBlogPost(java.lang.String spaceKey,
                            java.lang.String postTitle,
                            java.util.Calendar day)
Description copied from interface: PageManager
Retrieve the latest version of a blog post by its space key, title, and the day on which it was published. Blog posts that are not current (i.e. in the trash) will not be returned.

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

Specified by:
getBlogPost in interface PageManager
Returns:
the appropriate blog post, or null if none can be found, or the post is in the trash.

getBlogPost

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

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

Specified by:
getBlogPost in interface PageManager
Returns:
the appropriate blog post, or null if none can be found, or the post is in the trash.

getNewestBlogPost

public BlogPost getNewestBlogPost(java.lang.String spaceKey)
Description copied from interface: PageManager
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.

Specified by:
getNewestBlogPost in interface PageManager
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 java.util.List getRecentlyAddedBlogPosts(int maxCount,
                                                java.lang.String spaceKey)
Description copied from interface: PageManager
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

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

getRecentlyAddedPages

public java.util.List getRecentlyAddedPages(int maxCount,
                                            java.lang.String spaceKey)
Description copied from interface: PageManager
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

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

getRecentlyUpdatedPages

public java.util.List getRecentlyUpdatedPages(int maxCount,
                                              java.lang.String spaceKey)
Description copied from interface: PageManager
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

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

getOrphanedPages

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

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

Specified by:
getOrphanedPages in interface PageManager
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 java.util.List getUndefinedPages(java.lang.String spaceKey)
Description copied from interface: PageManager
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.

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

getPermissionPages

public java.util.List getPermissionPages(Space space)
Description copied from interface: PageManager
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.

Specified by:
getPermissionPages in interface PageManager
Parameters:
space - the space to search
Returns:
the list of all pages in that space with page-level permissions

saveContentEntity

public void saveContentEntity(ContentEntityObject obj,
                              SaveContext saveContext)
Specified by:
saveContentEntity in interface ContentEntityManager
Overrides:
saveContentEntity in class DefaultContentEntityManager
Parameters:
obj - - the ContentEntityObject to save
saveContext - - a SaveContext object for the manager.
Throws:
DuplicateDataRuntimeException - if the supplied page has a duplicate title.

saveContentEntity

public void saveContentEntity(ContentEntityObject obj,
                              ContentEntityObject origObj,
                              SaveContext saveContext)
Description copied from interface: ContentEntityManager
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.

Specified by:
saveContentEntity in interface ContentEntityManager
Overrides:
saveContentEntity in class DefaultContentEntityManager
saveContext - - a SaveContext holding additional parameters for the manager to use when saving.
Throws:
DuplicateDataRuntimeException - if the supplied page has a duplicate title.

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishCreateEvent in class DefaultContentEntityManager
Parameters:
obj - the created content entity object

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj,
                                  SaveContext saveContext)
Overrides:
publishCreateEvent in class DefaultContentEntityManager

publishUpdateEvent

protected void publishUpdateEvent(ContentEntityObject obj,
                                  ContentEntityObject origObj,
                                  SaveContext saveContext)
Description copied from class: DefaultContentEntityManager
This method publishes *UpdateEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishUpdateEvent in class DefaultContentEntityManager
Parameters:
obj - the updated content entity object
origObj - the old version of the content entity object, for history purpose
saveContext - the associated SaveContext

publishRemoveEvent

protected void publishRemoveEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishRemoveEvent in class DefaultContentEntityManager
Parameters:
obj - the removed content entity object

getAuthoredPagesCountByUser

public int getAuthoredPagesCountByUser(java.lang.String username)
Description copied from interface: PageManager
Get the number of pages that have been created by a particular user

Specified by:
getAuthoredPagesCountByUser in interface PageManager
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,
                                            com.atlassian.user.User user)
Description copied from interface: PageManager
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.

Specified by:
isPageRecentlyUpdatedForUser in interface PageManager
Parameters:
page - the page in question
user - the user or null if it is the anonymous user
Returns:
true if the page has been created or modified since the user's last login, false otherwise

getBodyContentForRevert

protected BodyContent getBodyContentForRevert(ContentEntityObject historicalVersion)
Overrides:
getBodyContentForRevert in class DefaultContentEntityManager

getPagesCreatedOrUpdatedSinceDate

public java.util.List getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
Description copied from interface: PageManager
Get the list of all pages created or updated since a particular date.

Specified by:
getPagesCreatedOrUpdatedSinceDate in interface PageManager
Parameters:
previousLoginDate - the date the pages must have been created or edited after
Returns:
all pages created or edited since that date

getBlogPosts

public java.util.List getBlogPosts(java.lang.String spaceKey,
                                   java.util.Calendar postingDate,
                                   int period)
Description copied from interface: PageManager
Get list of blogPost by Date.

Specified by:
getBlogPosts in interface PageManager
Parameters:
spaceKey - the space to look for posts in
postingDate - 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 java.util.List getBlogPosts(java.lang.String spaceKey,
                                   java.util.Calendar postingDate,
                                   int period,
                                   int startIndex,
                                   int maxResultCount)
Description copied from interface: PageManager
Get list of blogPost by Date.

Specified by:
getBlogPosts in interface PageManager
Parameters:
spaceKey - the space to look for posts in
postingDate - 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
startIndex - start number of posts
maxResultCount - Maximum number of posts to return
Returns:
a list of blogPost

getBlogPostCount

public long getBlogPostCount(java.lang.String spaceKey,
                             java.util.Calendar postingDate,
                             int period)
Description copied from interface: PageManager
Get total number of blogPost.

Specified by:
getBlogPostCount in interface PageManager
Parameters:
spaceKey - the space to look for posts in
postingDate - 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

getYearsWithBlogPosts

public java.util.Set<java.util.Date> getYearsWithBlogPosts(java.lang.String spaceKey)
Description copied from interface: PageManager
Returns the set of years (represented as a Date with the year field populated) for which blog posts exist in the specified space.

Specified by:
getYearsWithBlogPosts in interface PageManager
Parameters:
spaceKey - the key of the space to look for blog posts in.
Returns:
the set of years for which blog posts exist.

getMonthsWithBlogPosts

public java.util.Set<java.util.Date> getMonthsWithBlogPosts(java.lang.String spaceKey,
                                                            java.util.Calendar year)
Description copied from interface: PageManager
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.

Specified by:
getMonthsWithBlogPosts in interface PageManager
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 java.util.List<Page> getPages(Space space,
                                     boolean currentOnly)
Specified by:
getPages in interface PageManager

getPages

public PageResponse<Page> getPages(Space space,
                                   LimitedRequest pageRequest,
                                   com.google.common.base.Predicate<? super Page>... filters)
Description copied from interface: PageManagerInternal
Returns all the current pages in the space, limited to the pagination request

Specified by:
getPages in interface PageManagerInternal
Parameters:
space - the space to locate pages in
pageRequest - the pagination requested
filters - a Predicate to apply to the results before returning
Returns:
the paginated response of Page entities in the given space

getPages

public PageResponse<Page> getPages(LimitedRequest pageRequest,
                                   com.google.common.base.Predicate<? super Page>... filters)
Description copied from interface: PageManagerInternal
Returns all the current pages in this instance of confluence, limited to the pagination request.

Specified by:
getPages in interface PageManagerInternal
Parameters:
pageRequest - the pagination requested
filters - a Predicate to apply to the results before returning
Returns:
the paginated response of Page entities

getBlogPosts

public PageResponse<BlogPost> getBlogPosts(Space space,
                                           LimitedRequest pageRequest,
                                           com.google.common.base.Predicate<? super BlogPost>... filters)
Description copied from interface: PageManagerInternal
Returns all the current blogposts in the space, limited to the pagination request

Specified by:
getBlogPosts in interface PageManagerInternal
Returns:
the paginated response of BlogPost entities

getPageIds

public java.util.Collection<java.lang.Long> getPageIds(Space space)
Description copied from interface: PageManager
Get the ids of all pages (current and historical) in the given space.

Specified by:
getPageIds in interface PageManager
Parameters:
space - space to retrieve page ids from, can not be null.
Returns:
a Collection of ids for pages.

getPagesStartingWith

public java.util.List getPagesStartingWith(Space space,
                                           java.lang.String s)
Specified by:
getPagesStartingWith in interface PageManager

findPreviousBlogPost

public BlogPost findPreviousBlogPost(BlogPost post)
Specified by:
findPreviousBlogPost in interface PageManager

findNextBlogPost

public BlogPost findNextBlogPost(BlogPost post)
Specified by:
findNextBlogPost in interface PageManager

getNotificationManager

public NotificationManager getNotificationManager()
Specified by:
getNotificationManager in interface PageManager

setNotificationManager

public void setNotificationManager(NotificationManager notificationManager)
Specified by:
setNotificationManager in interface PageManager

getAttachmentManager

public AttachmentManager getAttachmentManager()
Specified by:
getAttachmentManager in interface PageManager

setIndexer

public void setIndexer(ConfluenceIndexer indexer)
Overrides:
setIndexer in class DefaultContentEntityManager

setContentPropertyManager

public void setContentPropertyManager(ContentPropertyManager contentPropertyManager)

setAbstractPageDao

public void setAbstractPageDao(AbstractPageDao abstractPageDao)

setSpaceDao

public void setSpaceDao(SpaceDao spaceDao)

getPermissionManager

public PermissionManager getPermissionManager()

setChangeIndexer

public void setChangeIndexer(ChangeIndexer changeIndexer)

setLoginManager

public void setLoginManager(LoginManager loginManager)

setI18NBeanFactory

public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)

setRevertedContentMigratorRef

public void setRevertedContentMigratorRef(com.atlassian.util.concurrent.Supplier<ExceptionTolerantMigrator> migratorRef)


Copyright © 2003-2014 Atlassian. All Rights Reserved.