Package com.sas.lsaf.content.repository.recyclebin

## Interface RecycleBinService

-     public interface RecycleBinService

  The service to retrieve and permanently delete items in the recycle bin. To see recycle bin items at a context and below, you must be a member of the context and have either Permanently Delete Items or Restore Items Deleted by Other privilege at that context. If you have the Permanently Delete Items privilege at the context, you can permanently delete items from the recycle bin, regardless of who deleted them.

  Note that items returned from this service are items that were explicitly deleted. If a container is deleted, the container is returned, not its children. This is because the children were not explicitly deleted.

  Since:
    1.2

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.List<java.lang.String>` | `deleteAvailableItems()` | Permanently deletes all of the items in the recycle bin that the current user has access to delete.
    `java.util.List<java.lang.String>` | `deleteItem​(RecycleBinItem item)` | Permanently deletes the specified item in the recycle bin.
    `java.util.List<java.lang.String>` | `deleteItemById​(java.lang.String recycleBinItemId)` | Permanently deletes the item with the specified identifier in the recycle bin.
    `java.util.List<java.lang.String>` | `deleteItems​(java.util.Set<RecycleBinItem> items)` | Permanently deletes the specified items in the recycle bin.
    `java.util.List<java.lang.String>` | `deleteItemsByIds​(java.util.Set<java.lang.String> recycleBinItemIds)` | Permanently deletes the recycle bin items with the specified identifiers.
    `java.util.List<java.lang.String>` | `deleteItemsByQuery​(RecycleBinQuery query)` | Permanently deletes all of the items that can be deleted in the recycle bin based on the specified query.
    `RecycleBinSearchResults` | `search​(RecycleBinQuery query)` | Searches the recycle bin based on the specified query.

- - ### Method Detail

    - #### deleteAvailableItems

          java.util.List<java.lang.String> deleteAvailableItems()

      Permanently deletes all of the items in the recycle bin that the current user has access to delete.
      Returns:
        The paths that represent items that are permanently deleted.

    - #### deleteItemsByQuery

          java.util.List<java.lang.String> deleteItemsByQuery​(RecycleBinQuery query)
                                                       throws RecycleBinItemSearchException

      Permanently deletes all of the items that can be deleted in the recycle bin based on the specified query. If the current user does not have the Permanently Delete Items privilege at a context that satisfies the query, items in the context are not deleted. Items in the /Users folder outside of the current user's folder (/Users/) also cannot be deleted. Only paths for the items that can be deleted are returned. At least one query variable must be specified.
      Parameters:
        `query` - The criteria by which to permanently delete items.
      Returns:
        The paths that represent the items that are permanently deleted. If a folder is in the recycle bin, the folder path and all of its children's paths are included.
      Throws:
        `RecycleBinItemSearchException` - Thrown when there is an issue processing the query.

    - #### deleteItem

          java.util.List<java.lang.String> deleteItem​(RecycleBinItem item)
                                               throws RecycleBinItemNotFoundException,
                                                      RecycleBinItemDeleteException

      Permanently deletes the specified item in the recycle bin. If the item specified is a container, the children are also deleted.
      Parameters:
        `item` - The RecycleBinItem that represents the item in the recycle bin.
      Returns:
        The paths that represent the item that is permanently deleted. If the deleted item is a container, the paths of the deleted child items are also returned.
      Throws:
        `RecycleBinItemNotFoundException` - Thrown when the specified recycle bin item is not found.
        `RecycleBinItemDeleteException` - Thrown when a recycle bin item cannot be deleted.

    - #### deleteItemById

          java.util.List<java.lang.String> deleteItemById​(java.lang.String recycleBinItemId)
                                                   throws RecycleBinItemNotFoundException,
                                                          RecycleBinItemDeleteException

      Permanently deletes the item with the specified identifier in the recycle bin. If the specified item is a container, the children are also deleted.
      Parameters:
        `recycleBinItemId` - The identifier that represents the items in the recycle bin.
      Returns:
        The paths that represent the items that are permanently deleted. If the deleted item is a container, the paths of the deleted child items are also returned.
      Throws:
        `RecycleBinItemNotFoundException` - Thrown when the specified recycle bin item is not found.
        `RecycleBinItemDeleteException` - Thrown when a recycle bin item cannot be deleted.

    - #### deleteItems

          java.util.List<java.lang.String> deleteItems​(java.util.Set<RecycleBinItem> items)

      Permanently deletes the specified items in the recycle bin. If the item is a container, the children are also deleted. This operation is a best effort, which means that if it can't permanently delete an item, it continues on to the next item without throwing an exception.
      Parameters:
        `items` - The RecycleBinItem that represents items in the recycle bin.
      Returns:
        The paths that represent the items that are permanently deleted. If the deleted item is a container, the paths of the deleted child items are also returned.

    - #### deleteItemsByIds

          java.util.List<java.lang.String> deleteItemsByIds​(java.util.Set<java.lang.String> recycleBinItemIds)

      Permanently deletes the recycle bin items with the specified identifiers. If the item specified is a container, the children are also deleted. This operation is a best effort, which means that if it can't permanently delete an item, it continues to the next item without throwing an exception.
      Parameters:
        `recycleBinItemIds` - The identifiers that represents items in the recycle bin.
      Returns:
        The paths that represent items that are permanently deleted. If the deleted item is a container, the paths of the deleted child items are also returned.
      Throws:
        `RecycleBinItemNotFoundException` - Thrown when the recycle bin item is not found.
        `RecycleBinItemDeleteException` - Thrown when a recycle bin item cannot be deleted.

    - #### search

          RecycleBinSearchResults search​(RecycleBinQuery query)
                                  throws RecycleBinItemSearchException

      Searches the recycle bin based on the specified query. The server returns a list of `RecycleBinItem`s that satisfy the query. If the server cannot process all of the items due to server limitations, `RecycleBinSearchResults.isLimitReached()` is set to True. If True, more items might exist that satisfy the query, but they cannot be returned. Items to which the current user does not have Read access are not returned unless the user has the Permanently Delete Items or Restore Items Deleted by Others privilege.

      Note that if "*" is specified for `deletedBy` in `RecycleBinQuery`, and the current user does not have the Permanently Delete Items or Restore Items Deleted by Others privilege at the specified query `location`, only the current user's items are returned. If null or a blank `location` is specified in the query, the location defaults to the root, which assumes no privileges and, similarly, only the current user's items are returned.

      Parameters:
        `query` - The search criteria with which to query the recycle bin.
      Returns:
        The metadata that describes the search results and that contains the `RecycleBinItem`s that satisfy the query, and whether the limit is reached on the server.
      Throws:
        `RecycleBinItemSearchException` - Thrown when there is an issue processing the recycle bin search.