Class AuditLogFormatter


  • public class AuditLogFormatter
    extends Object
    A formatter for entities used in an audit log which is typically represented by NoteDb commits.

    The formatted representation of those entities must be parsable so that we can read them later on and map them back to their original entities. AuditLogFormatter and NoteDbUtil contain some of those parsing/mapping methods.

    • Method Detail

      • createPartiallyWorkingFallBack

        public static AuditLogFormatter createPartiallyWorkingFallBack()
      • getParsableAuthorIdent

        public org.eclipse.jgit.lib.PersonIdent getParsableAuthorIdent​(Account account,
                                                                       org.eclipse.jgit.lib.PersonIdent personIdent)
        Creates a parsable PersonIdent for commits which are used as an audit log.

        Parsable means that we can unambiguously identify the original account when being presented with a PersonIdent of a commit.

        We typically use the initiator of an action as the author of the commit when using those commits as an audit log. That's something which has to be specified by a caller of this method as this class doesn't create any commits itself.

        Parameters:
        account - the Account of the user who should be represented
        personIdent - a PersonIdent which provides the timestamp for the created PersonIdent
        Returns:
        a PersonIdent which can be used for the author of a commit
      • getParsableAuthorIdent

        public org.eclipse.jgit.lib.PersonIdent getParsableAuthorIdent​(Account.Id accountId,
                                                                       org.eclipse.jgit.lib.PersonIdent personIdent)
        Creates a parsable PersonIdent for commits which are used as an audit log.

        See getParsableAuthorIdent(Account, PersonIdent) for further details.

        Parameters:
        accountId - the ID of the account of the user who should be represented
        personIdent - a PersonIdent which provides the timestamp for the created PersonIdent
        Returns:
        a PersonIdent which can be used for the author of a commit
      • getParsableAccount

        public String getParsableAccount​(Account.Id accountId)
        Provides a parsable representation of an account for use in e.g. commit messages.
        Parameters:
        accountId - the ID of the account of the user who should be represented
        Returns:
        the String representation of the account
      • getParsableGroup

        public String getParsableGroup​(AccountGroup.UUID groupUuid)
        Provides a parsable representation of a group for use in e.g. commit messages.
        Parameters:
        groupUuid - the UUID of the group
        Returns:
        the String representation of the group