Class SpaceServiceImpl
java.lang.Object
com.atlassian.confluence.api.impl.service.content.SpaceServiceImpl
- All Implemented Interfaces:
SpaceService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassNested 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, SpacePermissionManager spacePermissionManager, LongRunningTaskManager longRunningTaskManager, LongTaskFactory longTaskFactory, I18NBeanFactory i18NBeanFactory, FinderProxyFactory finderProxyFactory, LabelManager labelManager, SpaceDeletionManager spaceDeletionManager, SpaceLabelService spaceLabelService, SpaceService.Validator spaceValidator, TrashManager trashManager, UserAccessor userAccessor) -
Method Summary
Modifier and TypeMethodDescriptionvoidArchives a space.Create a new space.createPersonalSpaceForSelf(PersonalSpaceDetailsForCreation spaceDetails) Create a personal space for self.createPersonalSpaceForUser(PersonalSpaceDetailsForCreation spaceDetails, String username) Create a personal space for a user by username.voiddelete(long spaceId) Deletes space.Delete the given space.voiddeleteSynchronously(long spaceId) Deletes space synchronously.voidemptyTrash(String spaceKey) Purge all the trash in a given space.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.voidUn-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, SpacePermissionManager spacePermissionManager, LongRunningTaskManager longRunningTaskManager, LongTaskFactory longTaskFactory, I18NBeanFactory i18NBeanFactory, FinderProxyFactory finderProxyFactory, LabelManager labelManager, SpaceDeletionManager spaceDeletionManager, SpaceLabelService spaceLabelService, SpaceService.Validator spaceValidator, TrashManager trashManager, UserAccessor userAccessor)
-
-
Method Details
-
create
Description copied from interface:SpaceServiceCreate 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:
createin 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
-
createPersonalSpaceForSelf
public Space createPersonalSpaceForSelf(PersonalSpaceDetailsForCreation spaceDetails) throws ServiceException Description copied from interface:SpaceServiceCreate a personal space for self.If the "isPrivate" flag is set to true the personal space will only be visible to the owner.
- Specified by:
createPersonalSpaceForSelfin interfaceSpaceService- Parameters:
spaceDetails- Details of a Personal Space to be created- Returns:
- the space created
- Throws:
ServiceException- if the space cannot be created
-
createPersonalSpaceForUser
public Space createPersonalSpaceForUser(PersonalSpaceDetailsForCreation spaceDetails, String username) throws ServiceException Description copied from interface:SpaceServiceCreate a personal space for a user by username.If the "isPrivate" flag is set to true the personal space will only be visible to the owner.
- Specified by:
createPersonalSpaceForUserin interfaceSpaceService- Parameters:
spaceDetails- Details of a Personal Space to be createdusername- Username of the user to create personal space for- Returns:
- the space created
- Throws:
ServiceException- if the space cannot be created
-
delete
Description copied from interface:SpaceServiceDelete the given space.The deletion happens asynchronously so a LongTaskStatus is returned, that can be used to track progress.
- Specified by:
deletein interfaceSpaceService- Parameters:
spaceToDelete- the space to delete- Returns:
- a LongTaskStatus describing the space-removal operation
- Throws:
ServiceException
-
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:
deletein interfaceSpaceService- Parameters:
spaceId- space id- Throws:
ServiceException
-
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:
deleteSynchronouslyin interfaceSpaceService- Parameters:
spaceId- space id- Throws:
ServiceException
-
find
Description copied from interface:SpaceServiceCreate 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:
findin interfaceSpaceService- Parameters:
expansions- - the expansion to apply to each fetched space- Returns:
- a new SpaceFinder
-
findAllContentLabelsPaginated
Description copied from interface:SpaceServiceReturns a paginated list of all Labels used by Content within the given Space.- Specified by:
findAllContentLabelsPaginatedin 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:SpaceServiceReturns a paginated list of the most popular Labels used by Content within the given Space.- Specified by:
findPopularContentLabelsPaginatedin 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:SpaceServiceReturns a paginated list of the most recent Labels used by Content within the given Space.- Specified by:
findRecentContentLabelsPaginatedin 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:SpaceServiceReturns 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:
findRelatedContentLabelsPaginatedin 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:SpaceServiceArchives a space. If the space is already archived, this method does nothing.- Specified by:
archivein interfaceSpaceService- Parameters:
spaceKey- the key of the space to archive
-
restore
Description copied from interface:SpaceServiceUn-archives a space. If the space is already unarchived, this method does nothing.- Specified by:
restorein interfaceSpaceService- Parameters:
spaceKey- the key of the space to restore
-
update
Description copied from interface:SpaceServiceUpdates a space.Currently limited to changing the space name, description and homepage.
- Specified by:
updatein 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:SpaceServiceA finder to locate content in the space- Specified by:
findContentin interfaceSpaceService- Returns:
- a finder
- Throws:
NotFoundException- if the space does not exist or you do not have permission to view it
-
emptyTrash
Description copied from interface:SpaceServicePurge all the trash in a given space.- Specified by:
emptyTrashin interfaceSpaceService- Parameters:
spaceKey- the key of the space to empty trash- Throws:
ServiceException
-
validator
Description copied from interface:SpaceServiceGet the validator view of the Space Service.- Specified by:
validatorin interfaceSpaceService
-