|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.core.DefaultContentEntityManager com.atlassian.confluence.pages.DefaultPageManager
public class DefaultPageManager
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. |
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. |
java.util.List<BlogPost> |
getBlogPosts(Space space,
boolean currentOnly)
|
java.util.List |
getBlogPosts(java.lang.String spaceKey,
java.util.Calendar postingDate,
int period)
|
protected BodyContent |
getBodyContentForRevert(ContentEntityObject historicalVersion)
|
ContentEntityObject |
getById(long id)
Override default implementation to explicitly return an AbstractPage. |
int |
getCommentCountOnPage(long pageId)
Counts the number of comments on the page specified by the given id. |
java.util.Collection |
getDescendentIds(Page page)
|
java.util.List |
getDescendents(Page page)
|
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 |
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(Space space,
boolean currentOnly)
|
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 |
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. |
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 |
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 *CreateEvents s. |
protected void |
publishCreateEvent(ContentEntityObject obj,
SaveContext saveContext)
|
protected void |
publishRemoveEvent(ContentEntityObject obj)
This method publishes *RemoveEvent s. |
protected void |
publishUpdateEvent(ContentEntityObject obj,
ContentEntityObject origObj,
SaveContext saveContext)
This method publishes *UpdateEvent s. |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.atlassian.confluence.pages.PageManager |
---|
setAttachmentManager |
Field Detail |
---|
public static final java.lang.String EXCERPT_KEY
Constructor Detail |
---|
public DefaultPageManager()
Method Detail |
---|
public void renamePage(AbstractPage page, java.lang.String newPageTitle)
PageManager
renamePage
in interface PageManager
page
- to renamenewPageTitle
- new title for pagepublic void renamePageWithoutNotifications(AbstractPage page, java.lang.String newPageTitle)
PageManager
renamePageWithoutNotifications
in interface PageManager
page
- to renamenewPageTitle
- new title for pagepublic java.util.List<BlogPost> getBlogPosts(Space space, boolean currentOnly)
getBlogPosts
in interface PageManager
public java.util.List<AbstractPage> getPossibleRedirectsForSpace(Space space, java.lang.String pageTitle)
getPossibleRedirectsForSpace
in interface PageManager
public java.util.List<AbstractPage> getPossibleRedirectsInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
PageManager
getPossibleRedirectsInSpace
in interface PageManager
space
- Space to search. Must not be null.pageTitle
- title of a page in a previous version.maxResultCount
- maximum pages to returnpublic java.util.List<AbstractPage> getPossibleBlogRedirectsInSpace(Space space, java.lang.String blogTitle, int maxResultCount)
PageManager
getPossibleBlogRedirectsInSpace
in interface PageManager
space
- Space to search. Must not be null.blogTitle
- title of a blog in a previous version.maxResultCount
- maximum blogs to returnpublic java.util.List<AbstractPage> getPossibleRedirectsNotInSpace(Space space, java.lang.String pageTitle, int maxResultCount)
PageManager
getPossibleRedirectsNotInSpace
in interface PageManager
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 returnpublic java.util.List getPossibleRedirects(java.lang.String pageTitle)
getPossibleRedirects
in interface PageManager
public java.util.List getRecentlyAddedBlogPosts(int maxPosts, java.util.Date timeSince, java.lang.String spaceKey)
getRecentlyAddedBlogPosts
in interface PageManager
public void setBlogPostDao(BlogPostDao blogPostDao)
public Page getPage(long id)
PageManager
getPage
in interface PageManager
id
- the database content ID for the page to return
public AbstractPage getAbstractPage(long id)
PageManager
getAbstractPage
in interface PageManager
id
- the database content ID for the page to return
public ContentEntityObject getById(long id)
getById
in interface ContentEntityManager
getById
in class DefaultContentEntityManager
public BlogPost getBlogPost(long id)
PageManager
getBlogPost
in interface PageManager
id
- the database content ID for the blog post to return
public Page getPage(java.lang.String spaceKey, java.lang.String pageTitle)
PageManager
getPage
in interface PageManager
public Page getPageWithComments(java.lang.String spaceKey, java.lang.String pageTitle)
PageManager
getPageWithComments
in interface PageManager
public int getCommentCountOnPage(long pageId)
PageManager
getCommentCountOnPage
in interface PageManager
pageId
- the id to check for comments on
@Deprecated public Page getPage(java.lang.String spaceKey, java.lang.String pageTitle, boolean eagerLoadComments)
PageManager
getPage
in interface PageManager
public java.util.List getPageInTrash(java.lang.String spaceKey, java.lang.String title)
getPageInTrash
in interface PageManager
public boolean spaceHasBlogPosts(java.lang.String spaceKey)
spaceHasBlogPosts
in interface PageManager
public java.util.List getDescendents(Page page)
getDescendents
in interface PageManager
public void updatePageInAncestorCollections(Page page, @Nullable Page newParent)
PageManager
updatePageInAncestorCollections
in interface PageManager
page
- the page being updated with new ancestorsnewParent
- the new parent page of the page being updatedpublic void removePageFromAncestorCollections(Page page)
PageManager
removePageFromAncestorCollections
in interface PageManager
public void removeAllPages(Space space)
PageManager
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.
removeAllPages
in interface PageManager
space
- the space to remove pages from.public void removeAllPages(Space space, com.atlassian.core.util.ProgressMeter progress)
removeAllPages
in interface PageManager
space
- the space to remove all pages for.progress
- progress meter to report progress on, can not be null.public void removeAllBlogPosts(Space space)
removeAllBlogPosts
in interface PageManager
public java.util.Collection getDescendentIds(Page page)
getDescendentIds
in interface PageManager
public java.util.List<Page> getTopLevelPages(Space space)
PageManager
getTopLevelPages
in interface PageManager
public java.util.List<Page> getUnsortedTopLevelPages(Space space)
public ListBuilder<Page> getTopLevelPagesBuilder(Space space)
getTopLevelPagesBuilder
in interface PageManager
space
- the space in which to look for pages
public BlogPost findPreviousBlogPost(java.lang.String key, java.util.Date time)
findPreviousBlogPost
in interface PageManager
public BlogPost findNextBlogPost(java.lang.String key, java.util.Date time)
findNextBlogPost
in interface PageManager
public void trashPage(AbstractPage page)
trashPage
in interface PageManager
public void restorePage(AbstractPage page)
PageManager
restorePage
in interface PageManager
page
- a trashed pagepublic void movePageToTopLevel(Page page, Space space)
PageManager
targetSpace
. If the top-level pages are manually ordered, the page
will be added to the end of the child pages.
movePageToTopLevel
in interface PageManager
page
- the page to movespace
- the space to move the page topublic void movePageAfter(Page page, Page refPage)
PageManager
movePageAfter
in interface PageManager
page
- the page to moverefPage
- the page which the first page will be placed afterpublic void movePageBefore(Page page, Page refPage)
PageManager
movePageBefore
in interface PageManager
page
- the page to moverefPage
- the page which the first page will be placed beforepublic void movePageAsChild(Page page, Page newParent)
movePageAsChild
in interface PageManager
page
- the page to movenewParent
- the page which the first page will be made a child ofpublic void setChildPageOrder(Page parentPage, java.util.List<java.lang.Long> childIds)
PageManager
setChildPageOrder
in interface PageManager
parentPage
- the page for which children should be ordered.childIds
- children page IDs in the new orderpublic void revertChildPageOrder(Page parentPage)
PageManager
revertChildPageOrder
in interface PageManager
parentPage
- the page for which children should be unordered.public AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
PageManager
getPageByVersion
in interface PageManager
mostRecentPage
- - must specify the most recent recent version of the page (page must be associated with a space)version
- - historical version to retrieve
public BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String postTitle, java.util.Calendar day)
PageManager
getBlogPost
in interface PageManager
public BlogPost getBlogPost(java.lang.String spaceKey, java.lang.String postTitle, java.util.Calendar day, boolean eagerLoadComments)
PageManager
getBlogPost
in interface PageManager
public BlogPost getNewestBlogPost(java.lang.String spaceKey)
PageManager
getNewestBlogPost
in interface PageManager
spaceKey
- the key of the space to retrieve the most recently created blog post for.
public java.util.List getRecentlyAddedBlogPosts(int maxCount, java.lang.String spaceKey)
PageManager
SearchManager
getRecentlyAddedBlogPosts
in interface PageManager
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
public java.util.List getRecentlyAddedPages(int maxCount, java.lang.String spaceKey)
PageManager
SearchManager
getRecentlyAddedPages
in interface PageManager
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
public java.util.List getRecentlyUpdatedPages(int maxCount, java.lang.String spaceKey)
PageManager
SearchManager
getRecentlyUpdatedPages
in interface PageManager
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
public java.util.List getOrphanedPages(java.lang.String spaceKey)
PageManager
getOrphanedPages
in interface PageManager
spaceKey
- the key of the space to look for orphans in, or null to search all spaces
public java.util.List getUndefinedPages(java.lang.String spaceKey)
PageManager
getUndefinedPages
in interface PageManager
spaceKey
- the key of the space to look for undefined pages in, or null to search all spaces
public java.util.List getPermissionPages(Space space)
PageManager
getPermissionPages
in interface PageManager
space
- the space to search
public void saveContentEntity(ContentEntityObject obj, SaveContext saveContext)
saveContentEntity
in interface ContentEntityManager
saveContentEntity
in class DefaultContentEntityManager
obj
- - the ContentEntityObject
to savesaveContext
- - a SaveContext
object for the manager.
DuplicateDataRuntimeException
- if the supplied page has a duplicate title.public void saveContentEntity(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
ContentEntityManager
saveContentEntity
in interface ContentEntityManager
saveContentEntity
in class DefaultContentEntityManager
saveContext
- - a SaveContext
holding additional parameters for the manager to use when saving.
DuplicateDataRuntimeException
- if the supplied page has a duplicate title.protected void publishCreateEvent(ContentEntityObject obj)
DefaultContentEntityManager
*CreateEvents
s.
Specific content entity object manager that need to publish those events should override this method.
publishCreateEvent
in class DefaultContentEntityManager
obj
- the created content entity objectprotected void publishCreateEvent(ContentEntityObject obj, SaveContext saveContext)
publishCreateEvent
in class DefaultContentEntityManager
protected void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
DefaultContentEntityManager
*UpdateEvent
s.
Specific content entity object manager that need to publish those events should override this method.
publishUpdateEvent
in class DefaultContentEntityManager
obj
- the updated content entity objectorigObj
- the old version of the content entity object, for history purposesaveContext
- the associated SaveContext
protected void publishRemoveEvent(ContentEntityObject obj)
DefaultContentEntityManager
*RemoveEvent
s.
Specific content entity object manager that need to publish those events should override this method.
publishRemoveEvent
in class DefaultContentEntityManager
obj
- the removed content entity objectpublic int getAuthoredPagesCountByUser(java.lang.String username)
PageManager
getAuthoredPagesCountByUser
in interface PageManager
username
- the username of the user to search for
public boolean isPageRecentlyUpdatedForUser(Page page, com.atlassian.user.User user)
PageManager
isPageRecentlyUpdatedForUser
in interface PageManager
page
- the page in questionuser
- the user or null if it is the anonymous user
protected BodyContent getBodyContentForRevert(ContentEntityObject historicalVersion)
getBodyContentForRevert
in class DefaultContentEntityManager
public java.util.List getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
PageManager
getPagesCreatedOrUpdatedSinceDate
in interface PageManager
previousLoginDate
- the date the pages must have been created or edited after
public java.util.List getBlogPosts(java.lang.String spaceKey, java.util.Calendar postingDate, int period)
getBlogPosts
in interface PageManager
public java.util.Set<java.util.Date> getYearsWithBlogPosts(java.lang.String spaceKey)
PageManager
getYearsWithBlogPosts
in interface PageManager
spaceKey
- the key of the space to look for blog posts in.
public java.util.Set<java.util.Date> getMonthsWithBlogPosts(java.lang.String spaceKey, java.util.Calendar year)
PageManager
getMonthsWithBlogPosts
in interface PageManager
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.
public java.util.List<Page> getPages(Space space, boolean currentOnly)
getPages
in interface PageManager
public java.util.Collection<java.lang.Long> getPageIds(Space space)
PageManager
getPageIds
in interface PageManager
space
- space to retrieve page ids from, can not be null.
public java.util.List getPagesStartingWith(Space space, java.lang.String s)
getPagesStartingWith
in interface PageManager
public BlogPost findPreviousBlogPost(BlogPost post)
findPreviousBlogPost
in interface PageManager
public BlogPost findNextBlogPost(BlogPost post)
findNextBlogPost
in interface PageManager
public NotificationManager getNotificationManager()
getNotificationManager
in interface PageManager
public void setNotificationManager(NotificationManager notificationManager)
setNotificationManager
in interface PageManager
public AttachmentManager getAttachmentManager()
getAttachmentManager
in interface PageManager
public void setIndexer(ConfluenceIndexer indexer)
setIndexer
in class DefaultContentEntityManager
public void setContentPropertyManager(ContentPropertyManager contentPropertyManager)
public void setAbstractPageDao(AbstractPageDao abstractPageDao)
public void setSpaceDao(SpaceDao spaceDao)
public PermissionManager getPermissionManager()
public void setChangeIndexer(ChangeIndexer changeIndexer)
public void setLoginManager(LoginManager loginManager)
public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
public void setRevertedContentMigratorRef(com.atlassian.util.concurrent.Supplier<ExceptionTolerantMigrator> migratorRef)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |