Class DefaultSpaceManager
- All Implemented Interfaces:
SpaceManagerInternal
,SpaceManager
-
Field Summary
Fields inherited from interface com.atlassian.confluence.spaces.SpaceManager
GLOBAL_LOGO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveSpace
(Space space) Archive the space.@NonNull Space
createPersonalSpace
(String name, @Nullable String description, com.atlassian.user.User owner) Creates a personal space.@NonNull Space
createPrivatePersonalSpace
(String name, @Nullable String description, com.atlassian.user.User owner) Create a personal Space for which only the creator has any permissions@NonNull Space
createPrivateSpace
(String key, String name, @Nullable String description, com.atlassian.user.User creator) Creates a Space for which only the creator has any permissions@NonNull Space
createSpace
(Space space) Deprecated.since 4.3.@NonNull Space
createSpace
(String key, String name, @Nullable String description, com.atlassian.user.User creator) void
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.@NonNull Collection<String>
getAllSpaceKeys
(SpaceStatus status) Get the space keys of all spaces with the given status.Finds all spaces in Confluence, of any type, sorted alphabetically by space name.getAllSpaces
(SpacesQuery query) Get a list of spaces specified by theSpacesQuery
.@NonNull List
com.atlassian.beehive.ClusterLockService
@NonNull SpaceLogo
@NonNull SpaceLogo
getLogoForSpace
(@Nullable String spaceKey) int
getNumberOfBlogPosts
(Space space) Get the number of blog posts in a space.@Nullable Space
getPersonalSpace
(@Nullable ConfluenceUser user) Get the personal space of the given user.getSpace
(long id) Retrieve a space by its ID.@Nullable Space
Retrieve a space by its key.@NonNull List<com.atlassian.user.User>
getSpaceAdmins
(Space space) Returns a list of administrators for a given space, sorted by full name@NonNull 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@Nullable String
getSpaceFromPageId
(long pageId) Get the key for a space from its pageId in a single db call@NonNull ListBuilder<Space>
getSpaces
(SpacesQuery query) Get a list of spaces specified by theSpacesQuery
limited by the offset and maxResults.final @NonNull PageResponse<Space>
getSpaces
(SpacesQuery query, LimitedRequest limitedRequest, Predicate<? super Space>... filter) get a paginated list of spaces that match the spaceQuery, filtered by the given predicate@NonNull List
@NonNull List
ReturnsPage
s that are either created or edited by the specified usergetSpacesCreatedAfter
(Date creationDate) @NonNull Boolean
removeSpace
(Space space) Removes a space with a given space.removeSpace
(String spaceKey) Removes a space with a given spaceKey (case sensitive).@NonNull Boolean
removeSpace
(String spaceKey, com.atlassian.core.util.ProgressMeter progressMeter) Removes a space with a given spaceKey (case sensitive).void
removeSpacesInGroup
(SpaceGroup spaceGroup) void
void
void
setAccessModeManager
(AccessModeManager accessModeManager) void
setAttachmentManager
(AttachmentManager attachmentManager) void
setBandanaPersister
(com.atlassian.bandana.BandanaPersister bandanaPersister) void
setBulkPermissionService
(BulkPermissionService bulkPermissionService) void
setClusterLockService
(com.atlassian.beehive.ClusterLockService clusterLockService) void
setDenormalisedPermissionDarkFeature
(DenormalisedPermissionDarkFeature denormalisedPermissionDarkFeature) void
setEventPublisher
(com.atlassian.event.api.EventPublisher eventPublisher) void
setGroupManager
(com.atlassian.user.GroupManager groupManager) void
setHibernateSessionManager
(HibernateSessionManager5 hibernateSessionManager) void
setI18NBeanFactory
(I18NBeanFactory i18NBeanFactory) void
setIndexer
(ConfluenceIndexer indexer) Deprecated.since 7.5 indexing now peformed via eventsvoid
setLabelManager
(LabelManager labelManager) void
setNotificationManager
(NotificationManager notificationManager) void
setPageManager
(PageManager pageManager) void
setPageTemplateManager
(PageTemplateManager pageTemplateManager) void
setPermissionCheckExemptions
(PermissionCheckExemptions permissionCheckExemptions) void
setSettingsManager
(SettingsManager settingsManager) void
setSpaceDao
(SpaceDaoInternal spaceDao) void
setSpaceDescriptionManager
(SpaceDescriptionManager spaceDescriptionManager) void
setSpacePermissionManager
(SpacePermissionManagerInternal spacePermissionManager) void
setSpacePermissionQueryManager
(SpacePermissionQueryManager spacePermissionQueryManager) void
setUserAccessor
(UserAccessor userAccessor) @NonNull io.atlassian.fugue.Either<AccessDenied,
SpacesQueryWithPermissionQueryBuilder> toSpacesQueryWithPermissionQueryBuilder
(SpacesQuery spacesQuery) Converts aSpacesQuery
into a decorated formSpacesQueryWithPermissionQueryBuilder
that includes information about how database queries should be built for the space permissions table.void
unarchiveSpace
(Space space) Un-archive the space.
-
Constructor Details
-
DefaultSpaceManager
public DefaultSpaceManager()
-
-
Method Details
-
getClusterLockService
public com.atlassian.beehive.ClusterLockService getClusterLockService() -
setClusterLockService
public void setClusterLockService(com.atlassian.beehive.ClusterLockService clusterLockService) -
setHibernateSessionManager
-
setPageManager
-
setPageTemplateManager
-
setBandanaPersister
public void setBandanaPersister(com.atlassian.bandana.BandanaPersister bandanaPersister) -
setSpaceDao
-
setSpaceDescriptionManager
-
setSpacePermissionManager
-
setSpacePermissionQueryManager
-
getSpace
Description copied from interface:SpaceManager
Retrieve a space by its ID. The space can be of any type.- Specified by:
getSpace
in interfaceSpaceManager
- Parameters:
id
- the ID of the space- Returns:
- the space, or null if no space exists with that id.
-
getSpace
Description copied from interface:SpaceManager
Retrieve a space by its key. The space can be of any type.- Specified by:
getSpace
in interfaceSpaceManager
- Parameters:
spaceKey
- the space key of the space to retrieve- Returns:
- the space, or null if no space exists with that key
-
setIndexer
Deprecated.since 7.5 indexing now peformed via events -
setUserAccessor
-
setGroupManager
public void setGroupManager(com.atlassian.user.GroupManager groupManager) -
setPermissionCheckExemptions
-
removeSpace
Description copied from interface:SpaceManager
Removes a space with a given space.Delegates to
SpaceManager.removeSpace(String, com.atlassian.core.util.ProgressMeter)
.- Specified by:
removeSpace
in interfaceSpaceManager
- Parameters:
space
- the key of the space to remove- Returns:
- true if the space was successfully removed.
-
removeSpace
public @NonNull 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 and it clears the current Hibernate session.- Specified by:
removeSpace
in interfaceSpaceManager
- Parameters:
spaceKey
- the key of the space to removeprogressMeter
- will be updated with status messages and percentage completed. Not Null.- Returns:
- true if the space was successfully removed.
-
removeSpacesInGroup
- Specified by:
removeSpacesInGroup
in interfaceSpaceManager
-
saveSpace
- Specified by:
saveSpace
in interfaceSpaceManager
-
saveSpace
- Specified by:
saveSpace
in interfaceSpaceManager
-
getAllSpaces
Description copied from interface:SpaceManager
Finds all spaces in Confluence, of any type, sorted alphabetically by space name.- Specified by:
getAllSpaces
in interfaceSpaceManager
- Returns:
- List of spaces
-
getAuthoredSpacesByUser
- Specified by:
getAuthoredSpacesByUser
in interfaceSpaceManager
-
getSpacesContainingPagesEditedBy
Description copied from interface:SpaceManager
ReturnsPage
s that are either created or edited by the specified user- Specified by:
getSpacesContainingPagesEditedBy
in interfaceSpaceManager
- Returns:
Page
s that are either created or edited by the specified user
-
getSpacesContainingCommentsBy
- Specified by:
getSpacesContainingCommentsBy
in interfaceSpaceManager
-
createSpace
public @NonNull Space createSpace(String key, String name, @Nullable String description, com.atlassian.user.User creator) - Specified by:
createSpace
in interfaceSpaceManager
-
createPrivateSpace
public @NonNull Space createPrivateSpace(String key, String name, @Nullable 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 interfaceSpaceManager
-
createPersonalSpace
public @NonNull Space createPersonalSpace(String name, @Nullable 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 interfaceSpaceManager
-
createPrivatePersonalSpace
public @NonNull Space createPrivatePersonalSpace(String name, @Nullable 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 interfaceSpaceManager
-
createSpace
Deprecated.since 4.3. Use {#link #createSpace(String key, String name, String description, User creator)} instead- Specified by:
createSpace
in interfaceSpaceManager
- Parameters:
space
- the space to create- Returns:
- the newly created space
-
getPersonalSpace
Description copied from interface:SpaceManager
Get the personal space of the given user.- Specified by:
getPersonalSpace
in interfaceSpaceManager
- 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
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 interfaceSpaceManager
- 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
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 interfaceSpaceManager
- Parameters:
space
- the space to count pages in- Returns:
- the number of blog posts (news items) in that space
-
getSpaceFromPageId
Description copied from interface:SpaceManager
Get the key for a space from its pageId in a single db call- Specified by:
getSpaceFromPageId
in interfaceSpaceManager
- Parameters:
pageId
- the id of the page to look for- Returns:
- the key for the space containing the given page
-
ensureSpaceDescriptionExists
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 interfaceSpaceManager
- Parameters:
space
- an existing space. Not null.
-
getSpacesCreatedAfter
- Specified by:
getSpacesCreatedAfter
in interfaceSpaceManager
-
setNotificationManager
-
setLabelManager
-
setAttachmentManager
-
setSettingsManager
-
setI18NBeanFactory
-
getLogoForSpace
- Specified by:
getLogoForSpace
in interfaceSpaceManager
-
getLogoForGlobalcontext
- Specified by:
getLogoForGlobalcontext
in interfaceSpaceManager
-
getSpaces
Description copied from interface:SpaceManager
Get a list of spaces specified by theSpacesQuery
limited by the offset and maxResults.- Specified by:
getSpaces
in interfaceSpaceManager
-
getSpaces
@SafeVarargs public final @NonNull PageResponse<Space> getSpaces(SpacesQuery query, LimitedRequest limitedRequest, Predicate<? super Space>... filter) Description copied from interface:SpaceManagerInternal
get a paginated list of spaces that match the spaceQuery, filtered by the given predicate- Specified by:
getSpaces
in interfaceSpaceManagerInternal
- Parameters:
query
- - the query to use to fetch the spaces from the databaseslimitedRequest
- - the pagination request limitfilter
- - the filter to apply to the requested spaces- Returns:
- a PageResponse of matching spaces
-
toSpacesQueryWithPermissionQueryBuilder
public @NonNull io.atlassian.fugue.Either<AccessDenied,SpacesQueryWithPermissionQueryBuilder> toSpacesQueryWithPermissionQueryBuilder(SpacesQuery spacesQuery) Description copied from interface:SpaceManagerInternal
Converts a
SpacesQuery
into a decorated formSpacesQueryWithPermissionQueryBuilder
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 thatSpaceDao
doesn't have to call out to the manager level to determine things like the user'sAccessStatus
, 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.- Specified by:
toSpacesQueryWithPermissionQueryBuilder
in interfaceSpaceManagerInternal
- Parameters:
spacesQuery
- the query to use to fetch the spaces from the databases- Returns:
- the
SpacesQuery
decorated into aSpacesQueryWithPermissionQueryBuilder
ORAccessDenied
if the user does not have Confluence access, or an invalid permission is being checked for the user.
-
getAllSpaces
Description copied from interface:SpaceManager
Get a list of spaces specified by theSpacesQuery
. Any code that calls this method is a potential performance problem. The method may be deprecated and removed in a future version of Confluence. UseSpaceManager.getSpaces(SpacesQuery)
to retrieve pages of results instead.- Specified by:
getAllSpaces
in interfaceSpaceManager
-
getSpaceAdmins
Description copied from interface:SpaceManager
Returns a list of administrators for a given space, sorted by full name- Specified by:
getSpaceAdmins
in interfaceSpaceManager
-
getSpaceAdmins
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 interfaceSpaceManager
-
setAccessModeManager
-
setBulkPermissionService
-
setDenormalisedPermissionDarkFeature
public void setDenormalisedPermissionDarkFeature(DenormalisedPermissionDarkFeature denormalisedPermissionDarkFeature) -
archiveSpace
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 interfaceSpaceManager
- Parameters:
space
- the space to archive.
-
unarchiveSpace
Description copied from interface:SpaceManager
Un-archive the space. If the space is already un-archived, this method does nothing.- Specified by:
unarchiveSpace
in interfaceSpaceManager
- Parameters:
space
- the space to archive.
-
getAllSpaceKeys
Description copied from interface:SpaceManager
Get the space keys of all spaces with the given status.- Specified by:
getAllSpaceKeys
in interfaceSpaceManager
- Parameters:
status
- the status to search for- Returns:
- the keys of all spaces with that status.
-
removeSpace
Description copied from interface:SpaceManager
Removes a space with a given spaceKey (case sensitive).Delegates to
SpaceManager.removeSpace(String, com.atlassian.core.util.ProgressMeter)
.- Specified by:
removeSpace
in interfaceSpaceManager
- Parameters:
spaceKey
- the key of the space to remove- Returns:
- true if the space was successfully removed.
-