com.atlassian.confluence.pages
Class DefaultPageManager

java.lang.Object
  extended bycom.atlassian.confluence.core.DefaultContentEntityManager
      extended bycom.atlassian.confluence.pages.DefaultPageManager
All Implemented Interfaces:
ContentEntityManager, PageManager

public class DefaultPageManager
extends DefaultContentEntityManager
implements PageManager


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
contentEntityObjectDao, eventManager, indexer, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultPageManager()
           
 
Method Summary
 BlogPost findNextBlogPost(BlogPost post)
           
 BlogPost findNextBlogPost(String key, Date time)
           
 BlogPost findPreviousBlogPost(BlogPost post)
           
 BlogPost findPreviousBlogPost(String key, Date time)
           
 AbstractPage getAbstractPage(long id)
          Retrieve the AbstractPage subclass with the given content ID.
 AttachmentManager getAttachmentManager()
           
 int getAuthoredPagesCountByUser(String username)
          Get the number of pages that have been created by a particular user
 BlogPost getBlogPost(long id)
          Retrieve the blog post with the given content ID.
 BlogPost getBlogPost(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.
 List getBlogPosts(Space space, boolean currentOnly)
           
 List getBlogPosts(String spaceKey, Calendar postingDate, int period)
           
 Collection getDescendentIds(Page page)
           
 List getDescendents(Page page)
           
 NotificationManager getNotificationManager()
           
 List getOrphanedPages(String spaceKey)
          Retrieve a list of pages in a given space that are not linked to.
 Page getPage(long id)
          Retrieve the page with the given content ID.
 Page getPage(String spaceKey, String pageTitle)
          Retrieve the latest version of a page by its space key and title.
 AbstractPage getPageByVersion(AbstractPage mostRecentPage, int version)
          returns the historical version of a page
 List getPageInTrash(String spaceKey, String title)
           
 List getPages(Space space, boolean currentOnly)
           
 List getPagesCreatedOrUpdatedSinceDate(Date previousLoginDate)
          Get the list of all pages created or updated since a particular date.
 List getPagesStartingWith(Space space, String s)
           
 List getPermissionPages(Space space)
          Retrieve all pages within a particular space that have page level permissions applied to them.
 List getPossibleRedirects(String pageTitle)
           
 List getPossibleRedirectsForSpace(Space space, String pageTitle)
           
 List getRecentlyAddedBlogPosts(int maxPosts, Date timeSince, String spaceKey)
           
 List getRecentlyAddedBlogPosts(int maxCount, String spaceKey)
          Retrieve the most recently created blog posts in a given space.
 List getRecentlyAddedPages(int maxCount, String spaceKey)
          Retrieve the most recently created pages in a given space.
 List getRecentlyUpdatedPages(int maxCount, String spaceKey)
          Retrieve the most recently modified pages in a given space.
 List getTopLevelPages(Space space)
           
 List getUndefinedPages(String spaceKey)
          Retrieve a list of link destinations in a given space that do not have pages.
protected  void publishCreateEvent(ContentEntityObject obj)
          This method publishes *CreateEventss.
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 the pages in a space (including all dependencies like attachments and notifications)
 void removePageFromAncestorCollections(Page page)
          Removes the page from the ancestor collection of every child page.
 void renamePage(AbstractPage page, String newPageTitle)
          Call this function if you want to rename the page only.
 void restorePage(AbstractPage page)
           
 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 setAttachmentManager(AttachmentManager attachmentManager)
           
 void setBlogPostDao(BlogPostDao blogPostDao)
           
 void setCacheManager(CacheManager cacheManager)
           
 void setContentPropertyManager(ContentPropertyManager contentPropertyManager)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setNotificationManager(NotificationManager notificationManager)
           
 boolean spaceHasBlogPosts(String spaceKey)
           
 void trashPage(AbstractPage page)
           
 void updatePageInAncestorCollections(Page pageBeingUpdated, Page newParentPage)
           
 
Methods inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
getAllCurrentEntities, getById, getEntitiesModifiedSince, getEventManager, getLockedBySpace, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesByType, getRecentlyModifiedEntitiesForUser, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, saveContentEntity, setContentEntityObjectDao, setEventManager, setLabelManager, setLinkManager, updateContentLinkingTo, updateOutgoingLinksInContent, 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.core.ContentEntityManager
getAllCurrentEntities, getById, getEntitiesModifiedSince, getLockedBySpace, getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesByType, getRecentlyModifiedEntitiesForUser, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, saveContentEntity, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Constructor Detail

DefaultPageManager

public DefaultPageManager()
Method Detail

renamePage

public void renamePage(AbstractPage page,
                       String newPageTitle)
Call this function if you want to rename the page only. If you want to update not only the title, but the content and other attributes, modify the entity and call save instead.

Specified by:
renamePage in interface PageManager
Parameters:
page -
newPageTitle -

getBlogPosts

public List getBlogPosts(Space space,
                         boolean currentOnly)
Specified by:
getBlogPosts in interface PageManager

getPossibleRedirectsForSpace

public List getPossibleRedirectsForSpace(Space space,
                                         String pageTitle)
Specified by:
getPossibleRedirectsForSpace in interface PageManager

getPossibleRedirects

public List getPossibleRedirects(String pageTitle)
Specified by:
getPossibleRedirects in interface PageManager

getRecentlyAddedBlogPosts

public List getRecentlyAddedBlogPosts(int maxPosts,
                                      Date timeSince,
                                      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)

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.

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

getPageInTrash

public List getPageInTrash(String spaceKey,
                           String title)
Specified by:
getPageInTrash in interface PageManager

spaceHasBlogPosts

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

getDescendents

public List getDescendents(Page page)
Specified by:
getDescendents in interface PageManager

updatePageInAncestorCollections

public void updatePageInAncestorCollections(Page pageBeingUpdated,
                                            Page newParentPage)
Specified by:
updatePageInAncestorCollections in interface PageManager

removePageFromAncestorCollections

public void removePageFromAncestorCollections(Page page)
Removes the page from the ancestor collection of every child page.

Specified by:
removePageFromAncestorCollections in interface PageManager
Parameters:
page -

removeAllPages

public void removeAllPages(Space space)
removes all the pages in a space (including all dependencies like attachments and notifications)

Specified by:
removeAllPages in interface PageManager
Parameters:
space -

removeAllBlogPosts

public void removeAllBlogPosts(Space space)
Specified by:
removeAllBlogPosts in interface PageManager

getDescendentIds

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

getTopLevelPages

public List getTopLevelPages(Space space)
Specified by:
getTopLevelPages in interface PageManager

findPreviousBlogPost

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

findNextBlogPost

public BlogPost findNextBlogPost(String key,
                                 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)
Specified by:
restorePage in interface PageManager

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(String spaceKey,
                            String postTitle,
                            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.

getRecentlyAddedBlogPosts

public List getRecentlyAddedBlogPosts(int maxCount,
                                      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. The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

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 List getRecentlyAddedPages(int maxCount,
                                  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. The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

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 List getRecentlyUpdatedPages(int maxCount,
                                    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. The SmartListManager provides a more flexible (and more efficient) way to perform this query, including accounting for user permissions.

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 List getOrphanedPages(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 List getUndefinedPages(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 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,
                              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

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. Default implmentation doesn't do anything

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

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. Default implmentation doesn't do anything

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. Default implmentation doesn't do anything

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

getAuthoredPagesCountByUser

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

getPagesCreatedOrUpdatedSinceDate

public List getPagesCreatedOrUpdatedSinceDate(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 List getBlogPosts(String spaceKey,
                         Calendar postingDate,
                         int period)
Specified by:
getBlogPosts in interface PageManager

getPages

public List getPages(Space space,
                     boolean currentOnly)
Specified by:
getPages in interface PageManager

getPagesStartingWith

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

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)
Specified by:
setAttachmentManager in interface PageManager

setIndexer

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

setCacheManager

public void setCacheManager(CacheManager cacheManager)

setContentPropertyManager

public void setContentPropertyManager(ContentPropertyManager contentPropertyManager)


Confluence is developed by Atlassian.