public class AuditLogFormatter
extends java.lang.Object
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.
Modifier and Type | Method and Description |
---|---|
static AuditLogFormatter |
create(java.util.function.Function<Account.Id,java.util.Optional<Account>> accountRetriever,
java.util.function.Function<AccountGroup.UUID,java.util.Optional<GroupDescription.Basic>> groupRetriever,
java.lang.String serverId) |
static AuditLogFormatter |
createBackedBy(AccountCache accountCache,
GroupBackend groupBackend,
java.lang.String serverId) |
static AuditLogFormatter |
createBackedBy(com.google.common.collect.ImmutableSet<Account> allAccounts,
com.google.common.collect.ImmutableSet<GroupDescription.Basic> allGroups,
java.lang.String serverId) |
static AuditLogFormatter |
createPartiallyWorkingFallBack() |
java.lang.String |
getParsableAccount(Account.Id accountId)
Provides a parsable representation of an account for use in e.g.
|
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. |
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. |
java.lang.String |
getParsableGroup(AccountGroup.UUID groupUuid)
Provides a parsable representation of a group for use in e.g.
|
public static AuditLogFormatter createBackedBy(AccountCache accountCache, GroupBackend groupBackend, java.lang.String serverId)
public static AuditLogFormatter createBackedBy(com.google.common.collect.ImmutableSet<Account> allAccounts, com.google.common.collect.ImmutableSet<GroupDescription.Basic> allGroups, java.lang.String serverId)
public static AuditLogFormatter createPartiallyWorkingFallBack()
public static AuditLogFormatter create(java.util.function.Function<Account.Id,java.util.Optional<Account>> accountRetriever, java.util.function.Function<AccountGroup.UUID,java.util.Optional<GroupDescription.Basic>> groupRetriever, java.lang.String serverId)
public org.eclipse.jgit.lib.PersonIdent getParsableAuthorIdent(Account account, org.eclipse.jgit.lib.PersonIdent personIdent)
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.
account
- the Account
of the user who should be representedpersonIdent
- a PersonIdent
which provides the timestamp for the created PersonIdent
PersonIdent
which can be used for the author of a commitpublic org.eclipse.jgit.lib.PersonIdent getParsableAuthorIdent(Account.Id accountId, org.eclipse.jgit.lib.PersonIdent personIdent)
PersonIdent
for commits which are used as an audit log.
See getParsableAuthorIdent(Account, PersonIdent)
for further details.
accountId
- the ID of the account of the user who should be representedpersonIdent
- a PersonIdent
which provides the timestamp for the created PersonIdent
PersonIdent
which can be used for the author of a commitpublic java.lang.String getParsableAccount(Account.Id accountId)
accountId
- the ID of the account of the user who should be representedString
representation of the accountpublic java.lang.String getParsableGroup(AccountGroup.UUID groupUuid)
groupUuid
- the UUID of the groupString
representation of the group