Search in sources :

Example 26 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class FlowDiagramService method makeForPhysicalSpecification.

private Long makeForPhysicalSpecification(EntityReference ref, String userId, String providedTitle) {
    PhysicalSpecification spec = physicalSpecificationDao.getById(ref.id());
    Select<Record1<Long>> logicalFlowSelector = logicalFlowIdSelectorFactory.apply(mkOpts(ref, HierarchyQueryScope.EXACT));
    List<LogicalFlow> logicalFlows = logicalFlowDao.findBySelector(logicalFlowSelector);
    List<PhysicalFlow> physicalFlows = physicalFlowDao.findBySpecificationId(ref.id());
    List<EntityReference> nodes = logicalFlows.stream().flatMap(f -> Stream.of(f.source(), f.target())).distinct().collect(toList());
    List<FlowDiagramEntity> entities = ListUtilities.concat(map(logicalFlows, d -> mkDiagramEntity(d)), map(physicalFlows, d -> mkDiagramEntity(d)), newArrayList(mkDiagramEntity(spec)), map(nodes, d -> mkDiagramEntity(d)));
    String title = isEmpty(providedTitle) ? spec.name() + " flows" : providedTitle;
    return mkNewFlowDiagram(title, userId, entities, emptyList());
}
Also used : ChangeInitiative(org.finos.waltz.model.change_initiative.ChangeInitiative) LogicalFlowDao(org.finos.waltz.data.logical_flow.LogicalFlowDao) org.finos.waltz.model(org.finos.waltz.model) Autowired(org.springframework.beans.factory.annotation.Autowired) ListUtilities.newArrayList(org.finos.waltz.common.ListUtilities.newArrayList) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) PhysicalFlow(org.finos.waltz.model.physical_flow.PhysicalFlow) StringUtilities.isEmpty(org.finos.waltz.common.StringUtilities.isEmpty) EntityReference.mkRef(org.finos.waltz.model.EntityReference.mkRef) Measurable(org.finos.waltz.model.measurable.Measurable) Record1(org.jooq.Record1) FlowDiagramDao(org.finos.waltz.data.flow_diagram.FlowDiagramDao) Select(org.jooq.Select) org.finos.waltz.model.flow_diagram(org.finos.waltz.model.flow_diagram) ChangeInitiativeDao(org.finos.waltz.data.change_initiative.ChangeInitiativeDao) MeasurableDao(org.finos.waltz.data.measurable.MeasurableDao) Collections.emptyList(java.util.Collections.emptyList) String.format(java.lang.String.format) Collectors.joining(java.util.stream.Collectors.joining) ApplicationDao(org.finos.waltz.data.application.ApplicationDao) ListUtilities.map(org.finos.waltz.common.ListUtilities.map) Stream(java.util.stream.Stream) DateTimeUtilities.nowUtc(org.finos.waltz.common.DateTimeUtilities.nowUtc) SetUtilities(org.finos.waltz.common.SetUtilities) PhysicalSpecification(org.finos.waltz.model.physical_specification.PhysicalSpecification) Actor(org.finos.waltz.model.actor.Actor) java.util(java.util) FlowDiagramAnnotationDao(org.finos.waltz.data.flow_diagram.FlowDiagramAnnotationDao) PhysicalFlowDao(org.finos.waltz.data.physical_flow.PhysicalFlowDao) EntitySearchOptions(org.finos.waltz.model.entity_search.EntitySearchOptions) DataType(org.finos.waltz.model.datatype.DataType) ChangeLog(org.finos.waltz.model.changelog.ChangeLog) Service(org.springframework.stereotype.Service) PhysicalSpecificationDao(org.finos.waltz.data.physical_specification.PhysicalSpecificationDao) DataTypeService(org.finos.waltz.service.data_type.DataTypeService) ChangeLogService(org.finos.waltz.service.changelog.ChangeLogService) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) Application(org.finos.waltz.model.application.Application) IdSelectionOptions.mkOpts(org.finos.waltz.model.IdSelectionOptions.mkOpts) FlowDiagramEntityDao(org.finos.waltz.data.flow_diagram.FlowDiagramEntityDao) FLOW_DIAGRAM(org.finos.waltz.model.EntityKind.FLOW_DIAGRAM) RandomUtilities(org.finos.waltz.common.RandomUtilities) LogicalFlowIdSelectorFactory(org.finos.waltz.data.logical_flow.LogicalFlowIdSelectorFactory) Collectors.toList(java.util.stream.Collectors.toList) Checks.checkNotNull(org.finos.waltz.common.Checks.checkNotNull) ActorDao(org.finos.waltz.data.actor.ActorDao) DateTimeUtilities(org.finos.waltz.common.DateTimeUtilities) ListUtilities(org.finos.waltz.common.ListUtilities) FlowDiagramIdSelectorFactory(org.finos.waltz.data.flow_diagram.FlowDiagramIdSelectorFactory) InvalidResultException(org.jooq.exception.InvalidResultException) PhysicalSpecification(org.finos.waltz.model.physical_specification.PhysicalSpecification) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) PhysicalFlow(org.finos.waltz.model.physical_flow.PhysicalFlow) Record1(org.jooq.Record1)

Example 27 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class ChangeLogService method writeChangeLogEntries.

public void writeChangeLogEntries(EntityReference ref, String userId, String postamble, Operation operation) {
    switch(ref.kind()) {
        case PHYSICAL_FLOW:
            PhysicalFlow physicalFlow = physicalFlowDao.getById(ref.id());
            writeChangeLogEntries(physicalFlow, userId, postamble, operation);
            break;
        case LOGICAL_DATA_FLOW:
            LogicalFlow logicalFlow = logicalFlowDao.getByFlowId(ref.id());
            writeChangeLogEntries(logicalFlow, userId, postamble, operation);
            break;
        case MEASURABLE_RATING_REPLACEMENT:
            MeasurableRatingReplacement measurableRatingReplacement = measurableRatingReplacementdao.getById(ref.id());
            writeChangeLogEntries(measurableRatingReplacement, userId, postamble, operation);
            break;
        case MEASURABLE_RATING_PLANNED_DECOMMISSION:
            MeasurableRatingPlannedDecommission measurableRatingPlannedDecommission = measurableRatingPlannedDecommissionDao.getById(ref.id());
            writeChangeLogEntries(measurableRatingPlannedDecommission, userId, postamble, operation);
        default:
    }
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) MeasurableRatingReplacement(org.finos.waltz.model.measurable_rating_replacement.MeasurableRatingReplacement) MeasurableRatingPlannedDecommission(org.finos.waltz.model.measurable_rating_planned_decommission.MeasurableRatingPlannedDecommission) PhysicalFlow(org.finos.waltz.model.physical_flow.PhysicalFlow)

Example 28 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class LogicalFlowDecoratorRatingsCalculator method lookupFlowClassificationRule.

private Optional<Long> lookupFlowClassificationRule(Map<Long, DataType> typesById, Map<Long, LogicalFlow> flowsById, Map<Long, Application> targetAppsById, FlowClassificationRuleResolver resolver, DataTypeDecorator decorator) {
    LogicalFlow flow = flowsById.get(decorator.dataFlowId());
    EntityReference vantagePoint = lookupVantagePoint(targetAppsById, flow);
    EntityReference source = flow.source();
    Optional<FlowClassificationRuleVantagePoint> flowClassificationRuleVantagePoint = resolver.resolveAuthSource(vantagePoint, source, decorator.dataTypeId());
    return flowClassificationRuleVantagePoint.map(FlowClassificationRuleVantagePoint::ruleId);
}
Also used : FlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference)

Example 29 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class LogicalFlowDecoratorRatingsCalculator method lookupRating.

private AuthoritativenessRatingValue lookupRating(Map<Long, LogicalFlow> flowsById, Map<Long, Application> targetAppsById, FlowClassificationRuleResolver resolver, DataTypeDecorator decorator) {
    LogicalFlow flow = flowsById.get(decorator.dataFlowId());
    EntityReference vantagePoint = lookupVantagePoint(targetAppsById, flow);
    EntityReference source = flow.source();
    return resolver.resolve(vantagePoint, source, decorator.decoratorEntity().id());
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference)

Example 30 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class DataTypeDecoratorService method recalculateDataTypeUsageForApplications.

private void recalculateDataTypeUsageForApplications(EntityReference associatedEntityReference) {
    if (LOGICAL_DATA_FLOW.equals(associatedEntityReference.kind())) {
        LogicalFlow flow = logicalFlowDao.getByFlowId(associatedEntityReference.id());
        dataTypeUsageService.recalculateForApplications(newArrayList(flow.source(), flow.target()));
    }
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow)

Aggregations

LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)72 BaseInMemoryIntegrationTest (org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest)52 Test (org.junit.jupiter.api.Test)52 EntityReference (org.finos.waltz.model.EntityReference)40 PhysicalSpecification (org.finos.waltz.model.physical_specification.PhysicalSpecification)21 ImmutablePhysicalSpecification (org.finos.waltz.model.physical_specification.ImmutablePhysicalSpecification)15 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)13 DataTypeDecorator (org.finos.waltz.model.datatype.DataTypeDecorator)13 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)13 Autowired (org.springframework.beans.factory.annotation.Autowired)13 Collections.emptyList (java.util.Collections.emptyList)12 List (java.util.List)12 SetUtilities.map (org.finos.waltz.common.SetUtilities.map)12 Collection (java.util.Collection)11 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)11 Collections.emptySet (java.util.Collections.emptySet)10 SetUtilities.asSet (org.finos.waltz.common.SetUtilities.asSet)10 Assertions (org.junit.jupiter.api.Assertions)10 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)9 org.finos.waltz.integration_test.inmem.helpers (org.finos.waltz.integration_test.inmem.helpers)9