Class MemAuditBackend

All Implemented Interfaces:
AuditBackend, AuditAdmin, AuditLogger<LogEntry>, AuditReader<LogEntry>, AuditStorage, Logs<LogEntry>, AuditBackend<LogEntry>

public class MemAuditBackend extends AbstractAuditBackend
Since:
2025.0
  • Field Details

    • MAPPER

      protected static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
    • entries

      protected final org.apache.commons.collections4.queue.CircularFifoQueue<LogEntry> entries
    • idCounter

      protected final AtomicLong idCounter
  • Constructor Details

    • MemAuditBackend

      public MemAuditBackend()
  • Method Details

    • getEventsCount

      public Long getEventsCount(String eventId)
    • addLogEntries

      public void addLogEntries(List<LogEntry> entries)
      Description copied from interface: AuditBackend
      Adds given log entries.
      Parameters:
      entries - the list of log entries.
    • mapJsonContent

      protected Map<String,Object> mapJsonContent(Map<String,Object> extended)
    • getLogEntryByID

      public LogEntry getLogEntryByID(long id)
      Description copied from interface: AuditBackend
      Returns a given log entry given its id.
      Parameters:
      id - the log entry identifier
      Returns:
      a LogEntry instance
    • queryLogs

      public LogEntryList queryLogs(QueryBuilder builder)
      Description copied from interface: AuditBackend
      Returns the logs given a collection of predicates and a default sort.
      Parameters:
      builder - the query builder to fetch log entries
      Returns:
      a list of log entries
    • createPredicate

      protected Predicate<LogEntry> createPredicate(Predicate queryPredicate)
    • compare

      protected int compare(Object leftValue, Object rightValue)
    • convertToLiteralsJavaType

      protected Object convertToLiteralsJavaType(Object leftValue)
    • createComparator

      protected Comparator<LogEntry> createComparator(OrderByList queryOrders)
    • createComparator

      protected Comparator<LogEntry> createComparator(OrderByExpr queryOrder)
    • hasCapability

      public boolean hasCapability(AuditBackend.Capability capability)
      Description copied from interface: AuditBackend
      Checks whether the backend has the capability.
    • nativeQuery

      public List<?> nativeQuery(String query, Map<String,Object> params, int pageNb, int pageSize)
      Description copied from interface: AuditReader
      Returns a batched list of entries.
      Parameters:
      query - a JPA query language query if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearch
      params - parameters for the query
      pageNb - the page number (starts at 1)
      pageSize - the number of results per page
    • clearEntries

      protected void clearEntries()
      Description copied from class: AbstractAuditBackend
      INTERNAL METHOD FOR TESTS, DO NOT USE.
      Overrides:
      clearEntries in class AbstractAuditBackend