public interface

SpaceManager

com.atlassian.confluence.spaces.SpaceManager
Known Indirect Subclasses

Summary

Constants
String GLOBAL_LOGO
Public Methods
Space createPersonalSpace(String name, String description, User owner)
Creates a personal space.
Space createSpace(String key, String name, String description, User creator)
Space createSpace(Space space)
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.
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)
@Deprecated List getEditableSpacesByType(User user, SpaceType type)
This method is 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.
@Deprecated List<Space> getPermittedSpaces(User user)
This method is deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
@Deprecated List<Space> getPermittedSpacesByType(User user, SpaceType type)
This method is deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
@Deprecated List getPermittedSpacesInSpaceGroup(User user, SpaceGroup spaceGroup)
This method is deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
Space getPersonalSpace(User user)
Get the personal space of the given user.
Space getPersonalSpace(String username)
Get the personal space for the user with the given username
String getPersonalSpaceKey(String username)
Space getSpace(String spaceKey)
Retrieve a space by its key.
Space getSpace(long id)
Retrieve a space by its ID.
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.
@Deprecated List<Space> getSpacesByType(SpaceType type)
This method is 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)
@Deprecated List<Space> getSpacesEditableByUser(User user)
This method is deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
@Deprecated List<Space> getSpacesInSpaceGroup(SpaceGroup spaceGroup)
This method is deprecated. since 3.1 Use getSpaces(SpacesQuery) instead
Boolean removeSpace(String spaceKey, ProgressMeter progressMeter)
Removes a space with a given spaceKey (case sensitive).
Boolean removeSpace(Space space)
void removeSpacesInGroup(SpaceGroup spaceGroup)
void saveSpace(Space space)
void saveSpace(Space space, Space originalSpace)

Constants

public static final String GLOBAL_LOGO

Constant Value: "global.logo"

Public Methods

public Space createPersonalSpace (String name, String description, 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.

Returns
  • the created space

public Space createSpace (String key, String name, String description, User creator)

public Space createSpace (Space space)

public 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.

public 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

public List<Space> getAllSpaces ()

Finds all spaces in Confluence, of any type, sorted alphabetically by space name.

Returns
  • List of spaces

public 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.

public List getAuthoredSpacesByUser (String username)

@Deprecated public List getEditableSpacesByType (User user, SpaceType type)

This method is 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

public SpaceLogo getLogoForGlobalcontext ()

public SpaceLogo getLogoForSpace (String spaceKey)

public 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

public 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

@Deprecated public List<Space> getPermittedSpaces (User user)

This method is 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

@Deprecated public List<Space> getPermittedSpacesByType (User user, SpaceType type)

This method is 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

@Deprecated public List getPermittedSpacesInSpaceGroup (User user, SpaceGroup spaceGroup)

This method is 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

public Space getPersonalSpace (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.

public 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

public String getPersonalSpaceKey (String username)

public 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

public 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.

public 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

public ListBuilder<Space> getSpaces (SpacesQuery query)

Get a list of spaces specified by the SpacesQuery limited by the offset and maxResults.

@Deprecated public List<Space> getSpacesByType (SpaceType type)

This method is deprecated.
since 3.1 Use getSpaces(SpacesQuery) instead

public List getSpacesContainingCommentsBy (String username)

public 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

public List<Space> getSpacesCreatedAfter (Date creationDate)

@Deprecated public List<Space> getSpacesEditableByUser (User user)

This method is 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

@Deprecated public List<Space> getSpacesInSpaceGroup (SpaceGroup spaceGroup)

This method is deprecated.
since 3.1 Use getSpaces(SpacesQuery) instead

public Boolean removeSpace (String spaceKey, 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.

public Boolean removeSpace (Space space)

public void removeSpacesInGroup (SpaceGroup spaceGroup)

public void saveSpace (Space space)

public void saveSpace (Space space, Space originalSpace)