com.atlassian.confluence.spaces.persistence.dao
Interface SpaceDao

All Superinterfaces:
ObjectDao
All Known Implementing Classes:
HibernateSpaceDao

public interface SpaceDao
extends ObjectDao


Method Summary
 int countPermittedSpacesForUser(com.atlassian.user.User user, java.util.List<com.atlassian.user.Group> groupsForUser, java.lang.String permission)
          Deprecated. since 5.2. See countSpaces(SpacesQuery) instead.
 int countSpaces(SpacesQuery query)
          Count the spaces specified by the SpacesQuery.
 int findPageTotal(Space space)
          Fast way to count pages in a space without loading them.
 java.util.Collection<java.lang.String> findSpaceKeysWithStatus(java.lang.String status)
          find all space keys where the space status is equal to the given status.
 java.lang.String findUniqueVersionOfSpaceKey(java.lang.String spaceKey)
          Return a unique version of the supplied spaceKey.
 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.
 Space getPersonalSpace(ConfluenceUser user)
           
 Space getSpace(java.lang.String spaceKey)
          Find a space by its space key.
 Space getSpaceByContentId(long contentId)
          Get the space that some content belongs to in a single db query.
 java.util.List<Space> getSpaces(SpacesQuery query)
          Get a list of spaces specified by the SpacesQuery.
 java.util.List<Space> getSpaces(SpacesQuery query, int offset, int maxResults)
          Get a list of spaces specified by the SpacesQuery.
 java.util.List<Space> getSpacesContainingCommentsByUser(java.lang.String username)
          Find all spaces containing comments by a particular user.
 java.util.List<Space> getSpacesContainingPagesEditedByUser(java.lang.String username)
          Find all spaces containing pages that were edited by a particular user.
 java.util.List<Space> getSpacesCreatedAfter(java.util.Date creationDate)
           
 java.util.List<Space> getSpacesCreatedByUser(java.lang.String username)
          Find all the spaces created by a given user.
 java.util.List<Space> getSpacesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
           
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, getPersistentClass, refresh, remove, replicate, save, saveRaw
 

Method Detail

getById

Space getById(long id)

getSpace

Space getSpace(java.lang.String spaceKey)
Find a space by its space key.


getSpacesCreatedByUser

java.util.List<Space> getSpacesCreatedByUser(java.lang.String username)
Find all the spaces created by a given user.


getPersonalSpace

Space getPersonalSpace(ConfluenceUser user)
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

getSpacesContainingPagesEditedByUser

java.util.List<Space> getSpacesContainingPagesEditedByUser(java.lang.String username)
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.

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

java.util.List<Space> getSpacesContainingCommentsByUser(java.lang.String username)
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.

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

java.util.List<Space> getSpacesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)

findPageTotal

int findPageTotal(Space space)
Fast way to count pages in a space without loading them. Counts all pages, not just the current versions.

Returns:
returns the number of all versions of all pages in a space

getNumberOfBlogPosts

int getNumberOfBlogPosts(Space space)
Fast way to count blog posts in a space without loading them. Counts all blog posts, not just the current versions.

Returns:
returns the number of all versions of all blog posts in a space

getNumberOfMail

int getNumberOfMail(Space space)
Fast way to count pages in a space without loading them. Counts all mail, not just the current versions.

Returns:
returns the number of all versions of all mail in a space

getSpacesCreatedAfter

java.util.List<Space> getSpacesCreatedAfter(java.util.Date creationDate)

countPermittedSpacesForUser

@Deprecated
int countPermittedSpacesForUser(com.atlassian.user.User user,
                                           java.util.List<com.atlassian.user.Group> groupsForUser,
                                           java.lang.String permission)
Deprecated. since 5.2. See countSpaces(SpacesQuery) instead.

Parameters:
user -
groupsForUser -
permission -
Returns:
the number of spaces permitted.

getSpaces

java.util.List<Space> getSpaces(SpacesQuery query,
                                int offset,
                                int maxResults)
Get a list of spaces specified by the SpacesQuery.


getSpaces

java.util.List<Space> getSpaces(SpacesQuery query)
Get a list of spaces specified by the SpacesQuery. Its recommended to use the getSpaces(com.atlassian.confluence.spaces.SpacesQuery, int, int) form of this method where ever possible.


countSpaces

int countSpaces(SpacesQuery query)
Count the spaces specified by the SpacesQuery.


getSpaceByContentId

Space getSpaceByContentId(long contentId)
Get 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)

Parameters:
contentId - the ID of the content
Returns:
the space that content belongs to

findSpaceKeysWithStatus

java.util.Collection<java.lang.String> findSpaceKeysWithStatus(java.lang.String status)
find all space keys where the space status is equal to the given status.

Parameters:
status - the status to search for
Returns:
all space keys of spaces that match that status

findUniqueVersionOfSpaceKey

java.lang.String findUniqueVersionOfSpaceKey(java.lang.String spaceKey)
Return 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.

Parameters:
spaceKey - the space key to create a unique version of
Returns:
the unique space key


Copyright © 2003-2014 Atlassian. All Rights Reserved.