Class AuditService
java.lang.Object
com.eurodyn.qlack.fuse.audit.service.AuditService
- Direct Known Subclasses:
AuditAsyncService
Provides Audit CRUD and search functionality
- Author:
- European Dynamics SA.
-
Constructor Summary
ConstructorDescriptionAuditService
(AuditProperties auditProperties, AuditRepository auditRepository, AuditMapper auditMapper, AuditLevelRepository auditLevelRepository) -
Method Summary
Modifier and TypeMethodDescriptionAdds an audit of an EVENT that occurred in the applicationvoid
Adds an audit of an EVENT with minimal information.void
Adds an audit of an EVENT with minimal information.void
audit
(String level, String event, String groupName, String description, String sessionID, Object traceData) Adds an audit of an EVENT that occurred in the applicationaudit
(String level, String event, String groupName, String description, String sessionID, Object traceData, String referenceId) Adds an audit of an EVENT that occurred in the applicationvoid
audit
(String level, String event, String groupName, String description, String sessionID, String traceData) Creates an audit of an EVENT that occurred in the applicationAdds audits of multiple events that occurred in the application, and correlates them with a unique idint
Counts existing audits.void
deleteAudit
(String id) Deletes an auditgetAuditById
(String auditId) Fetches an audit by given idorg.springframework.data.domain.Page<AuditDTO>
getAuditLogs
(org.springframework.data.domain.Pageable pageable, com.querydsl.core.types.Predicate predicate) Searches for audits matching an expressiongetDistinctEventsForReferenceId
(String referenceId) Searches distinct events for a specific reference idvoid
Deletes all persisted auditsvoid
truncateAudits
(long retentionPeriod) Deletes all audits created before the given period (eg.void
truncateAudits
(Date createdOn) Deletes all audits created before given date
-
Constructor Details
-
AuditService
@Autowired public AuditService(AuditProperties auditProperties, AuditRepository auditRepository, AuditMapper auditMapper, AuditLevelRepository auditLevelRepository)
-
-
Method Details
-
audit
Adds an audit of an EVENT with minimal information.- Parameters:
level
- the audit levelevent
- the audit EVENTdescription
- the audit description
-
audit
Adds an audit of an EVENT with minimal information.- Parameters:
level
- the audit levelevent
- the audit EVENTdescription
- the audit descriptionargs
- the arguments to be passed on aMessageFormat
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 levelevent
- the audit EVENTgroupName
- the name of the group that the audit is part ofdescription
- a description of the auditsessionID
- the id of the session that the audit occurredtraceData
- 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 levelevent
- the audit EVENTgroupName
- the name of the group that the audit is part ofdescription
- a description of the auditsessionID
- the id of the session that the audit occurredtraceData
- 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 levelevent
- the audit EVENTgroupName
- the name of the group that the audit is part ofdescription
- a description of the auditsessionID
- the id of the session that the audit occurredtraceData
- an object containing the trace of the auditreferenceId
- the reference id of the audit- Returns:
- the id of the created audit
-
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
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 persistcorrelationId
- the unique id to correlate the audits- Returns:
- a list containing the ids of the created audits
-
deleteAudit
Deletes an audit- Parameters:
id
- the id of the audit to delete
-
truncateAudits
public void truncateAudits()Deletes all persisted audits -
truncateAudits
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
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 returnpredicate
- 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
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.
-