Package com.sas.lsaf.query.repository

## Interface RepositoryQueryService

-     public interface RepositoryQueryService

  The service to extract repository 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` | `executeRepositoryContainerQuery​(RepositoryContainerQuery query, ExtractFileCreateInfo file)` | Extracts repository container information to a file based on the specified query.
    `java.lang.String` | `executeRepositoryFileQuery​(RepositoryFileQuery query, ExtractFileCreateInfo file)` | Extracts repository file information for the latest version of a file based on the specified query.
    `java.lang.String` | `executeRepositoryFileVersionQuery​(RepositoryFileVersionQuery query, ExtractFileCreateInfo file)` | Extracts repository file information for each version of a file based on the specified query.
    `java.lang.String` | `executeRepositoryItemQuery​(RepositoryItemQuery query, ExtractFileCreateInfo file)` | Extracts repository item (file and container) information to a file based on the specified query.

- - ### Method Detail

    - #### executeRepositoryItemQuery

          java.lang.String executeRepositoryItemQuery​(RepositoryItemQuery query,
                                                      ExtractFileCreateInfo file)
                                               throws QueryException

      Extracts repository item (file and container) information to a file based on the specified query. The method requires the current user to be an Administrative mode user. The query does not include the content in the /Users folder. If the query results exceed the row limit (default is 10 million), a `QueryLimitException` is thrown.

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

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

      Parameters:
        `query` - The repository criteria with which to query the repository 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.

    - #### executeRepositoryContainerQuery

          java.lang.String executeRepositoryContainerQuery​(RepositoryContainerQuery query,
                                                           ExtractFileCreateInfo file)
                                                    throws QueryException

      Extracts repository container information to a file based on the specified query. The size column in `RepositoryContainerQuery` represents the total size of all files in the container and, 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 repository containers with a size greater than 1 million bytes (roughly 1 gigabyte). 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 will sort according to size using the default sort order, which is descending.

      >      RepositoryContainerQuery query = new RepositoryContainerQuery();
      >      query.select(RepositoryItemQuery.PATH, RepositoryContainerQuery.SIZE)
      >              .constrain(Comparison.greaterThan(RepositoryContainerQuery.SIZE, 1000000));
      >              .order((RepositoryContainerQuery.SIZE));
      >      service.executeRepositoryContainerQuery(query, fileInfo);

      Parameters:
        `query` - The repository criteria with which to query the repository 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.

    - #### executeRepositoryFileQuery

          java.lang.String executeRepositoryFileQuery​(RepositoryFileQuery query,
                                                      ExtractFileCreateInfo file)
                                               throws QueryException

      Extracts repository file information for the latest version of a file based on the specified query. 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 repository files with the latest version that has not been signed. The output includes all available RepositoryFileQuery columns and is sorted by path in ascending order, ignoring case.

      >      RepositoryFileQuery query = new RepositoryFileQuery();
      >      query.select(RepositoryFileQuery.ALL);
      >      query.constrain(Comparison.notEqual(RepositoryFileQuery.SIGNING_STATUS, SigningStatus.CURRENT));
      >      query.order(Order.ascending(RepositoryItemQuery.PATH, false));
      >      service.executeRepositoryFileQuery(query, fileInfo);

      Parameters:
        `query` - The repository criteria with which to query the repository 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.

    - #### executeRepositoryFileVersionQuery

          java.lang.String executeRepositoryFileVersionQuery​(RepositoryFileVersionQuery query,
                                                             ExtractFileCreateInfo file)
                                                      throws QueryException

      Extracts repository file information for each version of a file based on the specified query. 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 repository files that have a specific version with a size greater than 10000000 bytes (roughly 10 megabytes). The output includes path, version, and size columns and is sorted in descending order by size.

      >      RepositoryFileVersionQuery query = new RepositoryFileVersionQuery();
      >      query.select(RepositoryItemQuery.PATH, RepositoryFileVersionQuery.VERSION, RepositoryFileVersionQuery.SIZE);
      >      query.constrain(Comparison.greaterThanOrEqual(RepositoryFileVersionQuery.SIZE, 10000000));
      >      query.order(Order.descending(RepositoryFileVersionQuery.SIZE));

      Parameters:
        `query` - The repository criteria with which to query the repository 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.