Class AuditLogDao


public class AuditLogDao extends AbstractDao
Provides a DAO for the AuditLog entity.
See Also:
  • Constructor Details

    • AuditLogDao

      public AuditLogDao()
  • Method Details

    • createAuditLogRecord

      public AuditLog createAuditLogRecord(BaseEntity entity, String message, String type, Submission submission)
      Create an audit log record
      Parameters:
      entity - the non-null entity that was accessed
      message - the non-empty audit message
      type - a valid audit type (AuditLog.EVENT_TYPE_VIEW, AuditLog.EVENT_TYPE_CREATE, AuditLog.EVENT_TYPE_UPDATE or AuditLog.EVENT_TYPE_DELETE)
      submission - the associated submission
      Returns:
      the audit log record
    • createAuditLogRecord

      public AuditLog createAuditLogRecord(BaseEntity entity, String message, String type)
      Create an audit log record
      Parameters:
      entity - the non-null entity that was accessed
      message - the non-empty audit message
      type - a valid audit type (AuditLog.EVENT_TYPE_VIEW, AuditLog.EVENT_TYPE_CREATE, AuditLog.EVENT_TYPE_UPDATE or AuditLog.EVENT_TYPE_DELETE)
      Returns:
      the audit log record
    • getAuditLogList

      public List<AuditLog> getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize)
      Return a list of audit log records matching the search criteria
      Parameters:
      clientId - the client OID (optional)
      changedBy - a substring of the "Changed By" attribute (optional)
      message - a substring of the audit message (optional)
      entityName - the name of the audited entity, e.g. "Form" (optional)
      entityId - the entity OID (optional)
      startDate - the lower bound of the date range to search (optional)
      endDate - the upper bound of the date range to search (optional)
      sortBy - the column to sort by (optional)
      ascending - whether to sort ascending
      pageSize - the page size to be used in the query
      Returns:
      the list of matching audit log records
    • getAuditLogList

      public List<AuditLog> getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize, int fetchLimit)
      Return a list of audit log records matching the search criteria
      Parameters:
      clientId - the client OID (optional)
      changedBy - a substring of the "Changed By" attribute (optional)
      message - a substring of the audit message (optional)
      entityName - the name of the audited entity, e.g. "Form" (optional)
      entityId - the entity OID (optional)
      startDate - the lower bound of the date range to search (optional)
      endDate - the upper bound of the date range to search (optional)
      sortBy - the column to sort by (optional)
      ascending - whether to sort ascending
      pageSize - the page size to be used in the query
      fetchLimit - the query fetch limit
      Returns:
      the list of matching audit log records
      Since:
      4.3.0
    • getAuditLogList

      public List<AuditLog> getAuditLogList(String clientId, String changedBy, String operation, String message, String entityName, String entityId, Date startDate, Date endDate, int pageSize, int fetchLimit)
      Return a list of audit log records matching the search criteria
      Parameters:
      clientId - the client OID (optional)
      changedBy - a substring of the "Changed By" attribute (optional)
      operation - type of Operation to filter by (optional) @since 17.10.2
      message - a substring of the audit message (optional)
      entityName - the name of the audited entity, e.g. "Form" (optional)
      entityId - the entity OID (optional)
      startDate - the lower bound of the date range to search (optional)
      endDate - the upper bound of the date range to search (optional)
      pageSize - the page size to be used in the query
      fetchLimit - the query fetch limit
      Returns:
      the list of matching audit log records
      Since:
      4.3.3
    • purgeAuditLog

      public int purgeAuditLog(int maxAgeDays, int fetchLimit, long maxTimeMs)
      Purge audit log records older than a specified number of days
      Parameters:
      maxAgeDays - The age in days above which records will be deleted. If this value is negative or equal to 0, no records will be purged.
      fetchLimit - the maximum number of records to delete (only used if > 0)
      maxTimeMs - the maximum time that can be used to purge records
      Returns:
      the number of records that were deleted
    • iterateOverFullAuditLog

      public void iterateOverFullAuditLog(org.apache.cayenne.ResultIteratorCallback<AuditLog> op)
      Iterates over the FULL audit log, sorted ascending by audit datetime, applying provided callback.
      Parameters:
      op - an operation to be invoked on each object during iteration.
      Since:
      19.05.0