use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.
the class PhysicalSpecificationService method logChange.
private void logChange(String userId, EntityReference ref, String message, Operation operation) {
ChangeLog logEntry = ImmutableChangeLog.builder().parentReference(ref).message(message).severity(Severity.INFORMATION).userId(userId).childKind(EntityKind.PHYSICAL_SPECIFICATION).operation(operation).build();
changeLogService.write(logEntry);
}
use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.
the class FlowClassificationRuleService method cleanupOrphans.
public Integer cleanupOrphans(String userId) {
Set<EntityReference> entityReferences = flowClassificationRuleDao.cleanupOrphans();
entityReferences.forEach(ref -> {
String message = ref.kind() == EntityKind.APPLICATION ? "Removed as a flow classification rule source as declaring Org Unit no longer exists" : "Application removed as an flow classification rule source as it no longer exists";
ChangeLog logEntry = ImmutableChangeLog.builder().parentReference(ref).message(message).severity(Severity.INFORMATION).operation(Operation.UPDATE).userId(userId).build();
changeLogService.write(logEntry);
});
return entityReferences.size();
}
use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.
the class LogicalFlowService method addFlows.
public List<LogicalFlow> addFlows(List<AddLogicalFlowCommand> addCmds, String username) {
addCmds.forEach(this::rejectIfSelfLoop);
Set<AddLogicalFlowCommand> toAdd = fromCollection(addCmds);
List<ChangeLog> logEntries = toAdd.stream().flatMap(cmd -> {
ImmutableChangeLog addedSourceParent = ImmutableChangeLog.builder().parentReference(cmd.source()).severity(Severity.INFORMATION).userId(username).message(format("Flow %s between: %s and %s", "added", cmd.source().name().orElse(Long.toString(cmd.source().id())), cmd.target().name().orElse(Long.toString(cmd.target().id())))).childKind(LOGICAL_DATA_FLOW).operation(Operation.ADD).build();
ImmutableChangeLog addedTargetParent = addedSourceParent.withParentReference(cmd.target());
return Stream.of(addedSourceParent, addedTargetParent);
}).collect(Collectors.toList());
changeLogService.write(logEntries);
LocalDateTime now = nowUtc();
List<LogicalFlow> flowsToAdd = toAdd.stream().map(addCmd -> ImmutableLogicalFlow.builder().source(addCmd.source()).target(addCmd.target()).lastUpdatedAt(now).lastUpdatedBy(username).created(UserTimestamp.mkForUser(username, now)).provenance("waltz").build()).collect(toList());
return logicalFlowDao.addFlows(flowsToAdd, username);
}
use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.
the class CustomEnvironmentService method create.
public Long create(CustomEnvironment env, String username) throws InsufficientPrivelegeException {
ensureUserHasPermission(env, username, Operation.ADD);
Long created = customEnvironmentDao.create(env);
String message = format("Created new custom environment: %s/%s", env.groupName(), env.name());
ChangeLog changeLog = mkChangeLog(env.owningEntity(), username, message, Operation.ADD);
changeLogService.write(changeLog);
return created;
}
use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.
the class EntityNamedNoteService method logMsg.
private void logMsg(EntityReference ref, String username, Operation op, String msg) {
ChangeLog logEntry = ImmutableChangeLog.builder().userId(username).parentReference(ref).operation(op).message(msg).severity(Severity.INFORMATION).build();
changeLogService.write(logEntry);
}
Aggregations