Package org.craftercms.commons.audit
Class AuditService<T extends AuditModel>
java.lang.Object
org.craftercms.commons.audit.AuditService<T>
- Type Parameters:
T
- Any Object that Extents AuditModel.
Defines Basic Audit Service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets date and persist the Audit in the repository.protected abstract void
deleteAudits
(List<String> auditId) Deletes all audits where its it is in the given List.abstract T
getAuditLog
(String id) Gets the audit log for its Id.getAuditLogs
(Date from) Returns all Audits starting the given date.getAuditLogs
(Date from, Date to) Returns all Audits where logged date is between the given dates.protected abstract void
persistAudit
(T auditModel) Defines the actual save of the audit to the given audit repository.
-
Constructor Details
-
AuditService
public AuditService()
-
-
Method Details
-
audit
Sets date and persist the Audit in the repository.- Parameters:
auditModel
- Audit to be save.
-
getAuditLog
Gets the audit log for its Id.- Parameters:
id
- It of the audit log.- Returns:
- Audit log with the given id, null if not found.
-
persistAudit
Defines the actual save of the audit to the given audit repository.- Parameters:
auditModel
- Audit to be save.
-
deleteAudits
Deletes all audits where its it is in the given List.- Parameters:
auditId
- List of audits id to delete.
-
getAuditLogs
Returns all Audits starting the given date.- Parameters:
from
- Date when the Audit was logged.- Returns:
- List all audits where logged date is after or the given date.Empty if nothing is found
-
getAuditLogs
Returns all Audits where logged date is between the given dates.- Parameters:
from
- Start Date range.(including)to
- End of Date range.(including)- Returns:
- List of audits that were logged between the given date range.Empty if nothing match.
-