Class SpaceServiceImpl
java.lang.Object
com.atlassian.confluence.api.impl.service.content.SpaceServiceImpl
- All Implemented Interfaces:
SpaceService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
class
Nested classes/interfaces inherited from interface com.atlassian.confluence.api.service.content.SpaceService
SpaceService.SingleSpaceFetcher, SpaceService.SpaceContentFinder, SpaceService.SpaceFinder, SpaceService.Validator
-
Constructor Summary
ConstructorsConstructorDescriptionSpaceServiceImpl
(SpaceManagerInternal spaceManager, SpaceFactory spaceFactory, PageManagerInternal pageManager, ContentFactory contentFactory, PaginationService paginationService, PermissionManager permissionManager, ContentService contentService, SpacePermissionManager spacePermissionManager, LongRunningTaskManager longRunningTaskManager, LongTaskFactory longTaskFactory, I18NBeanFactory i18NBeanFactory, FinderProxyFactory finderProxyFactory, LabelManager labelManager, UserChecker userChecker, AccessModeService accessModeService, LicenseService licenseService, SpaceDeletionManager spaceDeletionManager, PermissionCheckExemptions permissionCheckExemptions, SpaceLabelService spaceLabelService, SpaceService.Validator spaceValidator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Archives a space.Create a new space.void
delete
(long spaceId) Deletes space.Delete the given space.void
deleteSynchronously
(long spaceId) Deletes space synchronously.Create a space finder to locate spaces, the expansions will be applied to each Space matching the restrictions on the finder.findAllContentLabelsPaginated
(String spaceKey, PageRequest pageRequest) Returns a paginated list of all Labels used by Content within the given Space.findContent
(Space space, Expansion... expansions) A finder to locate content in the spacefindPopularContentLabelsPaginated
(String spaceKey, PageRequest pageRequest) Returns a paginated list of the most popular Labels used by Content within the given Space.findRecentContentLabelsPaginated
(String spaceKey, PageRequest pageRequest) Returns a paginated list of the most recent Labels used by Content within the given Space.findRelatedContentLabelsPaginated
(String spaceKey, String labelName, PageRequest pageRequest) Returns a paginated list of related Labels used by Content within the given Space.void
Un-archives a space.Updates a space.Get the validator view of the Space Service.
-
Constructor Details
-
SpaceServiceImpl
public SpaceServiceImpl(SpaceManagerInternal spaceManager, SpaceFactory spaceFactory, PageManagerInternal pageManager, ContentFactory contentFactory, PaginationService paginationService, PermissionManager permissionManager, ContentService contentService, SpacePermissionManager spacePermissionManager, LongRunningTaskManager longRunningTaskManager, LongTaskFactory longTaskFactory, I18NBeanFactory i18NBeanFactory, FinderProxyFactory finderProxyFactory, LabelManager labelManager, UserChecker userChecker, AccessModeService accessModeService, LicenseService licenseService, SpaceDeletionManager spaceDeletionManager, PermissionCheckExemptions permissionCheckExemptions, SpaceLabelService spaceLabelService, SpaceService.Validator spaceValidator)
-
-
Method Details
-
create
Description copied from interface:SpaceService
Create a new space.If the "isPrivate" flag is set to true the new space will only be visible to the creator.
Minimum properties to be valid is a key and name.
- Specified by:
create
in interfaceSpaceService
- Parameters:
space
- the space to createisPrivate
- whether the space is private (true) or has default permissions (false)- Returns:
- the space created
- Throws:
ServiceException
- if the space cannot be created
-
delete
Description copied from interface:SpaceService
Delete the given space.The deletion happens asynchronously so a LongTaskStatus is returned, that can be used to track progress.
- Specified by:
delete
in interfaceSpaceService
- Parameters:
spaceToDelete
- the space to delete- Returns:
- a LongTaskStatus describing the space-removal operation
- Throws:
NotFoundException
- if the space does not exist or you do not have permission to view itPermissionException
- if you do not have permission to delete the spaceServiceException
-
delete
Deletes space. It removes space permissions and rename the space key, so the space key can be re-used immediately. Alter that, all remaining space content will be removed in background. Neither instance restart nor problems with the database will not prevent data deletion. It will not leave partial data in the database.- Specified by:
delete
in interfaceSpaceService
- Parameters:
spaceId
- space id- Throws:
NotFoundException
- if the space does not exist or you do not have permission to view itPermissionException
- if you do not have permission to delete the spaceServiceException
-
deleteSynchronously
Deletes space synchronously. It is NOT RECOMMENDED to use in production code, this method should be used in tests to remove space data quickly. Using regular space deletion is not recommended in tests because while one test is being running, data from the previous test could be still being deleted. It could be a source of flakiness. Instance restart will interrupt the process, so some space content can remain in the database.- Specified by:
deleteSynchronously
in interfaceSpaceService
- Parameters:
spaceId
- space id- Throws:
NotFoundException
- if the space does not exist or you do not have permission to view itPermissionException
- if you do not have permission to delete the spaceServiceException
-
find
Description copied from interface:SpaceService
Create a space finder to locate spaces, the expansions will be applied to each Space matching the restrictions on the finder. Restrictions can be applied to the finder using the appropriate withFoo() methodFor example:
spaceService.find() .withKeys("DEV","PROD") .fetchMany(new SimplePageRequest(0, 10);
- Specified by:
find
in interfaceSpaceService
- Parameters:
expansions
- - the expansion to apply to each fetched space- Returns:
- a new SpaceFinder
-
findAllContentLabelsPaginated
Description copied from interface:SpaceService
Returns a paginated list of all Labels used by Content within the given Space.- Specified by:
findAllContentLabelsPaginated
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the Space the User is attempting to search.pageRequest
- the pagination parameters.- Returns:
- Paginated list of labels.
-
findPopularContentLabelsPaginated
public PageResponse<Label> findPopularContentLabelsPaginated(String spaceKey, PageRequest pageRequest) Description copied from interface:SpaceService
Returns a paginated list of the most popular Labels used by Content within the given Space.- Specified by:
findPopularContentLabelsPaginated
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the Space the User is attempting to search.pageRequest
- the pagination parameters.- Returns:
- Paginated list of labels.
-
findRecentContentLabelsPaginated
public PageResponse<Label> findRecentContentLabelsPaginated(String spaceKey, PageRequest pageRequest) Description copied from interface:SpaceService
Returns a paginated list of the most recent Labels used by Content within the given Space.- Specified by:
findRecentContentLabelsPaginated
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the Space the User is attempting to search.pageRequest
- the pagination parameters.- Returns:
- Paginated list of labels.
-
findRelatedContentLabelsPaginated
public PageResponse<Label> findRelatedContentLabelsPaginated(String spaceKey, String labelName, PageRequest pageRequest) Description copied from interface:SpaceService
Returns a paginated list of related Labels used by Content within the given Space. A Label is defined as being related to another when it is found attached to the same Content as the Label specified in the request.- Specified by:
findRelatedContentLabelsPaginated
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the Space the User is attempting to search.labelName
- the Label to match on.pageRequest
- the pagination parameters.- Returns:
- Paginated list of labels.
-
archive
Description copied from interface:SpaceService
Archives a space. If the space is already archived, this method does nothing.- Specified by:
archive
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the space to archive
-
restore
Description copied from interface:SpaceService
Un-archives a space. If the space is already unarchived, this method does nothing.- Specified by:
restore
in interfaceSpaceService
- Parameters:
spaceKey
- the key of the space to restore
-
update
Description copied from interface:SpaceService
Updates a space.Currently limited to changing the space name, description and homepage.
- Specified by:
update
in interfaceSpaceService
- Parameters:
space
- the updatedSpace
- Returns:
- the updated space after being persisted
- Throws:
ServiceException
-
findContent
public SpaceService.SpaceContentFinder findContent(Space space, Expansion... expansions) throws NotFoundException Description copied from interface:SpaceService
A finder to locate content in the space- Specified by:
findContent
in interfaceSpaceService
- Returns:
- a finder
- Throws:
NotFoundException
- if the space does not exist or you do not have permission to view it
-
validator
Description copied from interface:SpaceService
Get the validator view of the Space Service.- Specified by:
validator
in interfaceSpaceService
-