@ParametersAreNonnullByDefault public class DefaultSpaceManager extends Object implements SpaceManagerInternal
GLOBAL_LOGO
Constructor and Description |
---|
DefaultSpaceManager() |
Modifier and Type | Method and Description |
---|---|
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. Use {#link #createSpace(String key, String name, String description, User creator)} instead
|
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) |
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.
|
Space |
getPersonalSpace(ConfluenceUser user)
Get the personal space of the given user.
|
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 spaceKey)
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. |
PageResponse<Space> |
getSpaces(SpacesQuery query,
LimitedRequest limitedRequest,
com.google.common.base.Predicate<? super Space>... filter)
get a paginated list of spaces that match the spaceQuery, filtered by the given predicate
|
List |
getSpacesContainingCommentsBy(String username) |
List |
getSpacesContainingPagesEditedBy(String username)
Returns
Page s that are either created or edited by the specified user |
List<Space> |
getSpacesCreatedAfter(Date creationDate) |
Boolean |
removeSpace(Space space)
Removes a space with a given spaceKey (case sensitive).
|
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)
Deprecated.
since 5.6. No longer used.
|
void |
setLabelManager(LabelManager labelManager) |
void |
setNotificationManager(NotificationManager notificationManager) |
void |
setPermissionCheckExemptions(PermissionCheckExemptions permissionCheckExemptions) |
void |
setSettingsManager(SettingsManager settingsManager) |
void |
setSpaceDao(SpaceDao spaceDao) |
void |
setSpaceDescriptionManager(SpaceDescriptionManager spaceDescriptionManager) |
void |
setSpacePermissionManager(SpacePermissionManagerInternal spacePermissionManager) |
void |
setSpacePermissionQueryManager(SpacePermissionQueryManager spacePermissionQueryManager) |
void |
setUserAccessor(UserAccessor userAccessor) |
com.atlassian.fugue.Either<AccessDenied,SpacesQueryWithPermissionQueryBuilder> |
toSpacesQueryWithPermissionQueryBuilder(SpacesQuery spacesQuery)
Converts a
SpacesQuery into a decorated form SpacesQueryWithPermissionQueryBuilder that includes
information about how database queries should be built for the space permissions table. |
void |
unarchiveSpace(Space space)
Un-archive the space.
|
public void setSpaceDao(SpaceDao spaceDao)
public void setSpaceDescriptionManager(SpaceDescriptionManager spaceDescriptionManager)
public void setSpacePermissionManager(SpacePermissionManagerInternal spacePermissionManager)
public void setSpacePermissionQueryManager(SpacePermissionQueryManager spacePermissionQueryManager)
public Space getSpace(long id)
SpaceManager
getSpace
in interface SpaceManager
id
- the ID of the space@Nullable public Space getSpace(@Nullable String spaceKey)
SpaceManager
getSpace
in interface SpaceManager
spaceKey
- the space key of the space to retrievepublic void setIndexer(ConfluenceIndexer indexer)
public void setUserAccessor(UserAccessor userAccessor)
public void setGroupManager(com.atlassian.user.GroupManager groupManager)
public void setPermissionCheckExemptions(PermissionCheckExemptions permissionCheckExemptions)
@Nonnull public Boolean removeSpace(Space space)
SpaceManager
Delegates to SpaceManager.removeSpace(String, com.atlassian.core.util.ProgressMeter)
.
removeSpace
in interface SpaceManager
space
- the key of the space to remove@Nonnull public Boolean removeSpace(String spaceKey, com.atlassian.core.util.ProgressMeter progressMeter)
SpaceManager
removeSpace
in interface SpaceManager
spaceKey
- the key of the space to removeprogressMeter
- will be updated with status messages and percentage completed. Not Null.public void removeSpacesInGroup(SpaceGroup spaceGroup)
removeSpacesInGroup
in interface SpaceManager
public void saveSpace(Space space)
saveSpace
in interface SpaceManager
public void saveSpace(Space space, Space originalSpace)
saveSpace
in interface SpaceManager
@Nonnull public List<Space> getAllSpaces()
SpaceManager
getAllSpaces
in interface SpaceManager
@Nonnull public List getAuthoredSpacesByUser(String username)
getAuthoredSpacesByUser
in interface SpaceManager
@Nonnull public List getSpacesContainingPagesEditedBy(String username)
SpaceManager
Page
s that are either created or edited by the specified usergetSpacesContainingPagesEditedBy
in interface SpaceManager
username
- a usernamePage
s that are either created or edited by the specified user@Nonnull public List getSpacesContainingCommentsBy(String username)
getSpacesContainingCommentsBy
in interface SpaceManager
@Nonnull public Space createSpace(String key, String name, @Nullable String description, com.atlassian.user.User creator)
createSpace
in interface SpaceManager
@Nonnull public Space createPrivateSpace(String key, String name, @Nullable String description, com.atlassian.user.User creator)
SpaceManager
createPrivateSpace
in interface SpaceManager
@Nonnull public Space createPersonalSpace(String name, @Nullable String description, com.atlassian.user.User owner)
SpaceManager
createPersonalSpace
in interface SpaceManager
@Nonnull public Space createPrivatePersonalSpace(String name, @Nullable String description, com.atlassian.user.User owner)
SpaceManager
createPrivatePersonalSpace
in interface SpaceManager
@Nonnull @Deprecated public Space createSpace(Space space)
createSpace
in interface SpaceManager
space
- the space to create@Nullable public String getPersonalSpaceKey(@Nullable String username)
getPersonalSpaceKey
in interface SpaceManager
@Nullable public Space getPersonalSpace(String username)
SpaceManager
getPersonalSpace
in interface SpaceManager
username
- the username of the user to get the personal space of@Nullable public Space getPersonalSpace(@Nullable com.atlassian.user.User user)
SpaceManager
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())
.getPersonalSpace
in interface SpaceManager
user
- the user to get the space for. If user is null, the method will return null@Nullable public Space getPersonalSpace(@Nullable ConfluenceUser user)
SpaceManager
getPersonalSpace
in interface SpaceManager
user
- the user to get the space for. If user is null, the method will return nullpublic long findPageTotal(Space space)
SpaceManager
findPageTotal
in interface SpaceManager
space
- the space to count pages inpublic void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
public int getNumberOfBlogPosts(Space space)
SpaceManager
getNumberOfBlogPosts
in interface SpaceManager
space
- the space to count pages inpublic int getNumberOfMail(Space space)
SpaceManager
getNumberOfMail
in interface SpaceManager
space
- the space to count mail in@Nullable public String getSpaceFromPageId(long pageId)
SpaceManager
getSpaceFromPageId
in interface SpaceManager
pageId
- the id of the page to look forpublic void ensureSpaceDescriptionExists(Space space)
SpaceManager
This is required for CONF-4080, because labels on a Space are attached to a Space Description.
ensureSpaceDescriptionExists
in interface SpaceManager
space
- an existing space. Not null.@Nonnull public List<Space> getSpacesCreatedAfter(Date creationDate)
getSpacesCreatedAfter
in interface SpaceManager
public void setNotificationManager(NotificationManager notificationManager)
public void setLabelManager(LabelManager labelManager)
@Deprecated public void setIndexManager(ConfluenceIndexManager indexManager)
@Deprecated public AttachmentManager getAttachmentManager()
public void setAttachmentManager(AttachmentManager attachmentManager)
@Deprecated public SettingsManager getSettingsManager()
public void setSettingsManager(SettingsManager settingsManager)
public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
@Nonnull public SpaceLogo getLogoForSpace(@Nullable String spaceKey)
getLogoForSpace
in interface SpaceManager
@Nonnull public SpaceLogo getLogoForGlobalcontext()
getLogoForGlobalcontext
in interface SpaceManager
@Nonnull public ListBuilder<Space> getSpaces(SpacesQuery query)
SpaceManager
SpacesQuery
limited by the offset and maxResults.getSpaces
in interface SpaceManager
@SafeVarargs @Nonnull public final PageResponse<Space> getSpaces(SpacesQuery query, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Space>... filter)
SpaceManagerInternal
getSpaces
in interface SpaceManagerInternal
query
- - the query to use to fetch the spaces from the databaseslimitedRequest
- - the pagination request limitfilter
- - the filter to apply to the requested spaces@Nonnull public com.atlassian.fugue.Either<AccessDenied,SpacesQueryWithPermissionQueryBuilder> toSpacesQueryWithPermissionQueryBuilder(SpacesQuery spacesQuery)
SpaceManagerInternal
Converts a SpacesQuery
into a decorated form SpacesQueryWithPermissionQueryBuilder
that includes
information about how database queries should be built for the space permissions table.
This extra information is passed down to the DAO level so that SpaceDao
doesn't have to call out to the
manager level to determine things like the user's AccessStatus
, or construct extremely complex queries to
join and figure out the user's Confluence access.
If no permission check is defined in the SpacesQuery
or the user is a super-user, then the returned
object excludes permission checking.
toSpacesQueryWithPermissionQueryBuilder
in interface SpaceManagerInternal
spacesQuery
- the query to use to fetch the spaces from the databasesSpacesQuery
decorated into a SpacesQueryWithPermissionQueryBuilder
OR
AccessDenied
if the user does not have Confluence access, or an invalid permission is being checked for
the user.@Nonnull public List<Space> getAllSpaces(SpacesQuery query)
SpaceManager
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.getAllSpaces
in interface SpaceManager
@Nonnull public List<com.atlassian.user.User> getSpaceAdmins(Space space)
SpaceManager
getSpaceAdmins
in interface SpaceManager
@Nonnull public List<com.atlassian.user.User> getSpaceAdmins(Space space, int limit)
SpaceManager
getSpaceAdmins
in interface SpaceManager
public void archiveSpace(Space space)
SpaceManager
archiveSpace
in interface SpaceManager
space
- the space to archive.public void unarchiveSpace(Space space)
SpaceManager
unarchiveSpace
in interface SpaceManager
space
- the space to archive.@Nonnull public Collection<String> getAllSpaceKeys(SpaceStatus status)
SpaceManager
getAllSpaceKeys
in interface SpaceManager
status
- the status to search forCopyright © 2003–2016 Atlassian. All rights reserved.