Class HibernateSpaceDao
java.lang.Object
org.springframework.dao.support.DaoSupport
com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<T>
com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao<Space>
com.atlassian.confluence.spaces.persistence.dao.hibernate.HibernateSpaceDao
- All Implemented Interfaces:
SpaceDaoInternal,SpaceDao,org.springframework.beans.factory.InitializingBean
@ParametersAreNonnullByDefault
public class HibernateSpaceDao
extends ConfluenceHibernateObjectDao<Space>
implements SpaceDaoInternal
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability -
Field Summary
FieldsFields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountSpaces(SpacesQueryWithPermissionQueryBuilder queryWithPermissionClauseBuilder) Count the spaces specified by theSpacesQuery.Retrieves a list of space keys.intfindPageTotal(Space space) Fast way to count pages in a space without loading them.findSpaceIdListWithIdGreaterOrEqual(Long startingId, int limit) Retrieves a limited space list starting with a particular space id.@NonNull Collection<String>findSpaceKeysWithStatus(String status) find all space keys where the space status is equal to the given status.@NonNull StringfindUniqueVersionOfSpaceKey(String spaceKey) Return a unique version of the supplied spaceKey.@Nullable SpacegetById(long id) intgetNumberOfBlogPosts(Space space) Fast way to count blog posts in a space without loading them.@Nullable SpacegetPersonalSpace(@Nullable ConfluenceUser user) @Nullable Spacefirst tries to fetch the space from the cache by space id if not, fetch it from database@Nullable SpacegetSpaceByContentId(long contentId) Get the space that some content belongs to in a single db query.getSpaces(SpacesQueryWithPermissionQueryBuilder queryWithPermissionClauseBuilder) Get a list of spaces specified by theSpacesQuery.getSpaces(SpacesQueryWithPermissionQueryBuilder queryWithPermissionClauseBuilder, int offset, int maxResults) Get a list of spaces specified by theSpacesQueryWithPermissionQueryBuilder.getSpacesContainingCommentsByUser(@Nullable ConfluenceUser user) Find all spaces containing comments by a particular user.getSpacesContainingPagesEditedByUser(@Nullable ConfluenceUser user) Find all spaces containing pages that were edited by a particular user.getSpacesCreatedAfter(Date creationDate) getSpacesCreatedByUser(@Nullable ConfluenceUser user) Find all the spaces created by a given user.getSpacesCreatedOrUpdatedSinceDate(Date previousLoginDate) voidperformOnAll(Consumer<Space> task) Perform the task with all spaces.voidvoidOverride the parent remove method as we want to remove the object out of the cache as wellvoidremoveSpaceFromCache(String spaceKey) Removes a cache element by space key.voidsetCacheFactory(com.atlassian.cache.CacheFactory cacheFactory) Methods 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, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, getHibernateTemplate, getSessionFactory, publishEvent, reIndex, save, saveEntity, saveRaw, 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.internal.spaces.persistence.SpaceDaoInternal
findAllSorted, save
-
Field Details
-
CACHE_KEY
Deprecated.since 5.10
-
-
Constructor Details
-
HibernateSpaceDao
public HibernateSpaceDao()
-
-
Method Details
-
setCacheFactory
public void setCacheFactory(com.atlassian.cache.CacheFactory cacheFactory) -
getById
-
getSpace
first tries to fetch the space from the cache by space id if not, fetch it from database -
getPersonalSpace
- Specified by:
getPersonalSpacein interfaceSpaceDao- Parameters:
user- the user who's personal space is to be retrieved- Returns:
- the personal space for the specified user or null if none exists
-
getSpacesCreatedByUser
Description copied from interface:SpaceDaoFind all the spaces created by a given user.- Specified by:
getSpacesCreatedByUserin interfaceSpaceDao
-
getSpacesContainingPagesEditedByUser
Description copied from interface:SpaceDaoFind all spaces containing pages that were edited by a particular user. This is for tracking down whether a user can be safely deleted or not.- Specified by:
getSpacesContainingPagesEditedByUserin interfaceSpaceDao- Parameters:
user- the user to track down- Returns:
- a list of the spaces containing pages that were edited by this user, or the empty list if no such spaces exist.
-
getSpacesContainingCommentsByUser
Description copied from interface:SpaceDaoFind all spaces containing comments by a particular user. This is for tracking down whether a user can be safely deleted or not.Does currently not include personal spaces, but probably should.
- Specified by:
getSpacesContainingCommentsByUserin interfaceSpaceDao- Parameters:
user- the user to track down- Returns:
- a list of the spaces containing comments by this user, or the empty list if no such spaces exist.
-
getSpacesCreatedOrUpdatedSinceDate
- Specified by:
getSpacesCreatedOrUpdatedSinceDatein interfaceSpaceDao
-
findPageTotal
Description copied from interface:SpaceDaoFast way to count pages in a space without loading them. Counts all pages, not just the current versions.- Specified by:
findPageTotalin interfaceSpaceDao- Returns:
- returns the number of all versions of all pages in a space
-
removeSpaceFromCache
Removes a cache element by space key.- Specified by:
removeSpaceFromCachein interfaceSpaceDaoInternal- Since:
- 8.3.0
-
refresh
- Specified by:
refreshin interfaceSpaceDaoInternal
-
remove
Override the parent remove method as we want to remove the object out of the cache as well- Specified by:
removein interfaceSpaceDaoInternal- Overrides:
removein classHibernateObjectDao<Space>- Parameters:
space- the object to remove
-
getPersistentClass
- Specified by:
getPersistentClassin classHibernateObjectDao<Space>
-
getNumberOfBlogPosts
Description copied from interface:SpaceDaoFast way to count blog posts in a space without loading them. Counts all blog posts, not just the current versions.- Specified by:
getNumberOfBlogPostsin interfaceSpaceDao- Returns:
- returns the number of all versions of all blog posts in a space
-
getSpacesCreatedAfter
- Specified by:
getSpacesCreatedAfterin interfaceSpaceDao
-
getSpaces
public @NonNull List<Space> getSpaces(SpacesQueryWithPermissionQueryBuilder queryWithPermissionClauseBuilder, int offset, int maxResults) Description copied from interface:SpaceDaoGet a list of spaces specified by theSpacesQueryWithPermissionQueryBuilder. -
getSpaces
public @NonNull List<Space> getSpaces(SpacesQueryWithPermissionQueryBuilder queryWithPermissionClauseBuilder) Description copied from interface:SpaceDaoGet a list of spaces specified by theSpacesQuery. Its recommended to use theSpaceDao.getSpaces(SpacesQueryWithPermissionQueryBuilder, int, int)form of this method where ever possible. -
countSpaces
Description copied from interface:SpaceDaoCount the spaces specified by theSpacesQuery.- Specified by:
countSpacesin interfaceSpaceDao
-
getSpaceByContentId
Description copied from interface:SpaceDaoGet the space that some content belongs to in a single db query. This will only work for content that directly belongs to a space (i.e. Pages, Blog Posts, Space Descriptions but not Comments or Attachments) and it will only work for current content (old content is dissassociated from its space)- Specified by:
getSpaceByContentIdin interfaceSpaceDao- Parameters:
contentId- the ID of the content- Returns:
- the space that content belongs to
-
findSpaceKeysWithStatus
Description copied from interface:SpaceDaofind all space keys where the space status is equal to the given status.- Specified by:
findSpaceKeysWithStatusin interfaceSpaceDao- Parameters:
status- the status to search for- Returns:
- all space keys of spaces that match that status
-
findUniqueVersionOfSpaceKey
Description copied from interface:SpaceDaoReturn a unique version of the supplied spaceKey. This is done by checking the database for a duplicate and following the algorithm of counting up until a duplicate is achieved e.g. spaceKey_1, spaceKey_2, etc.- Specified by:
findUniqueVersionOfSpaceKeyin interfaceSpaceDao- Parameters:
spaceKey- the space key to create a unique version of- Returns:
- the unique space key
-
performOnAll
Description copied from interface:SpaceDaoPerform the task with all spaces.- Specified by:
performOnAllin interfaceSpaceDao- Parameters:
task- apply to spaces.
-
findSpaceIdListWithIdGreaterOrEqual
Retrieves a limited space list starting with a particular space id. It's used when we want to scan all spaces, but do this within a set small transactions.- Specified by:
findSpaceIdListWithIdGreaterOrEqualin interfaceSpaceDaoInternal- Parameters:
startingId- - space idlimit- - limit- Returns:
- list of space ids
- Since:
- 7.10.0
-
findAllSpaceKeys
Retrieves a list of space keys.- Specified by:
findAllSpaceKeysin interfaceSpaceDaoInternal- Returns:
- space key list
- Since:
- 7.10.0
-