Package com.atlassian.confluence.pages
Class DefaultTrashManager
java.lang.Object
com.atlassian.confluence.pages.DefaultTrashManager
- All Implemented Interfaces:
TrashManagerInternal,TrashManager
This class provides utility methods for operating on the Trash
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTrashManager(ContentEntityObjectDaoInternal contentEntityObjectDao, ContentEntityManager contentEntityManager, CustomContentManager customContentManager, org.springframework.transaction.PlatformTransactionManager transactionManager, PageManager pageManager, com.atlassian.event.api.EventPublisher eventPublisher, AttachmentManager attachmentManager, BandanaManagerInternal bandanaManager, PaginationService paginationService) -
Method Summary
Modifier and TypeMethodDescriptionvoidemptyTrash(Space space) Purge all of the trash in a given space.findTrashDate(Content content) Trash date is only available since Confluence 7.14.Trash date is only available since Confluence 7.14.intgetNumberOfItemsInTrash(Space space) Retrieve the total number of items in the trash for a given space.getTrashContents(Space space, int offset, int count) Retrieve a subset of the contents of the trash for a particular space.getTrashContents(String spaceKey, LimitedRequest request) Retrieve a subset of the contents of the trash for a particular space.All items that have been added to the trash before Confluence 7.14 don't have actual trash date.getTrashedEntities(long contentIdOffset, int limit) Fetch a batch of trashed content entitiesvoidmigrateTrashDate(String spaceKey, Instant trashTime) Add trash date to existing items in the trash for a spacevoidmigrateTrashDate(Instant trashTime) Add trash date to all existing items in the trashvoidonSpaceRemoval(SpaceRemoveEvent event) booleanRemove one item from the trash.voidpurge(List<SpaceContentEntityObject> trashEntities) Delete a list of trashed entities
-
Constructor Details
-
DefaultTrashManager
public DefaultTrashManager(ContentEntityObjectDaoInternal contentEntityObjectDao, ContentEntityManager contentEntityManager, CustomContentManager customContentManager, org.springframework.transaction.PlatformTransactionManager transactionManager, PageManager pageManager, com.atlassian.event.api.EventPublisher eventPublisher, AttachmentManager attachmentManager, BandanaManagerInternal bandanaManager, PaginationService paginationService)
-
-
Method Details
-
emptyTrash
Description copied from interface:TrashManagerPurge all of the trash in a given space.- Specified by:
emptyTrashin interfaceTrashManager- Parameters:
space-
-
getNumberOfItemsInTrash
Description copied from interface:TrashManagerRetrieve the total number of items in the trash for a given space.- Specified by:
getNumberOfItemsInTrashin interfaceTrashManager- Parameters:
space- @return the number of items in the trash for that space
-
purge
Description copied from interface:TrashManagerRemove one item from the trash. If no content exists with the given ID, nothing will be done. If the content exists but is not in the trash, or does not belong to the correct space, an exception will be thrown- Specified by:
purgein interfaceTrashManager- Parameters:
spaceKey- the space to purge the trash fromcontentId- the id of the item to remove from the trash @return true if content was purged, false if no content was found with that ID- Returns:
- true if content was purged, false if no matching content was found
-
getTrashContents
Description copied from interface:TrashManagerRetrieve a subset of the contents of the trash for a particular space.- Specified by:
getTrashContentsin interfaceTrashManager- Parameters:
space-offset- the offset of the first item to retrieve (0-based)count- the maximum number of items to retrieve- Returns:
- the contents of the trash, up to the maximum number provided
-
getTrashContents
Description copied from interface:TrashManagerRetrieve a subset of the contents of the trash for a particular space.- Specified by:
getTrashContentsin interfaceTrashManager- Parameters:
spaceKey- the key of the space where the trash contents belong torequest- the pagination request, with a cursor which is an identifier to skip results from a previous query when paginating and limit for the result- Returns:
- the contents of the trash, up to the request limit
-
migrateTrashDate
Description copied from interface:TrashManagerInternalAdd trash date to all existing items in the trash- Specified by:
migrateTrashDatein interfaceTrashManagerInternal- Parameters:
trashTime- timestamp to use as trash date
-
migrateTrashDate
Description copied from interface:TrashManagerInternalAdd trash date to existing items in the trash for a space- Specified by:
migrateTrashDatein interfaceTrashManagerInternal- Parameters:
spaceKey- key of the space to apply trash datetrashTime- timestamp to use as trash date
-
onSpaceRemoval
-
getTrashDateMigrationTime
Description copied from interface:TrashManagerAll items that have been added to the trash before Confluence 7.14 don't have actual trash date. For the purpose of retention rules, trash date of these items default to time when the concept of trash date is first introduced to this instance ie. the first time this instance is upgraded to Confluence 7.14 or later.- Specified by:
getTrashDateMigrationTimein interfaceTrashManager- Returns:
- default trash date for items added to the trash before Confluence 7.14 or
Optional.empty()if this instance is freshly installed with Confluence 7.14 or later.
-
findTrashDate
Description copied from interface:TrashManagerInternalTrash date is only available since Confluence 7.14. The rules to determine effective trash date for a content entity in general is: 1. If it is not in trash, trash date will beOptional.empty()2. If it has a contentproperty namedtrash-date, trash date will betrash-date3. If it belongs to a space which has a trash-date set in bandana, trash date will be that value 4. If there is a global trash-date set in bandana, trash date will be that value 5. Otherwise, trash date will beOptional.empty()- Specified by:
findTrashDatein interfaceTrashManagerInternal- Parameters:
ceo- a content entity object to determine trash date- Returns:
- when
ceowas added to the trash if that data is available
-
findTrashDate
Description copied from interface:TrashManagerInternalTrash date is only available since Confluence 7.14. The rules to determine effective trash date for a content entity in general is: 1. If it is not in trash, trash date will beOptional.empty()2. If it has a contentproperty namedtrash-date, trash date will betrash-date3. If it belongs to a space which has a trash-date set in bandana, trash date will be that value 4. If there is a global trash-date set in bandana, trash date will be that value 5. Otherwise, trash date will beOptional.empty()- Specified by:
findTrashDatein interfaceTrashManagerInternal- Parameters:
content- a com.atlassian.confluence.api.model.content.Content to determine trash date- Returns:
- when
contentwas added to the trash if that data is available
-
getTrashedEntities
Description copied from interface:TrashManagerInternalFetch a batch of trashed content entities- Specified by:
getTrashedEntitiesin interfaceTrashManagerInternal- Parameters:
contentIdOffset- ids of returned entities must be greater than or equal to this valuelimit- maximum number of entities to return
-
purge
Description copied from interface:TrashManagerInternalDelete a list of trashed entities- Specified by:
purgein interfaceTrashManagerInternal- Parameters:
trashEntities- trashed entities to be deleted from trash
-