Interface AuditService

  • All Known Implementing Classes:
    AuditServiceImpl

    public interface AuditService
    Service for writing protocol (audit) entries. It offers one record method per kind of entry, distinguished by the input type — a system entry, a tenant entry, a form-version entry, or an (informational) form-record entry. Each entry is attributed to the acting user; the referenced tenant, form version or form record is resolved internally from the ids carried by the input.

    The service only writes entries; it deliberately offers no read or query operations. It will grow further record overloads over time (e.g. richer form-record entry kinds).

    Since:
    8.5.6
    Author:
    Norman Lorenz
    • Method Detail

      • getInstance

        static AuditService getInstance()
        Retrieves the singleton instance of the AuditService. This method uses CDI to obtain the instance.
        Returns:
        the singleton instance of the AuditService.
        Since:
        8.5.6
      • record

        AuditEntryHandle record​(SystemAuditEntry entry,
                                User user)
                         throws FcAuditException
        Writes a system protocol entry.
        Parameters:
        entry - the entry to write. Must not be null and must carry a non-blank message.
        user - the acting user the entry is attributed to. Must not be null.
        Returns:
        a handle to the created entry.
        Throws:
        IllegalArgumentException - if entry or user is null, or the message is blank.
        FcAuditException - if persistence fails.
        Since:
        8.5.6
      • record

        AuditEntryHandle record​(FormVersionAuditEntry entry,
                                User user)
                         throws FcAuditException
        Writes a tenant-scoped protocol entry tied to a form version. The owning tenant is resolved from the form version.
        Parameters:
        entry - the entry to write. Must not be null and must carry a non-blank message.
        user - the acting user the entry is attributed to. Must not be null.
        Returns:
        a handle to the created entry.
        Throws:
        IllegalArgumentException - if entry or user is null, or the message is blank.
        FcAuditException - if the form version does not exist (AuditErrorType.NOT_FOUND) or persistence fails.
        Since:
        8.5.6
      • record

        AuditEntryHandle record​(FormRecordAuditEntry entry,
                                User user)
                         throws FcAuditException
        Writes an informational form-record protocol entry. The form record, its project and owning tenant are resolved from the entry's process id.
        Parameters:
        entry - the entry to write. Must not be null and must carry a non-blank process id and message.
        user - the acting user the entry is attributed to. Must not be null.
        Returns:
        a handle to the created entry.
        Throws:
        IllegalArgumentException - if entry or user is null, or the process id or message is blank.
        FcAuditException - if no form record exists for the process id (AuditErrorType.NOT_FOUND) or persistence fails.
        Since:
        8.5.6