public class DefaultTrashManager extends Object implements TrashManagerInternal
| Constructor and Description |
|---|
DefaultTrashManager(ContentEntityObjectDaoInternal<ContentEntityObject> contentEntityObjectDao,
ContentEntityManager contentEntityManager,
CustomContentManager customContentManager,
org.springframework.transaction.PlatformTransactionManager transactionManager,
PageManager pageManager,
com.atlassian.event.api.EventPublisher eventPublisher,
AttachmentManager attachmentManager,
com.atlassian.bandana.BandanaManager bandanaManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
emptyTrash(Space space)
Purge all of the trash in a given space.
|
Optional<Instant> |
findTrashDate(ContentEntityObject ceo)
Trash date is only available since Confluence 7.14.
|
int |
getNumberOfItemsInTrash(Space space)
Retrieve the total number of items in the trash for a given space.
|
List<ContentEntityObject> |
getTrashContents(Space space,
int offset,
int count)
Retrieve a subset of the contents of the trash for a particular space.
|
Optional<Instant> |
getTrashDateMigrationTime()
All items that have been added to the trash before Confluence 7.14 don't have actual trash date.
|
List<SpaceContentEntityObject> |
getTrashedEntities(long contentIdOffset,
int limit)
Fetch a batch of trashed content entities
|
void |
migrateTrashDate(Instant trashTime)
Add trash date to all existing items in the trash
|
void |
migrateTrashDate(String spaceKey,
Instant trashTime)
Add trash date to existing items in the trash for a space
|
void |
onShutdown() |
void |
onSpaceRemoval(SpaceRemoveEvent event) |
void |
onStart() |
void |
purge(List<SpaceContentEntityObject> trashEntities)
Delete a list of trashed entities
|
boolean |
purge(String spaceKey,
long contentId)
Remove one item from the trash.
|
public DefaultTrashManager(ContentEntityObjectDaoInternal<ContentEntityObject> contentEntityObjectDao, ContentEntityManager contentEntityManager, CustomContentManager customContentManager, org.springframework.transaction.PlatformTransactionManager transactionManager, PageManager pageManager, com.atlassian.event.api.EventPublisher eventPublisher, AttachmentManager attachmentManager, com.atlassian.bandana.BandanaManager bandanaManager)
@PostConstruct public void onStart()
@PreDestroy public void onShutdown()
public void emptyTrash(Space space)
TrashManageremptyTrash in interface TrashManagerpublic int getNumberOfItemsInTrash(Space space)
TrashManagergetNumberOfItemsInTrash in interface TrashManagerpublic boolean purge(String spaceKey, long contentId)
TrashManagerpurge in interface TrashManagerspaceKey - 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 IDpublic List<ContentEntityObject> getTrashContents(Space space, int offset, int count)
TrashManagergetTrashContents in interface TrashManageroffset - the offset of the first item to retrieve (0-based)count - the maximum number of items to retrievepublic void migrateTrashDate(Instant trashTime)
TrashManagerInternalmigrateTrashDate in interface TrashManagerInternaltrashTime - timestamp to use as trash datepublic void migrateTrashDate(String spaceKey, Instant trashTime)
TrashManagerInternalmigrateTrashDate in interface TrashManagerInternalspaceKey - key of the space to apply trash datetrashTime - timestamp to use as trash date@EventListener public void onSpaceRemoval(SpaceRemoveEvent event)
public Optional<Instant> getTrashDateMigrationTime()
TrashManagergetTrashDateMigrationTime in interface TrashManagerOptional.empty() if this instance is freshly installed with Confluence 7.14 or later.public Optional<Instant> findTrashDate(ContentEntityObject ceo)
TrashManagerInternalOptional.empty()
2. If it has a contentproperty named trash-date, trash date will be trash-date
3. 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 be Optional.empty()findTrashDate in interface TrashManagerInternalceo - a content entity object to determine trash dateceo was added to the trash if that data is availablepublic List<SpaceContentEntityObject> getTrashedEntities(long contentIdOffset, int limit)
TrashManagerInternalgetTrashedEntities in interface TrashManagerInternalcontentIdOffset - ids of returned entities must be greater than or equal to this valuelimit - maximum number of entities to returnpublic void purge(List<SpaceContentEntityObject> trashEntities)
TrashManagerInternalpurge in interface TrashManagerInternaltrashEntities - trashed entities to be deleted from trashCopyright © 2003–2022 Atlassian. All rights reserved.