Package com.sas.lsaf.query.repository.recyclebin

## Interface RecycleBinQueryService

-     public interface RecycleBinQueryService

  The service to extract recycle bin content information to a file. The methods in the service require the current user to be an Administrative mode user.
  Since:
    2.3

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `executeRecycleBinContainerQuery​(RecycleBinContainerQuery query, ExtractFileCreateInfo file)` | Extracts individual containers that have been deleted and are located in the recycle bin based on the specified query.
    `java.lang.String` | `executeRecycleBinFileQuery​(RecycleBinFileQuery query, ExtractFileCreateInfo file)` | Extracts individual files that have been deleted and are located in the recycle bin based on the specified query.
    `java.lang.String` | `executeRecycleBinFileVersionQuery​(RecycleBinFileVersionQuery query, ExtractFileCreateInfo file)` | Extracts individual files that have been deleted and are located in the recycle bin based on the specified query.
    `java.lang.String` | `executeRecycleBinItemQuery​(RecycleBinItemQuery query, ExtractFileCreateInfo file)` | Extracts individual items that have been deleted and are located in the recycle bin based on the specified query.

- - ### Method Detail

    - #### executeRecycleBinItemQuery

          java.lang.String executeRecycleBinItemQuery​(RecycleBinItemQuery query,
                                                      ExtractFileCreateInfo file)
                                               throws QueryException

      Extracts individual items that have been deleted and are located in the recycle bin based on the specified query. This information is saved to a file. The method requires the current user to be an Administrative mode user. If the query results exceed the row limit (default is 10 million), a `QueryLimitException` is thrown.

      Here is an example that queries recycle items for any item deleted in a specific location within the last month. The output includes all available RecycleBinItemQuery columns and is sorted in ascending order (oldest first) by the date it was deleted.

      >      RecycleBinItemQuery query = new RecycleBinItemQuery();
      >      Date oneMonthAgo = DateUtils.addMonths(new Date(), -1);
      >      query.select(RecycleBinItemQuery.ALL)
      >              .constrain(Condition.and(Comparison.greaterThan(RecycleBinItemQuery.DELETED_DATE, oneMonthAgo.getTime()),
      >                      Comparison.like(RecycleBinItemQuery.PATH, "/ORG/PROJECT_A/*")))
      >              .order(Order.ascending(RecycleBinItemQuery.DELETED_DATE));
      >      service.executeRecycleBinItemQuery(query, fileInfo);

      Parameters:
        `query` - The recycle bin criteria with which to query the recycle bin content.
        `file` - The method to add the query output file.
      Returns:
        The path to the query output file.
      Throws:
        `QueryException` - Thrown when there is an issue generating the query.

    - #### executeRecycleBinContainerQuery

          java.lang.String executeRecycleBinContainerQuery​(RecycleBinContainerQuery query,
                                                           ExtractFileCreateInfo file)
                                                    throws QueryException

      Extracts individual containers that have been deleted and are located in the recycle bin based on the specified query. This information is saved to a file. The size column in `RecycleBinContainerQuery` represents the total size of all the files in the container and below, which includes all versions of the file, if it is versioned. The method requires the current user to be an Administrative mode user. If the query results exceed the row limit (default is 10 million), a `QueryLimitException` is thrown.

      Here is an example that queries recycle bin containers with a size is greater than 1 million bytes (roughly 1 gigabyte). The size represents the total size, which includes all versions of all files in the container and below. The output includes path and size columns and is sorted according to size using the default sort order which is descending.

      >      RecycleBinContainerQuery query = new RecycleBinContainerQuery();
      >      query.select(RecycleBinItemQuery.PATH, RecycleBinContainerQuery.SIZE)
      >              .constrain(Comparison.greaterThan(RecycleBinContainerQuery.SIZE, 1000000));
      >              .order((RecycleBinContainerQuery.SIZE));
      >      service.executeRecycleBinContainerQuery(query, fileInfo);

      Parameters:
        `query` - The recycle bin criteria with which to query the recycle bin content.
        `file` - The method to add the query output file.
      Returns:
        The path to the query output file.
      Throws:
        `QueryException` - Thrown when there is an issue generating the query.

    - #### executeRecycleBinFileQuery

          java.lang.String executeRecycleBinFileQuery​(RecycleBinFileQuery query,
                                                      ExtractFileCreateInfo file)
                                               throws QueryException

      Extracts individual files that have been deleted and are located in the recycle bin based on the specified query. This information is saved to a file. The method requires the current user to be an Administrative mode user. If the query results exceed the row limit (default is 10 million), a `QueryLimitException` is thrown.

      Here is an example that queries recycle bin files that are SAS data sets and that have more than 10 versions. The output includes all available RecycleBinFileQuery columns and is sorted according to number of versions using the default sort order, which is descending.

      >      RecycleBinFileQuery query = new RecycleBinFileQuery();
      >      query.select(RecycleBinFileQuery.ALL);
      >      query.constrain(Condition.and(Comparison.equal(RecycleBinItemQuery.TYPE_ID, TypeConstants.TYPE_SAS_DATASET),
      >              Comparison.greaterThan(RecycleBinFileQuery.TOTAL_VERSIONS, 10)));
      >      query.order(RecycleBinFileQuery.TOTAL_VERSIONS);
      >      service.executeRecycleBinFileQuery(query, fileInfo);

      Parameters:
        `query` - The recycle bin criteria with which to query the recycle bin content.
        `file` - The method to add the query output file.
      Returns:
        The path to the query output file.
      Throws:
        `QueryException` - Thrown when there is an issue generating the query.

    - #### executeRecycleBinFileVersionQuery

          java.lang.String executeRecycleBinFileVersionQuery​(RecycleBinFileVersionQuery query,
                                                             ExtractFileCreateInfo file)
                                                      throws QueryException

      Extracts individual files that have been deleted and are located in the recycle bin based on the specified query. This information is saved to a file. Information for each version of the file is listed separately. The method requires the current user to be an Administrative mode user. If the query results exceed the row limit (default is 10 million), a `QueryLimitException` is thrown. *

      Here is an example that queries recycle bin files that have a specific version with a size is greater than 10000000 bytes (roughly 10 megabytes). The output includes path, version, and size columns and is sorted in descending order by size.

      >      RecycleBinFileVersionQuery query = new RecycleBinFileVersionQuery();
      >      query.select(RecycleBinItemQuery.PATH, RecycleBinFileVersionQuery.VERSION, RecycleBinFileVersionQuery.SIZE);
      >      query.constrain(Comparison.greaterThanOrEqual(RecycleBinFileVersionQuery.SIZE, 10000000));
      >      query.order(Order.descending(RecycleBinFileVersionQuery.SIZE));
      >      service.executeRecycleBinFileVersionQuery(query, fileInfo);

      Parameters:
        `query` - The recycle bin criteria with which to query the recycle bin content.
        `file` - The method to add the query output file.
      Returns:
        The path to the query output file.
      Throws:
        `QueryException` - Thrown when there is an issue generating the query.