com.atlassian.confluence.pages.persistence.dao.hibernate
Class CachingPageDao

java.lang.Object
  extended by com.atlassian.confluence.pages.persistence.dao.hibernate.CachingPageDao
All Implemented Interfaces:
ObjectDao, ContentEntityObjectDao, VersionedObjectDao, PageDao

public class CachingPageDao
extends java.lang.Object
implements PageDao

This maintains a cache of (space key, page title) -> (page id) mappings. All page ids cached refer to current pages. When a page is marked for deletion, it is removed from this cache.


Constructor Summary
CachingPageDao(PageDao delegateDao, PageIdCache pageIdCache)
           
 
Method Summary
 int countContentBySpaceIdAndStatus(long spaceId, java.lang.String status)
          Retrieve the count of content for a given space with a particular status.
 java.util.List findAll()
          Find all objects currently persisted of a particular type.
 java.util.List findAllSorted(java.lang.String s)
          Find all objects currently persisted of a particular type and sort results by named property.
 java.util.List findAllSorted(java.lang.String s, boolean cached, int firstRow, int maxRows)
          Find all objects currently persisted of a particular type and sort results by named property.
 java.util.List<AbstractPage> findBlogsWithHistoricalTitleInPermittedSpace(java.lang.String blogTitle, Space space, int maxResultCount)
          Searches for blogs in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 java.util.List<ContentEntityObject> findContentBySpaceIdAndStatus(long spaceId, java.lang.String status, int offset, int count)
          Retrieve content for a given space with a particular status.
 PageResponse<ContentEntityObject> findContentBySpaceIdAndStatus(long spaceId, java.lang.String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<Page> predicate)
          Retrieve content for a given space with a particular status.
 java.util.List findHistoricalVersionsAfterVersion(long originalContentId, int version)
           
 long findLatestVersionsCount()
          Returns the number of results for the latest versions of the current persistent class.
 java.util.Iterator findLatestVersionsIterator()
          Returns an iterator for the latest versions of the current persistent class.
 java.util.List<Page> findPagesWithHistoricalTitle(java.lang.String pageTitle)
           
 java.util.List<AbstractPage> findPagesWithHistoricalTitleInAllPermittedSpacesExcept(java.lang.String pageTitle, Space space, int maxResultCount)
          Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 java.util.List<AbstractPage> findPagesWithHistoricalTitleInPermittedSpace(java.lang.String pageTitle, Space space, int maxResultCount)
          Searches for pages in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 java.util.List findPreviousVersions(long originalContentId)
           
 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, limited to the pagination request
 java.util.Iterator getAllCurrentEntities()
           
 int getAuthoredPagesCountByUser(java.lang.String username)
           
 PageResponse<BlogPost> getBlogPosts(Space space, LimitedRequest pageRequest, com.google.common.base.Predicate<? super BlogPost> predicate)
          Retrieve a page of the current blog posts in this space
 ContentEntityObject getById(long id)
           
 PageResponse<Page> getChildren(Page page, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate, Depth depth)
           
 int getCommentCountOnPage(long id)
          Count the number of comments on the passed in page.
 java.util.List getContentAuthoredByUser(java.lang.String username)
           
 java.util.List<java.lang.Long> getDescendentIds(Page page)
           
 java.util.List<Page> getDescendents(Page page)
           
 ContentEntityObject getFirstVersionAfter(long originalVersionContentId, int version)
           
 ContentEntityObject getFirstVersionBefore(long originalVersionContentId, int version)
           
 java.util.List<ContentEntityObject> getLastEditedVersionsOf(ContentEntityObject content)
          Retrieves all the last edited versions for each user who has contributed to the specified piece of content.
 java.util.List getLockedContentBySpace(java.lang.String spaceKey)
          Deprecated. since 5.1. There is no replacement as this functionality was superseded by multiple page permissions (CONF-3701)
 java.lang.Integer getMaxSiblingPosition(Page page)
          Gets the highest position value of all the page's siblings.
 java.lang.String getObjectType(long id)
           
 java.util.Date getOldestPageCreationDate()
          Gets the creation date of the oldest page.
 java.util.List<Page> getOrphanedPages(java.lang.String spaceKey)
           
 Page getPage(Space space, java.lang.String pageTitle)
          Get the page by space and title.
 Page getPageById(long id)
          Get the page with the given id.
 Page getPageByIdWithComments(long id)
          Get the page with the given id, and perform an eager load of the comments and their children.
 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<Page> getPageInTrash(java.lang.String spaceKey, java.lang.String title)
           
 PageResponse<Page> getPages(LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
          Retrieve a page of all the current content
 java.util.List<Page> getPages(Space space, boolean currentOnly)
           
 PageResponse<Page> getPages(Space space, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
          Retrieve a page of the current content in this space
 java.util.List<Page> getPagesByIds(java.lang.Iterable<java.lang.Long> ids)
          Get the pages with the given ids.
 java.util.List<Page> getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
           
 java.util.List<Page> getPagesStartingWith(Space space, java.lang.String s)
           
 Page getPageWithComments(Space space, java.lang.String pageTitle)
          Get the page by space and title, and perform an eager load of the comments and their children.
 java.util.List<Page> getPermissionPages(Space space)
           
 java.lang.Class getPersistentClass()
           
 java.util.Iterator getRecentlyAddedEntities(java.lang.String spaceKey, int maxResults)
           
 java.util.List<Page> getRecentlyAddedPages(int maxCount, java.lang.String spaceKey)
           
 java.util.List<Page> getRecentlyAuthoredPagesByUser(java.lang.String username, int maxCount)
           
 java.util.Iterator getRecentlyModifiedEntities(int maxResults)
           
 java.util.Iterator getRecentlyModifiedEntities(java.lang.String spaceKey, int maxResults)
           
 java.util.Iterator getRecentlyModifiedEntitiesForUser(java.lang.String username)
           
 java.util.List getRecentlyModifiedForChangeDigest(java.util.Date fromDate)
          Retrieves a list of ContentEntityObjects that have been newly added or modified since the date specified.
 java.util.List<Page> getRecentlyUpdatedPages(int maxCount, java.lang.String spaceKey)
           
 java.util.List<Page> getTopLevelPages(Space space)
           
 PageResponse<Page> getTopLevelPages(Space space, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
           
 java.util.List getTrashedContent(java.lang.String spaceKey)
           
 java.util.List<Page> getUndefinedPages(java.lang.String spaceKey)
           
 ContentEntityObject getVersion(long originalVersionContentId, int version)
           
 java.util.List<VersionHistorySummary> getVersionHistorySummary(long originalContentId)
           
 void refresh(com.atlassian.core.bean.EntityObject objectToRefresh)
          Refreshes the object again with the fresh data from db.
 void remove(com.atlassian.core.bean.EntityObject object)
          Remove object from persistence.
 void replicate(java.lang.Object objectToReplicate)
          Replicate the object.
 void save(com.atlassian.core.bean.EntityObject objectToSave)
           
 void save(com.atlassian.core.bean.EntityObject objectToSave, com.atlassian.core.bean.EntityObject originalObject)
           
 void saveRaw(com.atlassian.core.bean.EntityObject objectToSave)
          saves the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingPageDao

public CachingPageDao(PageDao delegateDao,
                      PageIdCache pageIdCache)
Method Detail

getPage

public Page getPage(Space space,
                    java.lang.String pageTitle)
Description copied from interface: PageDao
Get the page by space and title.

Specified by:
getPage in interface PageDao
Parameters:
space - The space the page belongs to
pageTitle - The title of the page
Returns:
the page with the given title in the given space, or null if no such page exists

getPageWithComments

public Page getPageWithComments(Space space,
                                java.lang.String pageTitle)
Description copied from interface: PageDao
Get the page by space and title, and perform an eager load of the comments and their children. This can be used as a performance optimisation when it is known that all comments will be displayed.

Specified by:
getPageWithComments in interface PageDao
Parameters:
space - The space the page belongs to
pageTitle - The title of the page
Returns:
the page with the given title in the given space, or null if no such page exists

remove

public void remove(com.atlassian.core.bean.EntityObject object)
Description copied from interface: ObjectDao
Remove object from persistence.

Specified by:
remove in interface ObjectDao

save

public void save(com.atlassian.core.bean.EntityObject objectToSave,
                 com.atlassian.core.bean.EntityObject originalObject)
Specified by:
save in interface VersionedObjectDao

save

public void save(com.atlassian.core.bean.EntityObject objectToSave)
Specified by:
save in interface ObjectDao

saveRaw

public void saveRaw(com.atlassian.core.bean.EntityObject objectToSave)
Description copied from interface: ObjectDao
saves the object. if the object is new, this won't set the creation date on the object. if it already exists, then it won't set the date that it was updated.

Specified by:
saveRaw in interface ObjectDao

findAll

public java.util.List findAll()
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type.

Specified by:
findAll in interface ObjectDao

findAllSorted

public java.util.List findAllSorted(java.lang.String s)
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type and sort results by named property.

Specified by:
findAllSorted in interface ObjectDao
Parameters:
s - the name of the property to be sorted on. This should be null if no sorting is required.

findAllSorted

public java.util.List findAllSorted(java.lang.String s,
                                    boolean cached,
                                    int firstRow,
                                    int maxRows)
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type and sort results by named property. This version of the method allows more control over the query.

Specified by:
findAllSorted in interface ObjectDao
Parameters:
s - the name of the property to be sorted on. This should be null if no sorting is required.
cached - control whether the results should be cached
firstRow - the index of the first result to be returned
maxRows - the maximum number of results required. Use -1 to specify no limit.

findLatestVersionsCount

public long findLatestVersionsCount()
Description copied from interface: VersionedObjectDao
Returns the number of results for the latest versions of the current persistent class.

Specified by:
findLatestVersionsCount in interface VersionedObjectDao
Returns:
a long representing the number of results

findLatestVersionsIterator

public java.util.Iterator findLatestVersionsIterator()
Description copied from interface: VersionedObjectDao
Returns an iterator for the latest versions of the current persistent class.

Specified by:
findLatestVersionsIterator in interface VersionedObjectDao
Returns:
Iterator

findPagesWithHistoricalTitle

public java.util.List<Page> findPagesWithHistoricalTitle(java.lang.String pageTitle)
Specified by:
findPagesWithHistoricalTitle in interface PageDao

findPreviousVersions

public java.util.List findPreviousVersions(long originalContentId)
Specified by:
findPreviousVersions in interface ContentEntityObjectDao

findPagesWithHistoricalTitleInPermittedSpace

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

Only pages in spaces the remote user is able to view will be returned.

Specified by:
findPagesWithHistoricalTitleInPermittedSpace in interface PageDao
Parameters:
pageTitle - title of a page in a previous version.
space - Space to search. Must not be null.
maxResultCount - maximum pages to return

findBlogsWithHistoricalTitleInPermittedSpace

public java.util.List<AbstractPage> findBlogsWithHistoricalTitleInPermittedSpace(java.lang.String blogTitle,
                                                                                 Space space,
                                                                                 int maxResultCount)
Description copied from interface: PageDao
Searches for blogs in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.

Only blogs in spaces the remote user is able to view will be returned.

Specified by:
findBlogsWithHistoricalTitleInPermittedSpace in interface PageDao
Parameters:
blogTitle - title of a page in a previous version.
space - Space to search. Must not be null.
maxResultCount - maximum pages to return
Returns:
a list of pages that have the given title in a previous version

findPagesWithHistoricalTitleInAllPermittedSpacesExcept

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

Only pages in spaces the remote user is able to view will be returned.

Specified by:
findPagesWithHistoricalTitleInAllPermittedSpacesExcept in interface PageDao
Parameters:
pageTitle - title of a page in a previous version.
space - Space to exclude from search. If null, all spaces are searched.
maxResultCount - maximum pages to return

getAllCurrentEntities

public java.util.Iterator getAllCurrentEntities()
Specified by:
getAllCurrentEntities in interface ContentEntityObjectDao

getAuthoredPagesCountByUser

public int getAuthoredPagesCountByUser(java.lang.String username)
Specified by:
getAuthoredPagesCountByUser in interface PageDao

getById

public ContentEntityObject getById(long id)
Specified by:
getById in interface ContentEntityObjectDao

getContentAuthoredByUser

public java.util.List getContentAuthoredByUser(java.lang.String username)
Specified by:
getContentAuthoredByUser in interface ContentEntityObjectDao

getDescendentIds

public java.util.List<java.lang.Long> getDescendentIds(Page page)
Specified by:
getDescendentIds in interface PageDao

getDescendents

public java.util.List<Page> getDescendents(Page page)
Specified by:
getDescendents in interface PageDao

getFirstVersionAfter

public ContentEntityObject getFirstVersionAfter(long originalVersionContentId,
                                                int version)
Specified by:
getFirstVersionAfter in interface ContentEntityObjectDao

getFirstVersionBefore

public ContentEntityObject getFirstVersionBefore(long originalVersionContentId,
                                                 int version)
Specified by:
getFirstVersionBefore in interface ContentEntityObjectDao

getLockedContentBySpace

@Deprecated
public java.util.List getLockedContentBySpace(java.lang.String spaceKey)
Deprecated. since 5.1. There is no replacement as this functionality was superseded by multiple page permissions (CONF-3701)

Specified by:
getLockedContentBySpace in interface ContentEntityObjectDao

getObjectType

public java.lang.String getObjectType(long id)
Specified by:
getObjectType in interface ContentEntityObjectDao

getOrphanedPages

public java.util.List<Page> getOrphanedPages(java.lang.String spaceKey)
Specified by:
getOrphanedPages in interface PageDao

getPageById

public Page getPageById(long id)
Description copied from interface: PageDao
Get the page with the given id.

Specified by:
getPageById in interface PageDao
Parameters:
id - of the page to load
Returns:
the page with the given id, or null if no such page exists

getPagesByIds

public java.util.List<Page> getPagesByIds(java.lang.Iterable<java.lang.Long> ids)
Get the pages with the given ids.

Specified by:
getPagesByIds in interface PageDao

getPageByIdWithComments

public Page getPageByIdWithComments(long id)
Description copied from interface: PageDao
Get the page with the given id, and perform an eager load of the comments and their children. This can be used as a performance optimisation when it is known that all comments will be displayed.

Specified by:
getPageByIdWithComments in interface PageDao
Parameters:
id - of the page to load
Returns:
the page with the given id, or null if no such page exists

getCommentCountOnPage

public int getCommentCountOnPage(long id)
Description copied from interface: PageDao
Count the number of comments on the passed in page.

Specified by:
getCommentCountOnPage in interface PageDao

getPageInTrash

public java.util.List<Page> getPageInTrash(java.lang.String spaceKey,
                                           java.lang.String title)
Specified by:
getPageInTrash in interface PageDao

getPages

public java.util.List<Page> getPages(Space space,
                                     boolean currentOnly)
Specified by:
getPages in interface PageDao

getPages

public PageResponse<Page> getPages(Space space,
                                   LimitedRequest limitedRequest,
                                   com.google.common.base.Predicate<? super Page> predicate)
Description copied from interface: PageDao
Retrieve a page of the current content in this space

Specified by:
getPages in interface PageDao
Parameters:
space - - the space to retreive the content for
limitedRequest - - the start and offset of the pages to retrieve
predicate - - the predicate to apply
Returns:

getPages

public PageResponse<Page> getPages(LimitedRequest limitedRequest,
                                   com.google.common.base.Predicate<? super Page> predicate)
Description copied from interface: PageDao
Retrieve a page of all the current content

Specified by:
getPages in interface PageDao
Parameters:
limitedRequest - - the start and offset of the pages to retrieve
predicate - - the predicate to apply
Returns:

getBlogPosts

public PageResponse<BlogPost> getBlogPosts(Space space,
                                           LimitedRequest pageRequest,
                                           @Nullable
                                           com.google.common.base.Predicate<? super BlogPost> predicate)
Description copied from interface: PageDao
Retrieve a page of the current blog posts in this space

Specified by:
getBlogPosts in interface PageDao
predicate - - the predicate to filter the returned results by, may be null.
Returns:

getPagesCreatedOrUpdatedSinceDate

public java.util.List<Page> getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
Specified by:
getPagesCreatedOrUpdatedSinceDate in interface PageDao

getPagesStartingWith

public java.util.List<Page> getPagesStartingWith(Space space,
                                                 java.lang.String s)
Specified by:
getPagesStartingWith in interface PageDao

getPermissionPages

public java.util.List<Page> getPermissionPages(Space space)
Specified by:
getPermissionPages in interface PageDao

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao

getRecentlyAddedEntities

public java.util.Iterator getRecentlyAddedEntities(java.lang.String spaceKey,
                                                   int maxResults)
Specified by:
getRecentlyAddedEntities in interface ContentEntityObjectDao

getRecentlyAddedPages

public java.util.List<Page> getRecentlyAddedPages(int maxCount,
                                                  java.lang.String spaceKey)
Specified by:
getRecentlyAddedPages in interface PageDao

getRecentlyAuthoredPagesByUser

public java.util.List<Page> getRecentlyAuthoredPagesByUser(java.lang.String username,
                                                           int maxCount)
Specified by:
getRecentlyAuthoredPagesByUser in interface PageDao

getRecentlyModifiedEntities

public java.util.Iterator getRecentlyModifiedEntities(int maxResults)
Specified by:
getRecentlyModifiedEntities in interface ContentEntityObjectDao

getRecentlyModifiedEntities

public java.util.Iterator getRecentlyModifiedEntities(java.lang.String spaceKey,
                                                      int maxResults)
Specified by:
getRecentlyModifiedEntities in interface ContentEntityObjectDao

getRecentlyModifiedEntitiesForUser

public java.util.Iterator getRecentlyModifiedEntitiesForUser(java.lang.String username)
Specified by:
getRecentlyModifiedEntitiesForUser in interface ContentEntityObjectDao

getRecentlyModifiedForChangeDigest

public java.util.List getRecentlyModifiedForChangeDigest(java.util.Date fromDate)
Description copied from interface: ContentEntityObjectDao
Retrieves a list of ContentEntityObjects that have been newly added or modified since the date specified. This list excludes drafts, space descriptions and mail.

Specified by:
getRecentlyModifiedForChangeDigest in interface ContentEntityObjectDao
Parameters:
fromDate - content modified after this date will be returned
Returns:
a list of ContentEntityObjects that have been newly added or modified since the date specified

getRecentlyUpdatedPages

public java.util.List<Page> getRecentlyUpdatedPages(int maxCount,
                                                    java.lang.String spaceKey)
Specified by:
getRecentlyUpdatedPages in interface PageDao

getTopLevelPages

public java.util.List<Page> getTopLevelPages(Space space)
Specified by:
getTopLevelPages in interface PageDao

getTopLevelPages

public PageResponse<Page> getTopLevelPages(Space space,
                                           LimitedRequest limitedRequest,
                                           com.google.common.base.Predicate<? super Page> predicate)
Specified by:
getTopLevelPages in interface PageDao

getChildren

public PageResponse<Page> getChildren(Page page,
                                      LimitedRequest limitedRequest,
                                      com.google.common.base.Predicate<? super Page> predicate,
                                      Depth depth)
Specified by:
getChildren in interface PageDao

getMaxSiblingPosition

public java.lang.Integer getMaxSiblingPosition(Page page)
Description copied from interface: PageDao
Gets the highest position value of all the page's siblings. This is useful when we need to find what position to assign to a new page that should go to the bottom.

Specified by:
getMaxSiblingPosition in interface PageDao
Parameters:
page - The page whose siblings from which to get the max position
Returns:
The highest position value of all the page's siblings

getPageIds

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

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

getAbstractPagesByTitle

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

Specified by:
getAbstractPagesByTitle in interface PageDao
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: PageDao
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 PageDao
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

getOldestPageCreationDate

public java.util.Date getOldestPageCreationDate()
Description copied from interface: ContentEntityObjectDao
Gets the creation date of the oldest page.

Specified by:
getOldestPageCreationDate in interface ContentEntityObjectDao
Returns:
creation date of the oldest page in Confluence

getTrashedContent

public java.util.List getTrashedContent(java.lang.String spaceKey)
Specified by:
getTrashedContent in interface ContentEntityObjectDao

getUndefinedPages

public java.util.List<Page> getUndefinedPages(java.lang.String spaceKey)
Specified by:
getUndefinedPages in interface PageDao

getVersion

public ContentEntityObject getVersion(long originalVersionContentId,
                                      int version)
Specified by:
getVersion in interface ContentEntityObjectDao

getVersionHistorySummary

public java.util.List<VersionHistorySummary> getVersionHistorySummary(long originalContentId)
Specified by:
getVersionHistorySummary in interface ContentEntityObjectDao

refresh

public void refresh(com.atlassian.core.bean.EntityObject objectToRefresh)
Description copied from interface: ObjectDao
Refreshes the object again with the fresh data from db.

Specified by:
refresh in interface ObjectDao

replicate

public void replicate(java.lang.Object objectToReplicate)
Description copied from interface: ObjectDao
Replicate the object. Replication does not generate a new id if the object does not exist in database and it overwrites the database row if the object already exists in database.

Specified by:
replicate in interface ObjectDao

getLastEditedVersionsOf

public java.util.List<ContentEntityObject> getLastEditedVersionsOf(ContentEntityObject content)
Description copied from interface: ContentEntityObjectDao
Retrieves all the last edited versions for each user who has contributed to the specified piece of content. That is, if a user has contributed multiple edits, only the version that corresponds to their latest edit will be added to the list returned. Result will be sorted with the earliest version coming first.

Specified by:
getLastEditedVersionsOf in interface ContentEntityObjectDao
Parameters:
content - content (must be the latest version)
Returns:
the last edited versions for each user who has contributed to the specified piece of content.

findContentBySpaceIdAndStatus

public java.util.List<ContentEntityObject> findContentBySpaceIdAndStatus(long spaceId,
                                                                         java.lang.String status,
                                                                         int offset,
                                                                         int count)
Description copied from interface: ContentEntityObjectDao
Retrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.

Specified by:
findContentBySpaceIdAndStatus in interface ContentEntityObjectDao
Parameters:
spaceId - the id of the space
status - the status of the content being retrieved (e.g. ContentEntityObject.DELETED
offset - the offset of the first item to retrieve (0-based)
count - the maximum number of items to retrieve
Returns:
the list of content matching the query

findContentBySpaceIdAndStatus

public PageResponse<ContentEntityObject> findContentBySpaceIdAndStatus(long spaceId,
                                                                       java.lang.String status,
                                                                       LimitedRequest limitedRequest,
                                                                       com.google.common.base.Predicate<Page> predicate)
Description copied from interface: ContentEntityObjectDao
Retrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.

Specified by:
findContentBySpaceIdAndStatus in interface ContentEntityObjectDao
Parameters:
spaceId - the id of the space
status - the status of the content being retrieved (e.g. ContentEntityObject.DELETED
limitedRequest - - the start and offset of the pages to retrieve
predicate - - a predicate to filter the returned results by
Returns:
a PageResponse of ContentEntityObjects in the space with the given status

countContentBySpaceIdAndStatus

public int countContentBySpaceIdAndStatus(long spaceId,
                                          java.lang.String status)
Description copied from interface: ContentEntityObjectDao
Retrieve the count of content for a given space with a particular status.

Specified by:
countContentBySpaceIdAndStatus in interface ContentEntityObjectDao
Parameters:
spaceId - the id of the space
status - the status of the content being retrieved (e.g. ContentEntityObject.DELETED
Returns:
the number of content objects with that status in that space

findHistoricalVersionsAfterVersion

public java.util.List findHistoricalVersionsAfterVersion(long originalContentId,
                                                         int version)
Specified by:
findHistoricalVersionsAfterVersion in interface ContentEntityObjectDao


Copyright © 2003-2014 Atlassian. All Rights Reserved.