com.atlassian.confluence.spaces
Class DefaultSpaceManager

java.lang.Object
  extended by com.atlassian.confluence.spaces.DefaultSpaceManager
All Implemented Interfaces:
SpaceManager

public class DefaultSpaceManager
extends Object
implements SpaceManager


Field Summary
static String DEFAULT_HOMEPAGE_TITLE
          Deprecated. As of Confluence 2.10. Space homepage titles are internationalised. See the default.space.homepage.title key
static String DEFAULT_INDEX_CONTENT
           
static String DEFAULT_INDEX_TITLE
           
 
Fields inherited from interface com.atlassian.confluence.spaces.SpaceManager
GLOBAL_LOGO
 
Constructor Summary
DefaultSpaceManager()
           
 
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)
          Deprecated since 4.3.
 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.
 AttachmentManager getAttachmentManager()
          Deprecated. since 4.2.13. Get AttachmentManager injected directly to your objects instead.
 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)
           
 SettingsManager getSettingsManager()
          Deprecated. since 4.2.13. Get SettingsManager injected directly to your objects instead.
 Space getSpace(long id)
          Retrieve a space by its ID.
 Space getSpace(String exactKey)
          Retrieve a space by its key.
 List<com.atlassian.user.User> getSpaceAdmins(Space space)
          Returns a list of administrators for a given space, sorted by full name
 List<com.atlassian.user.User> getSpaceAdmins(Space space, 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. Space groups are no longer a feature of Confluence
 boolean isValidPersonalSpaceKey(String key)
          Deprecated. since 2.3 use Space.isValidPersonalSpaceKey(String) instead
 boolean isValidSpaceKey(String key)
          Deprecated. since 2.3 use Space.isValidGlobalSpaceKey(String) 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 setAttachmentManager(AttachmentManager attachmentManager)
           
 void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
           
 void setGroupManager(com.atlassian.user.GroupManager groupManager)
           
 void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setIndexManager(ConfluenceIndexManager indexManager)
           
 void setLabelManager(LabelManager labelManager)
           
 void setNotificationManager(NotificationManager notificationManager)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setSpaceDao(SpaceDao spaceDao)
           
 void setSpaceDescriptionManager(SpaceDescriptionManager spaceDescriptionManager)
           
 void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
           
 void setUserAccessor(UserAccessor userAccessor)
           
 void unarchiveSpace(Space space)
          Un-archive the space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HOMEPAGE_TITLE

@Deprecated
public static final String DEFAULT_HOMEPAGE_TITLE
Deprecated. As of Confluence 2.10. Space homepage titles are internationalised. See the default.space.homepage.title key
See Also:
Constant Field Values

DEFAULT_INDEX_TITLE

public static final String DEFAULT_INDEX_TITLE
See Also:
Constant Field Values

DEFAULT_INDEX_CONTENT

public static final String DEFAULT_INDEX_CONTENT
See Also:
Constant Field Values
Constructor Detail

DefaultSpaceManager

public DefaultSpaceManager()
Method Detail

setSpaceDao

public void setSpaceDao(SpaceDao spaceDao)

isValidSpaceKey

@Deprecated
public boolean isValidSpaceKey(String key)
Deprecated. since 2.3 use Space.isValidGlobalSpaceKey(String) instead


isValidPersonalSpaceKey

@Deprecated
public boolean isValidPersonalSpaceKey(String key)
Deprecated. since 2.3 use Space.isValidPersonalSpaceKey(String) instead


setSpaceDescriptionManager

public void setSpaceDescriptionManager(SpaceDescriptionManager spaceDescriptionManager)

setSpacePermissionManager

public void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)

getSpace

public Space getSpace(long id)
Description copied from interface: SpaceManager
Retrieve a space by its ID. The space can be of any type.

Specified by:
getSpace in interface SpaceManager
Parameters:
id - the ID of the space
Returns:
the space, or null if no space exists with that id.

getSpace

public Space getSpace(String exactKey)
Description copied from interface: SpaceManager
Retrieve a space by its key. The space can be of any type.

Specified by:
getSpace in interface SpaceManager
Parameters:
exactKey - 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)
Description copied from interface: SpaceManager
Get the personal space for the user with the given username

Specified by:
getPersonalSpace in interface SpaceManager
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

setIndexer

public void setIndexer(ConfluenceIndexer indexer)

setUserAccessor

public void setUserAccessor(UserAccessor userAccessor)

setGroupManager

public void setGroupManager(com.atlassian.user.GroupManager groupManager)

removeSpace

public Boolean removeSpace(Space space)
Specified by:
removeSpace in interface SpaceManager

removeSpace

public Boolean removeSpace(String spaceKey,
                           com.atlassian.core.util.ProgressMeter progressMeter)
Description copied from interface: SpaceManager
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.

Specified by:
removeSpace in interface SpaceManager
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.

removeSpacesInGroup

public void removeSpacesInGroup(SpaceGroup spaceGroup)
Specified by:
removeSpacesInGroup in interface SpaceManager

saveSpace

public void saveSpace(Space space)
Specified by:
saveSpace in interface SpaceManager

saveSpace

public void saveSpace(Space space,
                      Space originalSpace)
Specified by:
saveSpace in interface SpaceManager

getAllSpaces

public List<Space> getAllSpaces()
Description copied from interface: SpaceManager
Finds all spaces in Confluence, of any type, sorted alphabetically by space name.

Specified by:
getAllSpaces in interface SpaceManager
Returns:
List of spaces

getSpacesByType

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

Specified by:
getSpacesByType in interface SpaceManager

getSpacesInSpaceGroup

@Deprecated
public List<Space> getSpacesInSpaceGroup(SpaceGroup spaceGroup)
Deprecated. since 3.1. Space groups are no longer a feature of Confluence

Specified by:
getSpacesInSpaceGroup in interface SpaceManager

getPermittedSpaces

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

Description copied from interface: SpaceManager
Return all spaces for which the the user has VIEW permission.

Specified by:
getPermittedSpaces in interface SpaceManager
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
public List<Space> getPermittedSpacesByType(com.atlassian.user.User user,
                                                       SpaceType type)
Deprecated. since 3.1 use getSpaces(SpacesQuery) instead

Description copied from interface: SpaceManager
Return all spaces of a given type for which the user has VIEW permission.

Specified by:
getPermittedSpacesByType in interface SpaceManager
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
public List getPermittedSpacesInSpaceGroup(com.atlassian.user.User user,
                                                      SpaceGroup spaceGroup)
Deprecated. since 3.1 use getSpaces(SpacesQuery) instead

Description copied from interface: SpaceManager
Return all spaces within a given spaceGroup for which the user has VIEW permission

Specified by:
getPermittedSpacesInSpaceGroup in interface SpaceManager
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

getEditableSpacesByType

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

Description copied from interface: SpaceManager
Return all spaces of a given type in which the user can create or edit pages

Specified by:
getEditableSpacesByType in interface SpaceManager
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

getSpacesEditableByUser

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

Description copied from interface: SpaceManager
Return all spaces in which the user can create or edit pages.

Specified by:
getSpacesEditableByUser in interface SpaceManager
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

getAuthoredSpacesByUser

public List getAuthoredSpacesByUser(String username)
Specified by:
getAuthoredSpacesByUser in interface SpaceManager

getSpacesContainingPagesEditedBy

public List getSpacesContainingPagesEditedBy(String username)
Description copied from interface: SpaceManager
Returns Pages that are either created or edited by the specified user

Specified by:
getSpacesContainingPagesEditedBy in interface SpaceManager
Parameters:
username - a username
Returns:
Pages that are either created or edited by the specified user

getSpacesContainingCommentsBy

public List getSpacesContainingCommentsBy(String username)
Specified by:
getSpacesContainingCommentsBy in interface SpaceManager

createSpace

public Space createSpace(String key,
                         String name,
                         String description,
                         com.atlassian.user.User creator)
Specified by:
createSpace in interface SpaceManager

createPrivateSpace

public Space createPrivateSpace(String key,
                                String name,
                                String description,
                                com.atlassian.user.User creator)
Description copied from interface: SpaceManager
Creates a Space for which only the creator has any permissions

Specified by:
createPrivateSpace in interface SpaceManager
Returns:

createPersonalSpace

public Space createPersonalSpace(String name,
                                 String description,
                                 com.atlassian.user.User owner)
Description copied from interface: SpaceManager
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.

Specified by:
createPersonalSpace in interface SpaceManager
Returns:
the created space

createPrivatePersonalSpace

public Space createPrivatePersonalSpace(String name,
                                        String description,
                                        com.atlassian.user.User owner)
Description copied from interface: SpaceManager
Create a personal Space for which only the creator has any permissions

Specified by:
createPrivatePersonalSpace in interface SpaceManager
Returns:

createSpace

public Space createSpace(Space space)
Deprecated since 4.3. Use {#link createSpace(String key, String name, String description, User creator)} instead

Specified by:
createSpace in interface SpaceManager
Parameters:
space - the space to create
Returns:
the newly created space

getPersonalSpace

public Space getPersonalSpace(com.atlassian.user.User user)
Description copied from interface: SpaceManager
Get the personal space of the given user. This method may be more convenient than SpaceManager.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()).

Specified by:
getPersonalSpace in interface SpaceManager
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.

findPageTotal

public long findPageTotal(Space space)
Description copied from interface: SpaceManager
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.

Specified by:
findPageTotal in interface SpaceManager
Parameters:
space - the space to count pages in
Returns:
the number of pages in that space

setEventPublisher

public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)

getNumberOfBlogPosts

public int getNumberOfBlogPosts(Space space)
Description copied from interface: SpaceManager
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.

Specified by:
getNumberOfBlogPosts in interface SpaceManager
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)
Description copied from interface: SpaceManager
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.

Specified by:
getNumberOfMail in interface SpaceManager
Parameters:
space - the space to count mail in
Returns:
the number of emails archived in the space

getSpaceFromPageId

public String getSpaceFromPageId(long pageId)
Description copied from interface: SpaceManager
Get the key for a space from its pageId in a single db call

Specified by:
getSpaceFromPageId in interface SpaceManager
Parameters:
pageId - the id of the page to look for
Returns:
the key for the space containing the given page

ensureSpaceDescriptionExists

public void ensureSpaceDescriptionExists(Space space)
Description copied from interface: SpaceManager
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.

Specified by:
ensureSpaceDescriptionExists in interface SpaceManager
Parameters:
space - an existing space. Not null.

getSpacesCreatedAfter

public List<Space> getSpacesCreatedAfter(Date creationDate)
Specified by:
getSpacesCreatedAfter in interface SpaceManager

setNotificationManager

public void setNotificationManager(NotificationManager notificationManager)

setLabelManager

public void setLabelManager(LabelManager labelManager)

getPersonalSpaceKey

public String getPersonalSpaceKey(String username)
Specified by:
getPersonalSpaceKey in interface SpaceManager

setIndexManager

public void setIndexManager(ConfluenceIndexManager indexManager)

getAttachmentManager

@Deprecated
public AttachmentManager getAttachmentManager()
Deprecated. since 4.2.13. Get AttachmentManager injected directly to your objects instead.


setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)

getSettingsManager

@Deprecated
public SettingsManager getSettingsManager()
Deprecated. since 4.2.13. Get SettingsManager injected directly to your objects instead.


setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

setI18NBeanFactory

public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)

getLogoForSpace

public SpaceLogo getLogoForSpace(String spaceKey)
Specified by:
getLogoForSpace in interface SpaceManager

getLogoForGlobalcontext

public SpaceLogo getLogoForGlobalcontext()
Specified by:
getLogoForGlobalcontext in interface SpaceManager

getSpaces

public ListBuilder<Space> getSpaces(SpacesQuery query)
Description copied from interface: SpaceManager
Get a list of spaces specified by the SpacesQuery limited by the offset and maxResults.

Specified by:
getSpaces in interface SpaceManager

getAllSpaces

public List<Space> getAllSpaces(SpacesQuery query)
Description copied from interface: SpaceManager
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 SpaceManager.getSpaces(SpacesQuery) to retrieve pages of results instead.

Specified by:
getAllSpaces in interface SpaceManager

getSpaceAdmins

public List<com.atlassian.user.User> getSpaceAdmins(Space space)
Description copied from interface: SpaceManager
Returns a list of administrators for a given space, sorted by full name

Specified by:
getSpaceAdmins in interface SpaceManager

getSpaceAdmins

public List<com.atlassian.user.User> getSpaceAdmins(Space space,
                                                    int limit)
Description copied from interface: SpaceManager
Returns a list of administrators for a given space, sorted by full name, up to the size limit

Specified by:
getSpaceAdmins in interface SpaceManager

archiveSpace

public void archiveSpace(Space space)
Description copied from interface: SpaceManager
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.

Specified by:
archiveSpace in interface SpaceManager
Parameters:
space - the space to archive.

unarchiveSpace

public void unarchiveSpace(Space space)
Description copied from interface: SpaceManager
Un-archive the space. If the space is already un-archived, this method does nothing.

Specified by:
unarchiveSpace in interface SpaceManager
Parameters:
space - the space to archive.

getAllSpaceKeys

public Collection<String> getAllSpaceKeys(SpaceStatus status)
Description copied from interface: SpaceManager
Get the space keys of all spaces with the given status.

Specified by:
getAllSpaceKeys in interface SpaceManager
Parameters:
status - the status to search for
Returns:
the keys of all spaces with that status.


Copyright © 2003-2013 Atlassian. All Rights Reserved.