Class AuditService<T extends AuditModel>

  • Type Parameters:
    T - Any Object that Extents AuditModel.

    public abstract class AuditService<T extends AuditModel>
    extends Object
    Defines Basic Audit Service.
    • Constructor Detail

      • AuditService

        public AuditService()
    • Method Detail

      • audit

        public void audit​(T auditModel)
        Sets date and persist the Audit in the repository.
        Parameters:
        auditModel - Audit to be save.
      • getAuditLog

        public abstract T getAuditLog​(String id)
        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

        protected abstract void persistAudit​(T auditModel)
        Defines the actual save of the audit to the given audit repository.
        Parameters:
        auditModel - Audit to be save.
      • deleteAudits

        protected abstract void deleteAudits​(List<String> auditId)
        Deletes all audits where its it is in the given List.
        Parameters:
        auditId - List of audits id to delete.
      • getAuditLogs

        public abstract List<T> getAuditLogs​(Date from)
        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

        public abstract List<T> getAuditLogs​(Date from,
                                             Date to)
        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.