com.atlassian.confluence.spaces
Interface SpaceManager

All Known Implementing Classes:
DefaultSpaceManager

public interface SpaceManager


Field Summary
static String GLOBAL_LOGO
           
 
Method Summary
 void archiveSpace(Space space)
          Archive the space.
 Space createPersonalSpace(String name, String description, com.atlassian.user.User owner)
          Creates a personal space.
 Space createPrivatePersonalSpace(String name, String description, com.atlassian.user.User owner)
          Create a personal Space for which only the creator has any permissions
 Space createPrivateSpace(String key, String name, String description, com.atlassian.user.User creator)
          Creates a Space for which only the creator has any permissions
 Space createSpace(Space space)
           
 Space createSpace(String key, String name, String description, com.atlassian.user.User creator)
           
 void ensureSpaceDescriptionExists(Space space)
          If the given Space does not have a description, creates one for it, and saves it.
 long findPageTotal(Space space)
          Get the number of pages in a space.
 Collection<String> getAllSpaceKeys(SpaceStatus status)
          Get the space keys of all spaces with the given status.
 List<Space> getAllSpaces()
          Finds all spaces in Confluence, of any type, sorted alphabetically by space name.
 List<Space> getAllSpaces(SpacesQuery query)
          Get a list of spaces specified by the SpacesQuery.
 List getAuthoredSpacesByUser(String username)
           
 List getEditableSpacesByType(com.atlassian.user.User user, SpaceType type)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 SpaceLogo getLogoForGlobalcontext()
           
 SpaceLogo getLogoForSpace(String spaceKey)
           
 int getNumberOfBlogPosts(Space space)
          Get the number of blog posts in a space.
 int getNumberOfMail(Space space)
          Get the number of archived emails in a space.
 List<Space> getPermittedSpaces(com.atlassian.user.User user)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 List<Space> getPermittedSpacesByType(com.atlassian.user.User user, SpaceType type)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 List getPermittedSpacesInSpaceGroup(com.atlassian.user.User user, SpaceGroup spaceGroup)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 Space getPersonalSpace(String username)
          Get the personal space for the user with the given username
 Space getPersonalSpace(com.atlassian.user.User user)
          Get the personal space of the given user.
 String getPersonalSpaceKey(String username)
           
 Space getSpace(long id)
          Retrieve a space by its ID.
 Space getSpace(String spaceKey)
          Retrieve a space by its key.
 List<com.atlassian.user.User> getSpaceAdmins(Space spaces)
          Returns a list of administrators for a given space, sorted by full name
 List<com.atlassian.user.User> getSpaceAdmins(Space spaces, int limit)
          Returns a list of administrators for a given space, sorted by full name, up to the size limit
 String getSpaceFromPageId(long pageId)
          Get the key for a space from its pageId in a single db call
 ListBuilder<Space> getSpaces(SpacesQuery query)
          Get a list of spaces specified by the SpacesQuery limited by the offset and maxResults.
 List<Space> getSpacesByType(SpaceType type)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 List getSpacesContainingCommentsBy(String username)
           
 List getSpacesContainingPagesEditedBy(String username)
          Returns Pages that are either created or edited by the specified user
 List<Space> getSpacesCreatedAfter(Date creationDate)
           
 List<Space> getSpacesEditableByUser(com.atlassian.user.User user)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 List<Space> getSpacesInSpaceGroup(SpaceGroup spaceGroup)
          Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
 Boolean removeSpace(Space space)
           
 Boolean removeSpace(String spaceKey, com.atlassian.core.util.ProgressMeter progressMeter)
          Removes a space with a given spaceKey (case sensitive).
 void removeSpacesInGroup(SpaceGroup spaceGroup)
           
 void saveSpace(Space space)
           
 void saveSpace(Space space, Space originalSpace)
           
 void unarchiveSpace(Space space)
          Un-archive the space.
 

Field Detail

GLOBAL_LOGO

static final String GLOBAL_LOGO
See Also:
Constant Field Values
Method Detail

createSpace

Space createSpace(String key,
                  String name,
                  String description,
                  com.atlassian.user.User creator)

createPersonalSpace

Space createPersonalSpace(String name,
                          String description,
                          com.atlassian.user.User owner)
Creates a personal space. The difference to a normal space are that this space will have a type "personal" and the user passed to this space should not be the creator, but is the owner of the space.

Parameters:
name -
description -
owner -
Returns:
the created space

createPrivatePersonalSpace

Space createPrivatePersonalSpace(String name,
                                 String description,
                                 com.atlassian.user.User owner)
Create a personal Space for which only the creator has any permissions

Parameters:
name -
description -
owner -
Returns:

createSpace

Space createSpace(Space space)

createPrivateSpace

Space createPrivateSpace(String key,
                         String name,
                         String description,
                         com.atlassian.user.User creator)
Creates a Space for which only the creator has any permissions

Parameters:
key -
name -
description -
creator -
Returns:

saveSpace

void saveSpace(Space space)

saveSpace

void saveSpace(Space space,
               Space originalSpace)

removeSpace

Boolean removeSpace(Space space)

removeSpace

Boolean removeSpace(String spaceKey,
                    com.atlassian.core.util.ProgressMeter progressMeter)
Removes a space with a given spaceKey (case sensitive). This must be passed a progress monitor which will be updated with internationalised status while the space is being removed. Ideally this should be done from a long running task, since it can be very slow.

Parameters:
spaceKey - the key of the space to remove
progressMeter - will be updated with status messages and percentage completed. Not Null.
Returns:
true if the space was successfully removed.
Since:
4.2

removeSpacesInGroup

void removeSpacesInGroup(SpaceGroup spaceGroup)

getSpace

Space getSpace(long id)
Retrieve a space by its ID. The space can be of any type.

Parameters:
id - the ID of the space
Returns:
the space, or null if no space exists with that id.

getSpace

Space getSpace(String spaceKey)
Retrieve a space by its key. The space can be of any type.

Parameters:
spaceKey - the space key of the space to retrieve
Returns:
the space, or null if no space exists with that key

getPersonalSpace

Space getPersonalSpace(String username)
Get the personal space for the user with the given username

Parameters:
username - the username of the user to get the personal space of
Returns:
the personal space for that user, or null if the user has no personal space

getPersonalSpace

Space getPersonalSpace(com.atlassian.user.User user)
Get the personal space of the given user. This method may be more convenient than getPersonalSpace(String), as it behaves gracefully when the user is anonymous (i.e. null). Where the user is not null, this method is the equivalent of getPersonalSpace(user.getName()).

Parameters:
user - the user to get the space for. If user is null, the method will return null
Returns:
the personal space of the user if one exists, otherwise null.

getAllSpaces

List<Space> getAllSpaces()
Finds all spaces in Confluence, of any type, sorted alphabetically by space name.

Returns:
List of spaces

getSpacesContainingPagesEditedBy

List getSpacesContainingPagesEditedBy(String username)
Returns Pages that are either created or edited by the specified user

Parameters:
username - a username
Returns:
Pages that are either created or edited by the specified user

getSpacesContainingCommentsBy

List getSpacesContainingCommentsBy(String username)

getAuthoredSpacesByUser

List getAuthoredSpacesByUser(String username)

findPageTotal

long findPageTotal(Space space)
Get the number of pages in a space. This counts all pages, including non-current versions, and including pages that are in the trash. As such, it probably doesn't do what you think it does.

Parameters:
space - the space to count pages in
Returns:
the number of pages in that space

getNumberOfBlogPosts

int getNumberOfBlogPosts(Space space)
Get the number of blog posts in a space. This counts all news, including non-current versions, and including news that is in the trash. As such, it probably doesn't do what you think it does.

Parameters:
space - the space to count pages in
Returns:
the number of blog posts (news items) in that space

getNumberOfMail

int getNumberOfMail(Space space)
Get the number of archived emails in a space. This counts all mail, including mail that is in the trash. As such, it probably doesn't do what you think it does.

Parameters:
space - the space to count mail in
Returns:
the number of emails archived in the space

getSpaceFromPageId

String getSpaceFromPageId(long pageId)
Get the key for a space from its pageId in a single db call

Parameters:
pageId - the id of the page to look for
Returns:
the key for the space containing the given page

getSpacesCreatedAfter

List<Space> getSpacesCreatedAfter(Date creationDate)

getPersonalSpaceKey

String getPersonalSpaceKey(String username)

ensureSpaceDescriptionExists

void ensureSpaceDescriptionExists(Space space)
If the given Space does not have a description, creates one for it, and saves it.

This is required for CONF-4080, because labels on a Space are attached to a Space Description.

Parameters:
space - an existing space. Not null.

getLogoForSpace

SpaceLogo getLogoForSpace(String spaceKey)

getLogoForGlobalcontext

SpaceLogo getLogoForGlobalcontext()

getSpaces

ListBuilder<Space> getSpaces(SpacesQuery query)
Get a list of spaces specified by the SpacesQuery limited by the offset and maxResults.


getAllSpaces

List<Space> getAllSpaces(SpacesQuery query)
Get a list of spaces specified by the SpacesQuery. Any code that calls this method is a potential performance problem. The method may be deprecated and removed in a future version of Confluence. Use getSpaces(SpacesQuery) to retrieve pages of results instead.


getSpaceAdmins

List<com.atlassian.user.User> getSpaceAdmins(Space spaces)
Returns a list of administrators for a given space, sorted by full name


getSpaceAdmins

List<com.atlassian.user.User> getSpaceAdmins(Space spaces,
                                             int limit)
Returns a list of administrators for a given space, sorted by full name, up to the size limit


getPermittedSpaces

@Deprecated
List<Space> getPermittedSpaces(com.atlassian.user.User user)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead

Return all spaces for which the the user has VIEW permission.

Parameters:
user - the user to check permissions against, or null for the anonymous user
Returns:
a list of all spaces that user is permitted to VIEW

getPermittedSpacesByType

@Deprecated
List<Space> getPermittedSpacesByType(com.atlassian.user.User user,
                                                SpaceType type)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead

Return all spaces of a given type for which the user has VIEW permission.

Parameters:
user - the user to check permissions against, or null for the anonymous user
type - the type of space to return
Returns:
a list of all spaces of that type the user is permitted to VIEW

getPermittedSpacesInSpaceGroup

@Deprecated
List getPermittedSpacesInSpaceGroup(com.atlassian.user.User user,
                                               SpaceGroup spaceGroup)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead

Return all spaces within a given spaceGroup for which the user has VIEW permission

Parameters:
user - the user to check permissions against, or null for the anonymous user
spaceGroup - the spaceGroup from which we query the spaces
Returns:
a list of all spaces within the spaceGroup for which the user has VIEW permission

getSpacesEditableByUser

@Deprecated
List<Space> getSpacesEditableByUser(com.atlassian.user.User user)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead

Return all spaces in which the user can create or edit pages.

Parameters:
user - the user to check permissions against, or null for the anonymous user
Returns:
a list of all spaces in which the user can create or edit pages

getEditableSpacesByType

@Deprecated
List getEditableSpacesByType(com.atlassian.user.User user,
                                        SpaceType type)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead

Return all spaces of a given type in which the user can create or edit pages

Parameters:
user - the user to check permissions against, or null for the anonymous user
type - the type of space to return
Returns:
a list of all spaces of that type in which the user can create or edit pages

getSpacesByType

@Deprecated
List<Space> getSpacesByType(SpaceType type)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead


getSpacesInSpaceGroup

@Deprecated
List<Space> getSpacesInSpaceGroup(SpaceGroup spaceGroup)
Deprecated. since 3.1 Use getSpaces(SpacesQuery) instead


archiveSpace

void archiveSpace(Space space)
Archive the space. Archived spaces are removed from various lists and search results to unclutter the user interface. If the space is archived, this method does nothing.

Parameters:
space - the space to archive.

unarchiveSpace

void unarchiveSpace(Space space)
Un-archive the space. If the space is already un-archived, this method does nothing.

Parameters:
space - the space to archive.

getAllSpaceKeys

Collection<String> getAllSpaceKeys(SpaceStatus status)
Get the space keys of all spaces with the given status.

Parameters:
status - the status to search for
Returns:
the keys of all spaces with that status.


Copyright © 2003-2013 Atlassian. All Rights Reserved.