Search in sources :

Example 1 with ImmutableChangeLog

use of org.finos.waltz.model.changelog.ImmutableChangeLog 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);
}
Also used : AuthoritativenessRatingValue(org.finos.waltz.model.rating.AuthoritativenessRatingValue) java.util(java.util) LogicalFlowDao(org.finos.waltz.data.logical_flow.LogicalFlowDao) org.finos.waltz.model(org.finos.waltz.model) LoggerFactory(org.slf4j.LoggerFactory) LocalDateTime(java.time.LocalDateTime) LOGICAL_DATA_FLOW(org.finos.waltz.model.EntityKind.LOGICAL_DATA_FLOW) Autowired(org.springframework.beans.factory.annotation.Autowired) ListUtilities.newArrayList(org.finos.waltz.common.ListUtilities.newArrayList) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) Supplier(java.util.function.Supplier) EntityReference.mkRef(org.finos.waltz.model.EntityReference.mkRef) DataType(org.finos.waltz.model.datatype.DataType) Tuple2(org.jooq.lambda.tuple.Tuple2) Future(java.util.concurrent.Future) ChangeLog(org.finos.waltz.model.changelog.ChangeLog) Record1(org.jooq.Record1) Service(org.springframework.stereotype.Service) DataTypeIdSelectorFactory(org.finos.waltz.data.data_type.DataTypeIdSelectorFactory) TallyPack(org.finos.waltz.model.tally.TallyPack) DataTypeService(org.finos.waltz.service.data_type.DataTypeService) DataTypeUsageService(org.finos.waltz.service.usage_info.DataTypeUsageService) ApplicationIdSelectorFactory(org.finos.waltz.data.application.ApplicationIdSelectorFactory) Select(org.jooq.Select) ChangeLogService(org.finos.waltz.service.changelog.ChangeLogService) Unchecked(org.jooq.lambda.Unchecked) Logger(org.slf4j.Logger) CollectionUtilities.isEmpty(org.finos.waltz.common.CollectionUtilities.isEmpty) Collections.emptyList(java.util.Collections.emptyList) ImmutableDataTypeDecorator(org.finos.waltz.model.datatype.ImmutableDataTypeDecorator) org.finos.waltz.model.logical_flow(org.finos.waltz.model.logical_flow) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) DBExecutorPoolInterface(org.finos.waltz.data.DBExecutorPoolInterface) LogicalFlowIdSelectorFactory(org.finos.waltz.data.logical_flow.LogicalFlowIdSelectorFactory) Collectors.toList(java.util.stream.Collectors.toList) Checks.checkNotNull(org.finos.waltz.common.Checks.checkNotNull) LogicalFlowDecoratorDao(org.finos.waltz.data.datatype_decorator.LogicalFlowDecoratorDao) Stream(java.util.stream.Stream) Tuple.tuple(org.jooq.lambda.tuple.Tuple.tuple) DateTimeUtilities.nowUtc(org.finos.waltz.common.DateTimeUtilities.nowUtc) FunctionUtilities(org.finos.waltz.common.FunctionUtilities) SetUtilities(org.finos.waltz.common.SetUtilities) DATA_TYPE(org.finos.waltz.model.EntityKind.DATA_TYPE) LogicalFlowStatsDao(org.finos.waltz.data.logical_flow.LogicalFlowStatsDao) SetUtilities.fromCollection(org.finos.waltz.common.SetUtilities.fromCollection) LocalDateTime(java.time.LocalDateTime) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ChangeLog(org.finos.waltz.model.changelog.ChangeLog)

Example 2 with ImmutableChangeLog

use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.

the class MeasurableRelationshipService method writeLog.

private void writeLog(Operation op, EntityReference a, String message, String username) {
    ImmutableChangeLog logEntry = ImmutableChangeLog.builder().severity(Severity.INFORMATION).operation(op).parentReference(a).userId(username).message(message).build();
    changeLogService.write(logEntry);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Example 3 with ImmutableChangeLog

use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.

the class DataTypeDecoratorService method audit.

private void audit(String message, EntityReference entityReference, String username) {
    ImmutableChangeLog logEntry = ImmutableChangeLog.builder().parentReference(entityReference).userId(username).severity(Severity.INFORMATION).message(message).childKind(EntityKind.DATA_TYPE).operation(Operation.UPDATE).build();
    changeLogService.write(logEntry);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Example 4 with ImmutableChangeLog

use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.

the class PhysicalFlowParticipantService method auditChange.

private void auditChange(String message, EntityReference ref, String username, Operation operation) {
    ImmutableChangeLog logEntry = ImmutableChangeLog.builder().parentReference(ref).severity(Severity.INFORMATION).userId(username).message(message).operation(operation).build();
    changeLogService.write(logEntry);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog)

Example 5 with ImmutableChangeLog

use of org.finos.waltz.model.changelog.ImmutableChangeLog in project waltz by khartec.

the class ThumbnailService method auditChange.

private void auditChange(String verb, EntityReference parentRef, String username, Operation operation) {
    ImmutableChangeLog logEntry = ImmutableChangeLog.builder().parentReference(parentRef).severity(Severity.INFORMATION).userId(username).message(format("Thumbnail %s", verb)).childKind(parentRef.kind()).operation(operation).build();
    changeLogService.write(logEntry);
}
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