Search in sources :

Example 6 with FlowClassificationRuleVantagePoint

use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.

the class FlowClassificationRuleResolverTest method existingEntriesThenReturnsMostSpecificRating.

@Test
public void existingEntriesThenReturnsMostSpecificRating() {
    List<FlowClassificationRuleVantagePoint> vantagePoints = new ArrayList<>();
    vantagePoints.add(ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(1).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(2).applicationId(205L).classificationCode(AuthoritativenessRatingValue.of("PRIMARY").value()).ruleId(1L).build());
    vantagePoints.add(ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(2).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(3).applicationId(200L).classificationCode(AuthoritativenessRatingValue.of("SECONDARY").value()).ruleId(1L).build());
    FlowClassificationRuleResolver flowClassificationRuleResolver = new FlowClassificationRuleResolver(vantagePoints);
    AuthoritativenessRatingValue rating = flowClassificationRuleResolver.resolve(vantagePoint, sourceApp, 20L);
    assertEquals(AuthoritativenessRatingValue.of("SECONDARY"), rating);
}
Also used : ImmutableFlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.ImmutableFlowClassificationRuleVantagePoint) FlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint) AuthoritativenessRatingValue(org.finos.waltz.model.rating.AuthoritativenessRatingValue) ListUtilities.newArrayList(org.finos.waltz.common.ListUtilities.newArrayList) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 7 with FlowClassificationRuleVantagePoint

use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.

the class FlowClassificationRuleResolverTest method getBestRankedIsCorrect.

@Test
public void getBestRankedIsCorrect() {
    ImmutableFlowClassificationRuleVantagePoint rank12 = ImmutableFlowClassificationRuleVantagePoint.builder().vantagePoint(vantagePoint).vantagePointRank(1).dataType(EntityReference.mkRef(EntityKind.DATA_TYPE, 20)).dataTypeRank(2).applicationId(205L).classificationCode(AuthoritativenessRatingValue.of("PRIMARY").value()).ruleId(1L).build();
    ImmutableFlowClassificationRuleVantagePoint rank22 = rank12.withVantagePointRank(2);
    ImmutableFlowClassificationRuleVantagePoint rank11 = rank12.withDataTypeRank(1);
    Optional<FlowClassificationRuleVantagePoint> bestRankedOrgUnit = getMostSpecificRanked(newArrayList(rank12, rank22));
    Optional<FlowClassificationRuleVantagePoint> bestRankedDataType = getMostSpecificRanked(newArrayList(rank12, rank11));
    assertTrue(bestRankedOrgUnit.isPresent());
    assertEquals(rank22, bestRankedOrgUnit.get());
    assertTrue(bestRankedDataType.isPresent());
    assertEquals(rank12, bestRankedDataType.get());
}
Also used : ImmutableFlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.ImmutableFlowClassificationRuleVantagePoint) FlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint) ImmutableFlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.ImmutableFlowClassificationRuleVantagePoint) Test(org.junit.jupiter.api.Test)

Example 8 with FlowClassificationRuleVantagePoint

use of org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint in project waltz by khartec.

the class LogicalFlowDecoratorRatingsCalculator method createResolver.

private FlowClassificationRuleResolver createResolver(Collection<Application> targetApps) {
    Set<Long> orgIds = map(targetApps, app -> app.organisationalUnitId());
    List<FlowClassificationRuleVantagePoint> flowClassificationRuleVantagePoints = flowClassificationRuleDao.findExpandedFlowClassificationRuleVantagePoints(orgIds);
    FlowClassificationRuleResolver resolver = new FlowClassificationRuleResolver(flowClassificationRuleVantagePoints);
    return resolver;
}
Also used : FlowClassificationRuleVantagePoint(org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint) FlowClassificationRuleResolver(org.finos.waltz.service.flow_classification_rule.FlowClassificationRuleResolver)

Aggregations

FlowClassificationRuleVantagePoint (org.finos.waltz.model.flow_classification_rule.FlowClassificationRuleVantagePoint)8 ListUtilities.newArrayList (org.finos.waltz.common.ListUtilities.newArrayList)5 ImmutableFlowClassificationRuleVantagePoint (org.finos.waltz.model.flow_classification_rule.ImmutableFlowClassificationRuleVantagePoint)5 AuthoritativenessRatingValue (org.finos.waltz.model.rating.AuthoritativenessRatingValue)5 Test (org.junit.jupiter.api.Test)5 ArrayList (java.util.ArrayList)4 EntityReference (org.finos.waltz.model.EntityReference)2 String.format (java.lang.String.format)1 Timestamp (java.sql.Timestamp)1 Collection (java.util.Collection)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors.toList (java.util.stream.Collectors.toList)1 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)1 SetUtilities (org.finos.waltz.common.SetUtilities)1 InlineSelectFieldFactory (org.finos.waltz.data.InlineSelectFieldFactory)1 LOGICAL_NOT_REMOVED (org.finos.waltz.data.logical_flow.LogicalFlowDao.LOGICAL_NOT_REMOVED)1 EntityKind (org.finos.waltz.model.EntityKind)1