Class AuditService

java.lang.Object
com.eurodyn.qlack.fuse.audit.service.AuditService
Direct Known Subclasses:
AuditAsyncService

@Service @Validated public class AuditService extends Object
Provides Audit CRUD and search functionality
Author:
European Dynamics SA.
  • Constructor Details

  • Method Details

    • audit

      public void audit(String level, String event, String description)
      Adds an audit of an EVENT with minimal information.
      Parameters:
      level - the audit level
      event - the audit EVENT
      description - the audit description
    • audit

      public void audit(String level, String event, String description, Object... args)
      Adds an audit of an EVENT with minimal information.
      Parameters:
      level - the audit level
      event - the audit EVENT
      description - the audit description
      args - the arguments to be passed on a MessageFormat for the description argument.
    • audit

      public void audit(String level, String event, String groupName, String description, String sessionID, Object traceData)
      Adds an audit of an EVENT that occurred in the application
      Parameters:
      level - the audit level
      event - the audit EVENT
      groupName - the name of the group that the audit is part of
      description - a description of the audit
      sessionID - the id of the session that the audit occurred
      traceData - an object containing the trace of the audit
    • audit

      public void audit(String level, String event, String groupName, String description, String sessionID, String traceData)
      Creates an audit of an EVENT that occurred in the application
      Parameters:
      level - the audit level
      event - the audit EVENT
      groupName - the name of the group that the audit is part of
      description - a description of the audit
      sessionID - the id of the session that the audit occurred
      traceData - a String containing the trace of the audit
    • audit

      public String audit(String level, String event, String groupName, String description, String sessionID, Object traceData, String referenceId)
      Adds an audit of an EVENT that occurred in the application
      Parameters:
      level - the audit level
      event - the audit EVENT
      groupName - the name of the group that the audit is part of
      description - a description of the audit
      sessionID - the id of the session that the audit occurred
      traceData - an object containing the trace of the audit
      referenceId - the reference id of the audit
      Returns:
      the id of the created audit
    • audit

      public String audit(AuditDTO audit)
      Adds an audit of an EVENT that occurred in the application
      Parameters:
      audit - a DTO containing all information of the audit to persist
      Returns:
      the id of the created audit
    • audits

      public List<String> audits(List<AuditDTO> auditList, String correlationId)
      Adds audits of multiple events that occurred in the application, and correlates them with a unique id
      Parameters:
      auditList - a list of the audits to persist
      correlationId - the unique id to correlate the audits
      Returns:
      a list containing the ids of the created audits
    • deleteAudit

      public void deleteAudit(String id)
      Deletes an audit
      Parameters:
      id - the id of the audit to delete
    • truncateAudits

      public void truncateAudits()
      Deletes all persisted audits
    • truncateAudits

      public void truncateAudits(Date createdOn)
      Deletes all audits created before given date
      Parameters:
      createdOn - the date before which all audits will be deleted
    • truncateAudits

      public void truncateAudits(long retentionPeriod)
      Deletes all audits created before the given period (eg. last 7 days)
      Parameters:
      retentionPeriod - the period that audits should be kept
    • getAuditById

      public AuditDTO getAuditById(String auditId)
      Fetches an audit by given id
      Parameters:
      auditId - the id of the audit
      Returns:
      the audit that matches the specific id
    • getAuditLogs

      public org.springframework.data.domain.Page<AuditDTO> getAuditLogs(org.springframework.data.domain.Pageable pageable, com.querydsl.core.types.Predicate predicate)
      Searches for audits matching an expression
      Parameters:
      pageable - defines the maximum number of results to return
      predicate - an expression to describe which audits to return (eg. qAudit.EVENT.like(expression("The EVENT"));
      Returns:
      a page containing X number of audits matching the specific expression
    • countAuditLogs

      public int countAuditLogs()
      Counts existing audits.
      Returns:
      the number of existing audits.
    • getDistinctEventsForReferenceId

      public List<String> getDistinctEventsForReferenceId(String referenceId)
      Searches distinct events for a specific reference id
      Parameters:
      referenceId - the reference id that each audit should have
      Returns:
      a list of EVENT names of audits, that have the specific reference id.