Search in sources :

Example 1 with ChangeLog

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

Example 2 with ChangeLog

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

Example 3 with ChangeLog

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);
}
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 4 with ChangeLog

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

Example 5 with ChangeLog

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

Aggregations

ChangeLog (org.finos.waltz.model.changelog.ChangeLog)18 ImmutableChangeLog (org.finos.waltz.model.changelog.ImmutableChangeLog)18 String.format (java.lang.String.format)3 java.util (java.util)3 Collectors (java.util.stream.Collectors)3 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)3 org.finos.waltz.model (org.finos.waltz.model)3 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)3 CustomEnvironment (org.finos.waltz.model.custom_environment.CustomEnvironment)3 ChangeLogService (org.finos.waltz.service.changelog.ChangeLogService)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Service (org.springframework.stereotype.Service)3 MapUtilities (org.finos.waltz.common.MapUtilities)2 StringUtilities (org.finos.waltz.common.StringUtilities)2 GenericSelector (org.finos.waltz.data.GenericSelector)2 GenericSelectorFactory (org.finos.waltz.data.GenericSelectorFactory)2 AssessmentDefinitionDao (org.finos.waltz.data.assessment_definition.AssessmentDefinitionDao)2 AssessmentRatingDao (org.finos.waltz.data.assessment_rating.AssessmentRatingDao)2 RatingSchemeDAO (org.finos.waltz.data.rating_scheme.RatingSchemeDAO)2 AssessmentDefinition (org.finos.waltz.model.assessment_definition.AssessmentDefinition)2