com.atlassian.confluence.spaces.persistence.dao.hibernate
Class HibernateSpaceDao

java.lang.Object
  extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
      extended bycom.atlassian.hibernate.HibernateObjectDao
          extended bybucket.core.persistence.hibernate.CachableHibernateObjectDao
              extended bycom.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
                  extended bycom.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
                      extended bycom.atlassian.confluence.spaces.persistence.dao.hibernate.HibernateSpaceDao
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, ObjectDao, SpaceDao, VersionedObjectDao

public class HibernateSpaceDao
extends ConfluenceHibernateObjectDao
implements SpaceDao


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
log
 
Fields inherited from class bucket.core.persistence.hibernate.CachableHibernateObjectDao
cacheManager
 
Fields inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
logger
 
Constructor Summary
HibernateSpaceDao()
           
 
Method Summary
 List findAllGlobalSpaces()
           
 List findAllSpacesSorted(String sortField, SpaceType type)
          Like findAllSorted, but allows you to query for a specific type of space
 int findPageTotal(Space space)
          Fast way to count pages in a space without loading them.
protected  EntityObject getByClassId(long l)
           
 Space getById(long id)
           
 int getNumberOfBlogPosts(Space space)
          Fast way to count blog posts in a space without loading them.
 int getNumberOfMail(Space space)
          Fast way to count pages in a space without loading them.
 List getPermittedSpacesForUser(User user, String permission)
          Find all spaces on which the given user has the given permission
 List getPermittedSpacesForUserByType(User user, String permission, SpaceType type)
          Query for spaces by type.
 List getPermittedSpacesForUserInSpaceGroup(User user, String permission, SpaceGroup spaceGroup)
          Query for spaces by type.
 Class getPersistentClass()
           
 Space getSpace(String spaceKey)
          first tries to fetch the space from the cache by space id if not, fetch it from database
 List getSpacesContainingCommentsByUser(String username)
          Find all spaces containing comments by a particular user.
 List getSpacesContainingPagesEditedByUser(String username)
          Find all spaces containing pages that were edited by a particular user.
 List getSpacesCreatedAfter(Date creationDate)
           
 List getSpacesCreatedByUser(String username)
          Find all the spaces created by a given user.
 List getSpacesCreatedOrUpdatedSinceDate(Date previousLoginDate)
           
 List getSpacesInSpaceGroup(SpaceGroup spaceGroup)
          Find all spaces within a given spaceGroup
 UserAccessor getUserAccessor()
           
 void remove(EntityObject entity)
          Override the parent remove method as we want to remove the object out of the cache as well
 void setHibernateConfig(HibernateConfig hibernateConfig)
           
 void setUserAccessor(UserAccessor userAccessor)
           
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
findByQuery
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, save, updateModificationData
 
Methods inherited from class bucket.core.persistence.hibernate.CachableHibernateObjectDao
setCacheManager
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, index, refresh, reIndex, replicate, save, saveRaw, setIndexer, unIndex
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
afterPropertiesSet, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, initDao, setHibernateTemplate, setSessionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, refresh, replicate, save, saveRaw
 

Constructor Detail

HibernateSpaceDao

public HibernateSpaceDao()
Method Detail

findAllGlobalSpaces

public List findAllGlobalSpaces()
Specified by:
findAllGlobalSpaces in interface SpaceDao

findAllSpacesSorted

public List findAllSpacesSorted(String sortField,
                                SpaceType type)
Like findAllSorted, but allows you to query for a specific type of space

Specified by:
findAllSpacesSorted in interface SpaceDao
Parameters:
sortField -
Returns:
sorted List of spaces

getByClassId

protected EntityObject getByClassId(long l)

getById

public Space getById(long id)
Specified by:
getById in interface SpaceDao

getSpace

public Space getSpace(String spaceKey)
first tries to fetch the space from the cache by space id if not, fetch it from database

Specified by:
getSpace in interface SpaceDao
Parameters:
spaceKey -

getSpacesInSpaceGroup

public List getSpacesInSpaceGroup(SpaceGroup spaceGroup)
Description copied from interface: SpaceDao
Find all spaces within a given spaceGroup

Specified by:
getSpacesInSpaceGroup in interface SpaceDao
Parameters:
spaceGroup -
Returns:
List of spaces

getSpacesCreatedByUser

public List getSpacesCreatedByUser(String username)
Description copied from interface: SpaceDao
Find all the spaces created by a given user.

Specified by:
getSpacesCreatedByUser in interface SpaceDao

getSpacesContainingPagesEditedByUser

public List getSpacesContainingPagesEditedByUser(String username)
Description copied from interface: SpaceDao
Find 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:
getSpacesContainingPagesEditedByUser in interface SpaceDao
Parameters:
username - the name of 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

public List getSpacesContainingCommentsByUser(String username)
Description copied from interface: SpaceDao
Find 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:
getSpacesContainingCommentsByUser in interface SpaceDao
Parameters:
username - the name of 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

public List getSpacesCreatedOrUpdatedSinceDate(Date previousLoginDate)
Specified by:
getSpacesCreatedOrUpdatedSinceDate in interface SpaceDao

findPageTotal

public int findPageTotal(Space space)
Description copied from interface: SpaceDao
Fast way to count pages in a space without loading them. Counts all pages, not just the current versions.

Specified by:
findPageTotal in interface SpaceDao
Returns:
returns the number of all versions of all pages in a space

remove

public void remove(EntityObject entity)
Override the parent remove method as we want to remove the object out of the cache as well

Specified by:
remove in interface ObjectDao
Parameters:
entity -

setHibernateConfig

public void setHibernateConfig(HibernateConfig hibernateConfig)

getPersistentClass

public Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao

getNumberOfBlogPosts

public int getNumberOfBlogPosts(Space space)
Description copied from interface: SpaceDao
Fast way to count blog posts in a space without loading them. Counts all blog posts, not just the current versions.

Specified by:
getNumberOfBlogPosts in interface SpaceDao
Returns:
returns the number of all versions of all blog posts in a space

getNumberOfMail

public int getNumberOfMail(Space space)
Description copied from interface: SpaceDao
Fast way to count pages in a space without loading them. Counts all mail, not just the current versions.

Specified by:
getNumberOfMail in interface SpaceDao
Returns:
returns the number of all versions of all mail in a space

getSpacesCreatedAfter

public List getSpacesCreatedAfter(Date creationDate)
Specified by:
getSpacesCreatedAfter in interface SpaceDao

getPermittedSpacesForUser

public List getPermittedSpacesForUser(User user,
                                      String permission)
Description copied from interface: SpaceDao
Find all spaces on which the given user has the given permission

Specified by:
getPermittedSpacesForUser in interface SpaceDao

getPermittedSpacesForUserByType

public List getPermittedSpacesForUserByType(User user,
                                            String permission,
                                            SpaceType type)
Query for spaces by type.

Specified by:
getPermittedSpacesForUserByType in interface SpaceDao
Parameters:
user -
permission -
type -

getPermittedSpacesForUserInSpaceGroup

public List getPermittedSpacesForUserInSpaceGroup(User user,
                                                  String permission,
                                                  SpaceGroup spaceGroup)
Query for spaces by type.

Specified by:
getPermittedSpacesForUserInSpaceGroup in interface SpaceDao
Parameters:
user -
permission -
spaceGroup -

setUserAccessor

public void setUserAccessor(UserAccessor userAccessor)

getUserAccessor

public UserAccessor getUserAccessor()


Confluence is developed by Atlassian.