Package com.sas.lsaf.security.audit

## Interface AuditService

-     public interface AuditService

  The service to query the global audit history or an object's audit history. To view the global audit trail, you must have the `View Audit History` privilege.
  Since:
    1.5

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearSearchResults()` | Releases any cached information about the query that is associated with the current search.
    `java.util.Set<AuditAction>` | `getAuditActions()` | Gets a comprehensive set of audit actions that can appear in the audit trail.
    `java.util.List<AuditEntryDetail>` | `getDetails​(java.lang.String id)` | Gets the audit details for a single audit entry with the identifier.
    `int` | `getSearchPageSizeLimit()` | Gets the maximum number of audit entries that can be returned in a single request.
    `java.util.List<AuditEntry>` | `getSearchResults​(int fromRow, int toRow)` | Gets a range of results after calling `search(AuditQuery)`.
    `SearchResultsInfo` | `search​(AuditQuery query)` | Searches the global audit history and returns the information that describes the results, not the results themselves.

- - ### Method Detail

    - #### search

          SearchResultsInfo search​(AuditQuery query)

      Searches the global audit history and returns the information that describes the results, not the results themselves. The search results information contains the row count in which to request pageable audit entries by calling `getSearchResults(int, int)`. When the results are no longer required, call `clearSearchResults()` to release any server-side resources that are related to the query.

      Note: Only one query can be active at a time for a client. The results that are generated for the query can be used to iterate through the results by calling `getSearchResults(int, int)`, but if a client calls this method again, a new set of results is generated, and the previous results are no longer valid.

      Parameters:
        `query` - the search criteria with which to query the audit history.
      Returns:
        The metadata that describes the search results that contain the row count that indicates how many records were returned by the query.

    - #### getSearchResults

          java.util.List<AuditEntry> getSearchResults​(int fromRow,
                                                      int toRow)
                                               throws AuditSearchException

      Gets a range of results after calling `search(AuditQuery)`. The `from row` and `to row` values should be between 1 and the total rows that are retrieved by the query. This is considered a `page` of results, and therefore, a `pageable` results model.

      Note: The maximum number of records that can be returned for a single page is determined by `getSearchPageSizeLimit()`. The default maximum is 5000.

      Parameters:
        `fromRow` - the starting row number to include in the results. Must be greater than 0.
        `toRow` - the ending row number to include in the results. Must be less than or equal to the total row count. The total number retrieved must be less than or equal to the page size limit.
      Returns:
        The list of audit entries that are based on the query and the rows that are specified.
      Throws:
        `AuditSearchException` - thrown when the results have been cleared from the server or when the total row number requested exceeds the page size limit.

    - #### getDetails

          java.util.List<AuditEntryDetail> getDetails​(java.lang.String id)

      Gets the audit details for a single audit entry with the identifier. The details contain the old and new values of what was changed.
      Parameters:
        `id` - the unique identifier of the audit entry.
      Returns:
        A list of audit entry details that contains the information that has changed.

    - #### clearSearchResults

          void clearSearchResults()

      Releases any cached information about the query that is associated with the current search. This method should be called once in a finally block for each call to `search(AuditQuery)`. If the results no longer exist when this method is called, then this method returns without further action.

    - #### getSearchPageSizeLimit

          int getSearchPageSizeLimit()

      Gets the maximum number of audit entries that can be returned in a single request. The default is 5000.
      Returns:
        The page size limit.

    - #### getAuditActions

          java.util.Set<AuditAction> getAuditActions()

      Gets a comprehensive set of audit actions that can appear in the audit trail. This set can be useful when searching the audit trail for specific actions by calling `search(AuditQuery)`.
      Returns:
        The complete set of audit actions that are available to the audit trail. There is no guarantee that all actions exist in the audit trail, but they are available or have been available in previous releases.