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)
TrashManager
emptyTrash
in interface TrashManager
public int getNumberOfItemsInTrash(Space space)
TrashManager
getNumberOfItemsInTrash
in interface TrashManager
public boolean purge(String spaceKey, long contentId)
TrashManager
purge
in interface TrashManager
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 IDpublic List<ContentEntityObject> getTrashContents(Space space, int offset, int count)
TrashManager
getTrashContents
in interface TrashManager
offset
- the offset of the first item to retrieve (0-based)count
- the maximum number of items to retrievepublic void migrateTrashDate(Instant trashTime)
TrashManagerInternal
migrateTrashDate
in interface TrashManagerInternal
trashTime
- timestamp to use as trash datepublic void migrateTrashDate(String spaceKey, Instant trashTime)
TrashManagerInternal
migrateTrashDate
in interface TrashManagerInternal
spaceKey
- key of the space to apply trash datetrashTime
- timestamp to use as trash date@EventListener public void onSpaceRemoval(SpaceRemoveEvent event)
public Optional<Instant> getTrashDateMigrationTime()
TrashManager
getTrashDateMigrationTime
in interface TrashManager
Optional.empty()
if this instance is freshly installed with Confluence 7.14 or later.public Optional<Instant> findTrashDate(ContentEntityObject ceo)
TrashManagerInternal
Optional.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 TrashManagerInternal
ceo
- 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)
TrashManagerInternal
getTrashedEntities
in interface TrashManagerInternal
contentIdOffset
- ids of returned entities must be greater than or equal to this valuelimit
- maximum number of entities to returnpublic void purge(List<SpaceContentEntityObject> trashEntities)
TrashManagerInternal
purge
in interface TrashManagerInternal
trashEntities
- trashed entities to be deleted from trashCopyright © 2003–2023 Atlassian. All rights reserved.
View cookie preferences