Class ContentEntityObjectHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<T>
com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao<T>
com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao<ContentEntityObject>
com.atlassian.confluence.internal.persistence.hibernate.ContentEntityObjectHibernateDao
- All Implemented Interfaces:
ContentEntityObjectDao,ContentEntityObjectDaoInternal,org.springframework.beans.factory.InitializingBean
public class ContentEntityObjectHibernateDao
extends VersionedHibernateObjectDao<ContentEntityObject>
implements ContentEntityObjectDaoInternal
- Since:
- 6.10.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability -
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
ConstructorsConstructorDescriptionContentEntityObjectHibernateDao(RetentionFeatureChecker retentionFeatureChecker) -
Method Summary
Modifier and TypeMethodDescriptionintcountContentBySpaceIdAndStatus(long spaceId, String status) Retrieve the count of content for a given space with a particular status.findAllDraftsFor(long contentId) Retrieves a list of drafts for the given content if any drafts exist.findAllLegacyDraftsFor(long contentId) Retrieves a list of Legacy drafts for the given content if any exist.@NonNull List<ContentEntityObject>findByClassIds(Set<Long> ids, LimitedRequest request) findContentBySpaceIdAndStatus(long spaceId, String status, int offset, int count) Retrieve content for a given space with a particular status.findContentBySpaceIdAndStatus(long spaceId, String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super SpaceContentEntityObject> predicate) Deprecated.since 7.0.1.findDraftFor(long contentId) Retrieves the draft for the given content if exists.Retrieves the drafts for the givenUser, which contains unpublished changesfindHistoricalVersionsAfterVersion(long originalContentId, int version) findPreviousVersions(long originalContentId) Retrieves the drafts for the givenUser.getAllModifiers(Collection<Long> contentIds) Get the Set of allConfluenceUserthat have modified (contributed) content.protected ContentEntityObjectgetByClassId(long id) Retrieve the object with a particular id from the database.getById(long id) Retrieve the object with a particular id from the database.getContributionStatusByUser(Collection<ContentId> contentIds, com.atlassian.sal.api.user.UserKey userKey) Identifies the most recent contributions made to a Collection of content by the given user.getFirstVersionAfter(long originalVersionContentId, int version) getFirstVersionBefore(long originalVersionContentId, int version) getLastEditedOldVersionsOf(Collection<ContentId> contentIds) Retrieves all old the last edited versions for each user who has contributed to the specified piece of content.Retrieves all the last edited versions for each user who has contributed to the specified piece of content.getObjectType(long id) getPageAndBlogPostsVersionsLastEditedByUser(com.atlassian.sal.api.user.UserKey userKey, LimitedRequest limitedRequest) Retrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification.getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts(com.atlassian.sal.api.user.UserKey userKey, LimitedRequest limitedRequest) Retrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification.protected <T extends ConfluenceEntityObject>
PageResponse<T>getPagesByCursor(Function<LimitedRequest, List<T>> searchPages, LimitedRequest originalRequest, Predicate<? super T> filter) getRecentlyAddedEntities(String spaceKey, int maxResults) getRecentlyModifiedEntities(int maxResults) getRecentlyModifiedEntities(String spaceKey, int maxResults) getRecentlyModifiedForChangeDigest(Date fromDate) Retrieves a list ofContentEntityObjects that have been newly added or modified since the date specified.getTrashedContent(String spaceKey) getTrashedContents(String spaceKey, int offset, int limit) getTrashedContents(String spaceKey, LimitedRequest pageRequest, Predicate<? super ContentEntityObject> filter) getTrashedEntities(long contentIdOffset, int limit) Retrieve a batch of trashed content entitiesgetVersion(long originalVersionContentId, int version) getVersionEditContributors(Iterable<ContentEntityObject> originalVersions) Get version edit contributors for a set of content identifiers.getVersionHistorySummary(long originalContentId) getVersionHistorySummary(long originalContentId, LimitedRequest request) Get version history with pagination.getVersionsLastEditedByUser(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Gets theContentEntityObjectobjects, either the current version or historical version relating to given contentIds of the current version that was the most recent version edited by the given user.getVersionsLastEditedByUserNew(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Deprecated.since 6.4.0protected voidvoidrefresh(ContentEntityObject contentEntityObject) voidremove(ContentEntityObject contentEntityObject) Remove an object from the databasevoidsaveRaw(ContentEntityObject contentEntityObject) Save the object without updateModificationData being called.voidsaveRawWithoutReindex(com.atlassian.core.bean.EntityObject objectToSave) This is for internal use only, Do not rely on it as a public API.voidsetEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
applyChildVersioningPolicy, findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, findLatestVersionsIterator, findNamedQueryStringParams, saveMethods inherited from class com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
findNamedQueryStringParams, getContentStatusStringList, getStatusNames, scanFilteredContents, scanFilteredContents, updateModificationDataMethods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getCountResult, getHibernateTemplate, getSessionFactory, reIndex, save, saveEntity, setHibernateTemplate, setSessionFactory, uniqueResultMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDaoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.core.persistence.ContentEntityObjectDao
getAllModifiers, save, saveMethods inherited from interface com.atlassian.confluence.internal.persistence.ContentEntityObjectDaoInternal
findContentBySpaceIdAndStatusAndFilter
-
Constructor Details
-
ContentEntityObjectHibernateDao
- Since:
- 7.12
-
-
Method Details
-
getById
Description copied from interface:ContentEntityObjectDaoRetrieve the object with a particular id from the database. The object must be of the same class as the DAO's getPersistentClass() method returns.- Specified by:
getByIdin interfaceContentEntityObjectDao- Parameters:
id- the id of the object to look up- Returns:
- the corresponding object, or null if the object does not exist with the appropriate class and id.
-
getByClassId
Description copied from class:HibernateObjectDaoRetrieve the object with a particular id from the database. The object must be of the same class as the DAO's getPersistentClass() method returns.- Overrides:
getByClassIdin classHibernateObjectDao<ContentEntityObject>- Parameters:
id- the id of the object to look up- Returns:
- the corresponding object, or null if the object does not exist with the appropriate class and id.
-
getContentAuthoredByUser
- Specified by:
getContentAuthoredByUserin interfaceContentEntityObjectDao
-
getAllCurrentEntities
- Specified by:
getAllCurrentEntitiesin interfaceContentEntityObjectDao
-
getRecentlyAddedEntities
- Specified by:
getRecentlyAddedEntitiesin interfaceContentEntityObjectDao
-
getRecentlyModifiedEntities
- Specified by:
getRecentlyModifiedEntitiesin interfaceContentEntityObjectDao
-
getRecentlyModifiedEntities
public Iterator<SpaceContentEntityObject> getRecentlyModifiedEntities(String spaceKey, int maxResults) - Specified by:
getRecentlyModifiedEntitiesin interfaceContentEntityObjectDao
-
getRecentlyModifiedEntitiesForUser
- Specified by:
getRecentlyModifiedEntitiesForUserin interfaceContentEntityObjectDao
-
getFirstVersionBefore
- Specified by:
getFirstVersionBeforein interfaceContentEntityObjectDao
-
getFirstVersionAfter
- Specified by:
getFirstVersionAfterin interfaceContentEntityObjectDao
-
getVersion
- Specified by:
getVersionin interfaceContentEntityObjectDao
-
getRecentlyModifiedForChangeDigest
Description copied from interface:ContentEntityObjectDaoRetrieves a list ofContentEntityObjects that have been newly added or modified since the date specified. This list excludes drafts, space descriptions and mail.- Specified by:
getRecentlyModifiedForChangeDigestin interfaceContentEntityObjectDao- 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
-
getLastEditedVersionsOf
Description copied from interface:ContentEntityObjectDaoRetrieves 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:
getLastEditedVersionsOfin interfaceContentEntityObjectDao- Parameters:
content- latest version- Returns:
- the last edited versions for each user who has contributed to the specified piece of content.
-
getLastEditedOldVersionsOf
public Map<ContentId,List<ContentEntityObject>> getLastEditedOldVersionsOf(Collection<ContentId> contentIds) Description copied from interface:ContentEntityObjectDaoRetrieves all old 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:
getLastEditedOldVersionsOfin interfaceContentEntityObjectDao- Returns:
-
getTrashedContent
- Specified by:
getTrashedContentin interfaceContentEntityObjectDao
-
getTrashedContents
- Specified by:
getTrashedContentsin interfaceContentEntityObjectDao
-
getTrashedContents
public PageResponse<ContentEntityObject> getTrashedContents(String spaceKey, LimitedRequest pageRequest, Predicate<? super ContentEntityObject> filter) - Specified by:
getTrashedContentsin interfaceContentEntityObjectDao
-
getPagesByCursor
protected <T extends ConfluenceEntityObject> PageResponse<T> getPagesByCursor(Function<LimitedRequest, List<T>> searchPages, LimitedRequest originalRequest, Predicate<? super T> filter) -
getTrashedEntities
Description copied from interface:ContentEntityObjectDaoInternalRetrieve a batch of trashed content entities- Specified by:
getTrashedEntitiesin interfaceContentEntityObjectDaoInternal- Parameters:
contentIdOffset- ids of returned entities must be greater than or equal to this valuelimit- maximum number of entities to return
-
findContentBySpaceIdAndStatus
public List<SpaceContentEntityObject> findContentBySpaceIdAndStatus(long spaceId, String status, int offset, int count) Description copied from interface:ContentEntityObjectDaoRetrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.- Specified by:
findContentBySpaceIdAndStatusin interfaceContentEntityObjectDao- Parameters:
spaceId- the id of the spacestatus- the status of the content being retrieved (e.g.ContentEntityObject.DELETEDoffset- 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
@Deprecated public PageResponse<SpaceContentEntityObject> findContentBySpaceIdAndStatus(long spaceId, String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super SpaceContentEntityObject> predicate) Deprecated.Description copied from interface:ContentEntityObjectDaoRetrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.- Specified by:
findContentBySpaceIdAndStatusin interfaceContentEntityObjectDao- Parameters:
spaceId- the id of the spacestatus- the status of the content being retrieved (e.g.ContentEntityObject.DELETEDlimitedRequest- - the start and offset of the pages to retrievepredicate- - a predicate to filter the returned results by- Returns:
- a PageResponse of ContentEntityObjects in the space with the given status
-
countContentBySpaceIdAndStatus
Description copied from interface:ContentEntityObjectDaoRetrieve the count of content for a given space with a particular status.- Specified by:
countContentBySpaceIdAndStatusin interfaceContentEntityObjectDao- Parameters:
spaceId- the id of the spacestatus- the status of the content being retrieved (e.g.ContentEntityObject.DELETED- Returns:
- the number of content objects with that status in that space
-
getObjectType
- Specified by:
getObjectTypein interfaceContentEntityObjectDao
-
getVersionsLastEditedByUser
public Map<Long,ContentEntityObject> getVersionsLastEditedByUser(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Description copied from interface:ContentEntityObjectDaoGets theContentEntityObjectobjects, either the current version or historical version relating to given contentIds of the current version that was the most recent version edited by the given user. Only content with a "current" status are returned.- Specified by:
getVersionsLastEditedByUserin interfaceContentEntityObjectDao- Parameters:
contentIds- the ids of the content we're interested in. These *must* be ids of the latest version.userKey- the userKey of the user that we're interested in- Returns:
- the
ContentEntityObjectobjects relating to the version of the given contentIds that were last edited by the given user.
-
getVersionsLastEditedByUserNew
@Deprecated public Map<Long,ContentEntityObject> getVersionsLastEditedByUserNew(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Deprecated.since 6.4.0Description copied from interface:ContentEntityObjectDaoSame asContentEntityObjectDao.getVersionsLastEditedByUser(Collection, UserKey), but a refined implementation for new Recently Worked On Drafts work. TODO: replaceContentEntityObjectDao.getVersionsLastEditedByUser(Collection, UserKey)with the implementation of this method- Specified by:
getVersionsLastEditedByUserNewin interfaceContentEntityObjectDao
-
getPageAndBlogPostsVersionsLastEditedByUser
public PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUser(com.atlassian.sal.api.user.UserKey userKey, LimitedRequest limitedRequest) Description copied from interface:ContentEntityObjectDaoRetrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification. Only content with a "current" status are returned.- Specified by:
getPageAndBlogPostsVersionsLastEditedByUserin interfaceContentEntityObjectDao- Parameters:
userKey- the key for the user for whom to retrieve the modified contentlimitedRequest- the request
-
getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts
public PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts(com.atlassian.sal.api.user.UserKey userKey, LimitedRequest limitedRequest) Description copied from interface:ContentEntityObjectDaoRetrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification. Only content with "current" or "draft" status are returned.- Specified by:
getPageAndBlogPostsVersionsLastEditedByUserIncludingDraftsin interfaceContentEntityObjectDao- Parameters:
userKey- the key for the user for whom to retrieve the modified contentlimitedRequest- the request
-
getContributionStatusByUser
public Map<Long,ContributionStatus> getContributionStatusByUser(Collection<ContentId> contentIds, com.atlassian.sal.api.user.UserKey userKey) Description copied from interface:ContentEntityObjectDaoIdentifies the most recent contributions made to a Collection of content by the given user. A contribution can either be a page publish, unpublished changes to a draft or anything that triggers a touch relation.It takes a Collection of contentIds and returns a Map of contentIds to ContributionStatuses for the supplied Ids.
If non existing ContentIds are used, they will not be present in the returned Map. If no contribution status can be found for the supplied contentIds, they will not be present in the returned Map.
Anonymous users are not supported.
- Specified by:
getContributionStatusByUserin interfaceContentEntityObjectDao- Parameters:
contentIds- the IDs of the content we want to query. These *must* be IDs of the latest versionuserKey- the userKey of the user who's changes we are interested in- Returns:
- the
ContributionStatusof each content
-
getVersionHistorySummary
- Specified by:
getVersionHistorySummaryin interfaceContentEntityObjectDao
-
getAllModifiers
Description copied from interface:ContentEntityObjectDaoGet the Set of allConfluenceUserthat have modified (contributed) content. This includes users for existing and deleted historical versions.- Specified by:
getAllModifiersin interfaceContentEntityObjectDao- Parameters:
contentIds- the content IDs of interest- Returns:
- a
Mapof content IDs to aSetofConfluenceUserthat have contributed to the content
-
getVersionHistorySummary
public PageResponse<VersionHistorySummary> getVersionHistorySummary(long originalContentId, LimitedRequest request) Description copied from interface:ContentEntityObjectDaoGet version history with pagination. So we don't have issue with super long history.- Specified by:
getVersionHistorySummaryin interfaceContentEntityObjectDao- Parameters:
originalContentId- the content Id of latest version, the CURRENT versionrequest- page request contains start, limit fields for pagination purpose.- Returns:
- PageResponse of version history.
-
getVersionEditContributors
public Map<Long,List<ConfluenceUser>> getVersionEditContributors(Iterable<ContentEntityObject> originalVersions) Description copied from interface:ContentEntityObjectDaoGet version edit contributors for a set of content identifiers. This returns the last modified of all versions of the content.- Specified by:
getVersionEditContributorsin interfaceContentEntityObjectDao- Parameters:
originalVersions- the contents of latest versions, the CURRENT versions- Returns:
- A map between content if and list of contributor users (null indicates anonymous).
-
findPreviousVersions
- Specified by:
findPreviousVersionsin interfaceContentEntityObjectDao
-
findHistoricalVersionsAfterVersion
public List<ContentEntityObject> findHistoricalVersionsAfterVersion(long originalContentId, int version) - Specified by:
findHistoricalVersionsAfterVersionin interfaceContentEntityObjectDao
-
findAllDraftsFor
Description copied from interface:ContentEntityObjectDaoRetrieves a list of drafts for the given content if any drafts exist.- Specified by:
findAllDraftsForin interfaceContentEntityObjectDao- Parameters:
contentId- id of the content to retrieve the draft for- Returns:
- a non-null list of drafts, with 0 or more elements.
- See Also:
-
findAllLegacyDraftsFor
Description copied from interface:ContentEntityObjectDaoRetrieves a list of Legacy drafts for the given content if any exist.- Specified by:
findAllLegacyDraftsForin interfaceContentEntityObjectDao- Parameters:
contentId- id of the content to retrieve the draft for- Returns:
- a non-null list of drafts, with 0 or more elements.
- See Also:
-
findDraftFor
Description copied from interface:ContentEntityObjectDaoRetrieves the draft for the given content if exists.- Specified by:
findDraftForin interfaceContentEntityObjectDao- Parameters:
contentId- id of the content to retrieve the draft for- Returns:
- the draft for the given content if exists, null otherwise
- See Also:
-
findUnpublishedContentWithUserContributions
Description copied from interface:ContentEntityObjectDaoRetrieves the drafts for the givenUser. IMPORTANT: this method doesn't return published shared drafts, only personal drafts and unpublished shared drafts- Specified by:
findUnpublishedContentWithUserContributionsin interfaceContentEntityObjectDao- Parameters:
user- the owner of the drafts- Returns:
- a list of
ContentEntityObjectwith theContentEntityObject.DRAFTstatus
-
findDraftsWithUnpublishedChangesForUser
Description copied from interface:ContentEntityObjectDaoRetrieves the drafts for the givenUser, which contains unpublished changes- Specified by:
findDraftsWithUnpublishedChangesForUserin interfaceContentEntityObjectDao- Parameters:
creator- the owner of the drafts- Returns:
- a list of drafts (
ContentEntityObjectobjects)
-
findByClassIds
- Specified by:
findByClassIdsin interfaceContentEntityObjectDaoInternal
-
remove
Description copied from class:HibernateObjectDaoRemove an object from the database- Specified by:
removein interfaceContentEntityObjectDaoInternal- Overrides:
removein classVersionedHibernateObjectDao<ContentEntityObject>- Parameters:
contentEntityObject- the object to remove
-
refresh
- Specified by:
refreshin interfaceContentEntityObjectDaoInternal
-
saveRaw
Description copied from class:HibernateObjectDaoSave the object without updateModificationData being called. Modification/creation time will not be set, but the object will still be indexed if it is searchable.- Specified by:
saveRawin interfaceContentEntityObjectDaoInternal- Overrides:
saveRawin classHibernateObjectDao<ContentEntityObject>- Parameters:
contentEntityObject- object to save
-
getPersistentClass
- Specified by:
getPersistentClassin classHibernateObjectDao<ContentEntityObject>
-
saveRawWithoutReindex
public void saveRawWithoutReindex(com.atlassian.core.bean.EntityObject objectToSave) Description copied from interface:ContentEntityObjectDaoInternalThis is for internal use only, Do not rely on it as a public API.
Perform a saveRaw but without performing the re-index; it is unnecessary in the context of a migration or upgrade.
- Specified by:
saveRawWithoutReindexin interfaceContentEntityObjectDaoInternal
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) -
publishEvent
- Overrides:
publishEventin classHibernateObjectDao<ContentEntityObject>
-