use of com.google.gerrit.server.group.db.AuditLogFormatter in project gerrit by GerritCodeReview.
the class SchemaCreatorImpl method createGroupInNoteDb.
private InternalGroup createGroupInNoteDb(Repository allUsersRepo, InternalGroupCreation groupCreation, GroupDelta groupDelta) throws ConfigInvalidException, IOException, DuplicateKeyException {
// This method is only executed on a new server which doesn't have any accounts or groups.
AuditLogFormatter auditLogFormatter = AuditLogFormatter.createBackedBy(ImmutableSet.of(), ImmutableSet.of(), serverId);
GroupConfig groupConfig = GroupConfig.createForNewGroup(allUsersName, allUsersRepo, groupCreation);
groupConfig.setGroupDelta(groupDelta, auditLogFormatter);
AccountGroup.NameKey groupName = groupDelta.getName().orElseGet(groupCreation::getNameKey);
GroupNameNotes groupNameNotes = GroupNameNotes.forNewGroup(allUsersName, allUsersRepo, groupCreation.getGroupUUID(), groupName);
commit(allUsersRepo, groupConfig, groupNameNotes);
return groupConfig.getLoadedGroup().orElseThrow(() -> new IllegalStateException("Created group wasn't automatically loaded"));
}
use of com.google.gerrit.server.group.db.AuditLogFormatter in project gerrit by GerritCodeReview.
the class GroupsOnInit method addGroupMemberInNoteDb.
private void addGroupMemberInNoteDb(Repository repository, AccountGroup.UUID groupUuid, Account account) throws IOException, ConfigInvalidException, NoSuchGroupException {
GroupConfig groupConfig = GroupConfig.loadForGroup(allUsers, repository, groupUuid);
InternalGroup group = groupConfig.getLoadedGroup().orElseThrow(() -> new NoSuchGroupException(groupUuid));
GroupDelta groupDelta = getMemberAdditionDelta(account);
AuditLogFormatter auditLogFormatter = getAuditLogFormatter(account);
groupConfig.setGroupDelta(groupDelta, auditLogFormatter);
commit(repository, groupConfig, group.getCreatedOn());
}
Aggregations