com.atlassian.confluence.spaces
Interface SpaceManager

All Known Implementing Classes:
DefaultSpaceManager

public interface SpaceManager


Field Summary
static String PERSONAL_SPACEKEY_IDENTIFIER
          Deprecated. since 2.3 use Space.PERSONAL_SPACEKEY_IDENTIFIER
 
Method Summary
 void convertToPersonalSpace(Space space, User owner, boolean updateLinks)
          Convert a global space into a user's personal space.
 Space createPersonalSpace(String name, String description, User owner)
          Creates a personal space.
 Space createSpace(String key, String name, String description, User creator)
           
 long findPageTotal(Space space)
          Get the number of pages in a space.
 List getAllSpaces()
          Finds all spaces in Confluence, of any type.
 List getAuthoredSpacesByUser(String username)
           
 List getBlogPosts(Space space, boolean currentOnly)
          Deprecated. from 2.3 use PageManager.getBlogPosts(Space, boolean)
 List getEditableSpacesByType(User user, SpaceType type)
          Return all spaces of a given type in which the user can create or edit pages
 List getMail(Space space, boolean currentOnly)
          Deprecated. from 2.3 use MailContentManager.getMail(Space, boolean)
 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 getPages(Space space, boolean currentOnly)
          Deprecated. from 2.3 use PageManager.getPages(Space, boolean)
 List getPagesStartingWith(Space space, String s)
          Deprecated. from 2.3 use PageManager.getPagesStartingWith(Space, String)
 List getPermittedSpaces(User user)
          Return all spaces for which the the user has VIEW permission.
 List getPermittedSpacesByType(User user, SpaceType type)
          Return all spaces of a given type for which the user has VIEW permission.
 List getPermittedSpacesInSpaceGroup(User user, SpaceGroup spaceGroup)
          Return all spaces within a given spaceGroup for which the user has VIEW permission
 Space getPersonalSpace(String username)
          Get the personal space for the user with the given username
 Space getPersonalSpace(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 getSpaceContent(Space space, boolean currentOnly)
           
 String getSpaceFromPageId(long pageId)
          Get the key for a space from its pageId in a single db call
 List getSpaces()
          Deprecated. since 2.3 use getSpacesByType(com.atlassian.confluence.spaces.SpaceType)
 List getSpacesByType(SpaceType type)
           
 List getSpacesContainingCommentsBy(String username)
           
 List getSpacesContainingPagesEditedBy(String username)
           
 List getSpacesCreatedAfter(Date creationDate)
           
 List getSpacesCreatedOrUpdatedSinceDate(Date previousLoginDate)
          Deprecated. since 2.3 this method is unreferenced, and probably doesn't do anything useful
 List getSpacesEditableByUser(User user)
          Return all spaces in which the the can create or edit pages.
 List getSpacesInSpaceGroup(SpaceGroup spaceGroup)
           
 boolean isValidPersonalSpaceKey(String key)
          Deprecated. since 2.3 use Space.isValidPersonalSpaceKey(java.lang.String)
 boolean isValidSpaceKey(String key)
          Deprecated. since 2.3 use Space.isValidGlobalSpaceKey(java.lang.String)
 void moveHierarchy(Page topPage, Page newParentPage, Space newSpace, User user, boolean moveChildren, List pagesToIndex)
          Moves a page and its hierarchy to a new parent page, space, or both.
 void removeSpace(Space space)
           
 void removeSpacesInGroup(SpaceGroup spaceGroup)
           
 void saveSpace(Space space)
           
 void saveSpace(Space space, Space originalSpace)
           
 

Field Detail

PERSONAL_SPACEKEY_IDENTIFIER

public static final String PERSONAL_SPACEKEY_IDENTIFIER
Deprecated. since 2.3 use Space.PERSONAL_SPACEKEY_IDENTIFIER

See Also:
Constant Field Values
Method Detail

createSpace

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

createPersonalSpace

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.

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

saveSpace

public void saveSpace(Space space)

saveSpace

public void saveSpace(Space space,
                      Space originalSpace)

removeSpace

public void removeSpace(Space space)

removeSpacesInGroup

public void removeSpacesInGroup(SpaceGroup spaceGroup)

getSpace

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.

getSpace

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

getPersonalSpace

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

getPersonalSpace

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.

getAllSpaces

public List getAllSpaces()
Finds all spaces in Confluence, of any type.

Returns:
List of spaces

getSpaces

public List getSpaces()
Deprecated. since 2.3 use getSpacesByType(com.atlassian.confluence.spaces.SpaceType)

Method to get a list of all global spaces in Confluence Warning: Despite the name, this method only returns global spaces. This is why we've deprecated it in favour of the more clearly named methods.

Returns:
List of global spaces

getPermittedSpaces

public List getPermittedSpaces(User user)
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

public List getPermittedSpacesByType(User user,
                                     SpaceType type)
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

public List getPermittedSpacesInSpaceGroup(User user,
                                           SpaceGroup spaceGroup)
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

public List getSpacesEditableByUser(User user)
Return all spaces in which the the 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

public List getEditableSpacesByType(User user,
                                    SpaceType type)
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

getSpacesContainingPagesEditedBy

public List getSpacesContainingPagesEditedBy(String username)

getSpacesContainingCommentsBy

public List getSpacesContainingCommentsBy(String username)

getAuthoredSpacesByUser

public List getAuthoredSpacesByUser(String username)

getSpacesCreatedOrUpdatedSinceDate

public List getSpacesCreatedOrUpdatedSinceDate(Date previousLoginDate)
Deprecated. since 2.3 this method is unreferenced, and probably doesn't do anything useful


convertToPersonalSpace

public void convertToPersonalSpace(Space space,
                                   User owner,
                                   boolean updateLinks)
Convert a global space into a user's personal space. This is only really useful for pre-2.2 Confluence installations that are upgrading to 2.2 or later, and want to convert existing "ad hoc" personal spaces into real personal spaces. The space's key will be updated to ~username, the owner will be set to the personal space owner, and optionally all incoming links will be refactored.

Parameters:
space - the space to convert
owner - the new owner of the personal space
updateLinks - true if you want to update incoming links to the space.

findPageTotal

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

getNumberOfBlogPosts

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

getNumberOfMail

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

moveHierarchy

public void moveHierarchy(Page topPage,
                          Page newParentPage,
                          Space newSpace,
                          User user,
                          boolean moveChildren,
                          List pagesToIndex)
Moves a page and its hierarchy to a new parent page, space, or both.

This method also updates the parent-child relationships of each of the affected pages, and rebuilds the ancestor lists.

If moveChildren is true or newSpace is the same as the current space, all of topPage's children will be moved to the new location. Otherwise, the children will be moved to the root of the current space ("orphaned").

Pages the user cannot see (due to page permissions) are not moved, as a security precuation, and are instead moved to the root of the current space.

Parameters:
topPage - The page to move
newParentPage - The new parent page
newSpace - The new space (old space if the same)
user - The current user
moveChildren - True if topPage's children should be moved with it, false to leave them. Always treated as true if moving within the same space.
pagesToIndex - normally an empty array list that will be updated with all the pages that need indexing (this way we can delay indexing til after the move has been complete)
Throws:
IllegalArgumentException - if newSpace is null
IllegalArgumentException - if topPage is null
IllegalArgumentException - if newParentPage is not in newSpace

getSpaceFromPageId

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

getSpaceContent

public List getSpaceContent(Space space,
                            boolean currentOnly)

getSpacesCreatedAfter

public List getSpacesCreatedAfter(Date creationDate)

getPersonalSpaceKey

public String getPersonalSpaceKey(String username)

getSpacesByType

public List getSpacesByType(SpaceType type)

getSpacesInSpaceGroup

public List getSpacesInSpaceGroup(SpaceGroup spaceGroup)

isValidSpaceKey

public boolean isValidSpaceKey(String key)
Deprecated. since 2.3 use Space.isValidGlobalSpaceKey(java.lang.String)


isValidPersonalSpaceKey

public boolean isValidPersonalSpaceKey(String key)
Deprecated. since 2.3 use Space.isValidPersonalSpaceKey(java.lang.String)


getPages

public List getPages(Space space,
                     boolean currentOnly)
Deprecated. from 2.3 use PageManager.getPages(Space, boolean)


getPagesStartingWith

public List getPagesStartingWith(Space space,
                                 String s)
Deprecated. from 2.3 use PageManager.getPagesStartingWith(Space, String)


getBlogPosts

public List getBlogPosts(Space space,
                         boolean currentOnly)
Deprecated. from 2.3 use PageManager.getBlogPosts(Space, boolean)


getMail

public List getMail(Space space,
                    boolean currentOnly)
Deprecated. from 2.3 use MailContentManager.getMail(Space, boolean)



Confluence is developed by Atlassian.