use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.
the class UserRoleService method updateRoles.
public boolean updateRoles(String userName, String targetUserName, UpdateRolesCommand command) {
LOG.info("Updating roles for userName: {}, new roles: {}", targetUserName, command.roles());
Person person = personService.getPersonByUserId(targetUserName);
if (person == null) {
LOG.warn("{} does not exist, cannot create audit log for role updates", targetUserName);
} else {
ImmutableChangeLog logEntry = ImmutableChangeLog.builder().parentReference(mkRef(EntityKind.PERSON, person.id().get())).severity(Severity.INFORMATION).userId(userName).message(format("Roles for %s updated to %s. Comment: %s", targetUserName, sort(command.roles()), StringUtilities.ifEmpty(command.comment(), "none"))).childKind(Optional.empty()).operation(Operation.UPDATE).build();
changeLogService.write(logEntry);
}
return userRoleDao.updateRoles(targetUserName, command.roles());
}
use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.
the class InvolvementService method logChange.
private void logChange(EntityReference entityReference, String userId, EntityInvolvementChangeCommand command) {
String message = String.format("Involvement kind (%s) %s for person: %s", resolvePrettyInvolvementKind(command.involvementKindId()), command.operation().name().toLowerCase(), resolveName(command.personEntityRef()));
ImmutableChangeLog changeLog = ImmutableChangeLog.builder().parentReference(entityReference).message(message).userId(userId).childKind(command.personEntityRef().kind()).operation(command.operation()).build();
changeLogService.write(changeLog);
}
use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.
the class FlowDiagramService method auditChange.
private void auditChange(String verb, EntityReference diagramRef, String username, Operation operation) {
ImmutableChangeLog logEntry = ImmutableChangeLog.builder().parentReference(diagramRef).severity(Severity.INFORMATION).userId(username).message(format("Diagram %s", verb)).childKind(diagramRef.kind()).operation(operation).build();
changeLogService.write(logEntry);
}
use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.
the class LogicalFlowDecoratorService method mkChangeLogEntries.
private List<ChangeLog> mkChangeLogEntries(String message, LogicalFlow flow, String username) {
checkNotEmpty(message, "message cannot be empty");
checkNotNull(flow, "flow cannot be null");
checkNotEmpty(username, "username cannot be empty");
ImmutableChangeLog sourceCL = ImmutableChangeLog.builder().parentReference(flow.source()).userId(username).severity(Severity.INFORMATION).message(String.format("Logical flow between %s and %s: %s", flow.source().name().orElse(Long.toString(flow.source().id())), flow.target().name().orElse(Long.toString(flow.target().id())), message)).childKind(EntityKind.LOGICAL_DATA_FLOW).operation(Operation.UPDATE).build();
ImmutableChangeLog targetCL = sourceCL.withParentReference(flow.target());
return ListUtilities.newArrayList(sourceCL, targetCL);
}
Aggregations