Search in sources :

Example 6 with ImmutableChangeLog

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());
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) Person(org.finos.waltz.model.person.Person)

Example 7 with ImmutableChangeLog

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);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Example 8 with ImmutableChangeLog

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);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Example 9 with ImmutableChangeLog

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);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Aggregations

ImmutableChangeLog (org.finos.waltz.model.changelog.ImmutableChangeLog)9 String.format (java.lang.String.format)1 LocalDateTime (java.time.LocalDateTime)1 java.util (java.util)1 Collections.emptyList (java.util.Collections.emptyList)1 Future (java.util.concurrent.Future)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 Stream (java.util.stream.Stream)1 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)1 CollectionUtilities.isEmpty (org.finos.waltz.common.CollectionUtilities.isEmpty)1 DateTimeUtilities.nowUtc (org.finos.waltz.common.DateTimeUtilities.nowUtc)1 FunctionUtilities (org.finos.waltz.common.FunctionUtilities)1 ListUtilities.newArrayList (org.finos.waltz.common.ListUtilities.newArrayList)1 SetUtilities (org.finos.waltz.common.SetUtilities)1 SetUtilities.fromCollection (org.finos.waltz.common.SetUtilities.fromCollection)1 DBExecutorPoolInterface (org.finos.waltz.data.DBExecutorPoolInterface)1 ApplicationIdSelectorFactory (org.finos.waltz.data.application.ApplicationIdSelectorFactory)1 DataTypeIdSelectorFactory (org.finos.waltz.data.data_type.DataTypeIdSelectorFactory)1