Interface AuditDAO

All Known Implementing Classes:
AbstractAuditDAOImpl, AuditDAOImpl

public interface AuditDAO
DAO services for alf_audit_XXX tables.

The older methods are supported by a different implementation and will eventually be deprecated and phased out.

Since:
3.2
Author:
Derek Hulley
  • Method Details

    • getOrCreateAuditModel

      Pair<Long,ContentData> getOrCreateAuditModel(URL url)
      Creates a new audit model entry or finds an existing one
      Parameters:
      url - the URL of the configuration
      Returns:
      Returns the ID of the config matching the input stream and the content storage details
      Since:
      3.2
    • getAuditApplication

      AuditDAO.AuditApplicationInfo getAuditApplication(String applicationName)
      Get the audit application details.
      Parameters:
      applicationName - the name of the application
      Returns:
      Returns details of an existing application or null if it doesn't exist
      Since:
      3.2
    • createAuditApplication

      AuditDAO.AuditApplicationInfo createAuditApplication(String application, Long modelId)
      Creates a new audit application. The application name must be unique.
      Parameters:
      application - the name of the application
      modelId - the ID of the model configuration
      Since:
      3.2
    • updateAuditApplicationModel

      void updateAuditApplicationModel(Long id, Long modelId)
      Update the audit application to refer to a new model. If the model did not change, then nothing will be done.
      Parameters:
      id - the ID of the audit application
      modelId - the ID of the new model
      Since:
      3.2
    • updateAuditApplicationDisabledPaths

      void updateAuditApplicationDisabledPaths(Long id, Set<String> disabledPaths)
      Update the audit application to hold a new set of disabled paths. If the value did not change, then nothing will be done.
      Parameters:
      id - the ID of the audit application
      disabledPaths - the new disabled paths
      Since:
      3.2
    • deleteAuditEntries

      int deleteAuditEntries(Long applicationId, Long fromTime, Long toTime)
      Delete audit entries for the application, possibly limiting the time range.
      Parameters:
      applicationId - an existing audit application ID
      fromTime - the minimum entry time (inclusive, optional)
      toTime - the maximum entry time (exclusive, optional)
      Returns:
      Returns the number of entries deleted
      Since:
      3.2
    • deleteAuditEntriesByIdRange

      int deleteAuditEntriesByIdRange(Long applicationId, Long fromId, Long toId)
      Delete audit entries for the application for given id range.
      Parameters:
      applicationId - an existing audit application ID
      fromId - the minimum fromId (inclusive, optional)
      toId - the maximum toId (exclusive, optional)
      Returns:
      Returns the number of entries deleted
      Since:
      5.2.2
    • deleteAuditEntries

      int deleteAuditEntries(List<Long> auditEntryIds)
      Delete a discrete list of audit entries. Duplicate entries are collapsed and the number of entries deleted will match the count of unique IDs in the list; otherwise a concurrency condition has occured and an exception will be generated.
      Parameters:
      auditEntryIds - the IDs of all audit entries to delete
      Returns:
      Returns the number of entries deleted
    • createAuditEntry

      Long createAuditEntry(Long applicationId, long time, String username, Map<String,Serializable> values)
      Create a new audit entry with the given map of values.
      Parameters:
      applicationId - an existing audit application ID
      time - the time (ms since epoch) to log the entry against
      username - the authenticated user (null if not present)
      values - the values to record
      Returns:
      Returns the unique entry ID
      Since:
      3.2
    • findAuditEntries

      void findAuditEntries(AuditService.AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
      Find audit entries using the given parameters, any of which may be null
      Parameters:
      callback - the data callback per entry
      parameters - the parameters for the query (may not be null)
      maxResults - the maximum number of results to retrieve (must be greater than 0)
      Throws:
      IllegalArgumentException - if maxResults less or equal to zero
    • getAuditMinMaxByApp

      HashMap<String,Long> getAuditMinMaxByApp(long appId, List<String> extremes)
      Issue an audit query to retrieve min / max audit record id for a given application.
      Parameters:
      appId - the database id of the application
      extremes - a list containing min/max or both
      Returns:
      a map containing min/max and the associated value
    • getAuditEntriesCountByApp

      default int getAuditEntriesCountByApp(long applicationId)
      Issue an audit query to retrieve count of records for a given application.
      Parameters:
      applicationId - the database id of the application
      Returns:
      a map containing min/max and the associated value
    • getAuditEntriesCountByAppAndProperties

      default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
      Issue an audit query to retrieve count of records for a given application and properties
      Parameters:
      applicationName - name of the application to be queried
      parameters - audit parameters provided by the where clause on the ReST API
      Returns:
      a map containing min/max and the associated value