Class DefaultTrashManager

    • Method Detail

      • onStart

        @PostConstruct
        public void onStart()
      • onShutdown

        @PreDestroy
        public void onShutdown()
      • emptyTrash

        public void emptyTrash​(Space space)
        Description copied from interface: TrashManager
        Purge all of the trash in a given space.
        Specified by:
        emptyTrash in interface TrashManager
      • getNumberOfItemsInTrash

        public int getNumberOfItemsInTrash​(Space space)
        Description copied from interface: TrashManager
        Retrieve the total number of items in the trash for a given space.
        Specified by:
        getNumberOfItemsInTrash in interface TrashManager
        Returns:
        the number of items in the trash for that space
      • purge

        public boolean purge​(String spaceKey,
                             long contentId)
        Description copied from interface: TrashManager
        Remove 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:
        purge in interface TrashManager
        Parameters:
        spaceKey - the space to purge the trash from
        contentId - 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

        public List<ContentEntityObject> getTrashContents​(Space space,
                                                          int offset,
                                                          int count)
        Description copied from interface: TrashManager
        Retrieve a subset of the contents of the trash for a particular space.
        Specified by:
        getTrashContents in interface TrashManager
        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

        public PageResponse<Content> getTrashContents​(Space space,
                                                      LimitedRequest request,
                                                      Expansion[] expansions)
                                               throws ServiceException
        Description copied from interface: TrashManager
        Retrieve a subset of the contents of the trash for a particular space.
        Specified by:
        getTrashContents in interface TrashManager
        request - the pagination request, with a cursor which is an identifier to skip results from a previous query when paginating and limit for the result
        expansions - the optional properties to expand on the result
        Returns:
        the contents of the trash, up to the request limit
        Throws:
        ServiceException
      • migrateTrashDate

        public void migrateTrashDate​(String spaceKey,
                                     Instant trashTime)
        Description copied from interface: TrashManagerInternal
        Add trash date to existing items in the trash for a space
        Specified by:
        migrateTrashDate in interface TrashManagerInternal
        Parameters:
        spaceKey - key of the space to apply trash date
        trashTime - timestamp to use as trash date
      • onSpaceRemoval

        @EventListener
        public void onSpaceRemoval​(SpaceRemoveEvent event)
      • getTrashDateMigrationTime

        public Optional<Instant> getTrashDateMigrationTime()
        Description copied from interface: TrashManager
        All 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:
        getTrashDateMigrationTime in interface TrashManager
        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

        public Optional<Instant> findTrashDate​(ContentEntityObject ceo)
        Description copied from interface: TrashManagerInternal
        Trash 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 be 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()
        Specified by:
        findTrashDate in interface TrashManagerInternal
        Parameters:
        ceo - a content entity object to determine trash date
        Returns:
        when ceo was added to the trash if that data is available
      • findTrashDate

        public Optional<Instant> findTrashDate​(Content content)
        Description copied from interface: TrashManagerInternal
        Trash 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 be 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()
        Specified by:
        findTrashDate in interface TrashManagerInternal
        Parameters:
        content - a com.atlassian.confluence.api.model.content.Content to determine trash date
        Returns:
        when content was added to the trash if that data is available