Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db contrib/waltz 7047 add inbound ratings to flow view and euma select #7057

Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class LogicalFlowDecoratorDao extends DataTypeDecoratorDao {
record.getDecoratorEntityId(),
r.get(ENTITY_NAME_FIELD)))
.rating(AuthoritativenessRatingValue.ofNullable(record.getRating()))
.targetInboundRating(AuthoritativenessRatingValue.of(record.getTargetInboundRating()))
.provenance(record.getProvenance())
.lastUpdatedAt(record.getLastUpdatedAt().toLocalDateTime())
.lastUpdatedBy(record.getLastUpdatedBy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.jooq.SelectConditionStep;
import org.jooq.SelectOnConditionStep;
import org.jooq.SelectSeekStep2;
import org.jooq.SelectSeekStep5;
import org.jooq.SelectSeekStep6;
import org.jooq.UpdateConditionStep;
import org.jooq.UpdateSetMoreStep;
Expand Down Expand Up @@ -103,16 +102,8 @@ public class FlowClassificationRuleDao {

private final static EntityHierarchy ehOrgUnit = ENTITY_HIERARCHY.as("ehOrgUnit");
private final static EntityHierarchy ehDataType = ENTITY_HIERARCHY.as("ehDataType");
private final static org.finos.waltz.schema.tables.DataType declaredDataType = org.finos.waltz.schema.tables.DataType.DATA_TYPE.as("declaredDataType");
private final static org.finos.waltz.schema.tables.DataType impliedDataType = org.finos.waltz.schema.tables.DataType.DATA_TYPE.as("impliedDataType");

private final static Field<Long> declaredOrgUnitId = ehOrgUnit.ID.as("declaredOrgUnitId");
public static final Field<Long> vantagePointId = DSL.coalesce(ehOrgUnit.ID, FLOW_CLASSIFICATION_RULE.PARENT_ID);
private final static Field<Integer> declaredOrgUnitLevel = ehOrgUnit.LEVEL.as("declaredOrgUnitLevel");
public static final Field<Integer> vantagePointLevel = DSL.coalesce(ehOrgUnit.LEVEL, 0).as("parentLevel");
private final static Field<Long> declaredDataTypeId = ehDataType.ID.as("declaredDataTypeId");
private final static Field<Integer> declaredDataTypeLevel = ehDataType.LEVEL.as("declaredDataTypeLevel");

private static final Field<String> PARENT_NAME_FIELD = InlineSelectFieldFactory.mkNameField(
FLOW_CLASSIFICATION_RULE.PARENT_ID,
FLOW_CLASSIFICATION_RULE.PARENT_KIND,
Expand Down Expand Up @@ -180,7 +171,7 @@ public class FlowClassificationRuleDao {
.subjectReference(mkRef(EntityKind.valueOf(r.get(FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_KIND)), r.get(FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_ID)))
.classificationCode(r.get(FLOW_CLASSIFICATION.CODE))
.dataType(mkRef(EntityKind.DATA_TYPE, r.get(ehDataType.ID)))
.dataTypeRank(r.get(declaredDataTypeLevel))
.dataTypeRank(r.get(ehDataType.LEVEL))
.ruleId(r.get(FLOW_CLASSIFICATION_RULE.ID))
.build();

Expand Down Expand Up @@ -368,37 +359,30 @@ public List<FlowClassificationRuleVantagePoint> findExpandedFlowClassificationRu
.or(actorVantagePointCondition)
.or(orgUnitVantagePointCondition);

SelectSeekStep5<Record9<Long, String, Integer, Long, Integer, Long, String, String, Long>, String, Integer, Integer, Long, Long> select = dsl
SelectConditionStep<Record9<Long, String, Integer, Long, Integer, Long, String, String, Long>> select = dsl
.select(vantagePointId,
FLOW_CLASSIFICATION_RULE.PARENT_KIND,
vantagePointLevel,
ehDataType.ID,
declaredDataTypeLevel,
ehDataType.LEVEL,
FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_ID,
FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_KIND,
FLOW_CLASSIFICATION.CODE,
FLOW_CLASSIFICATION_RULE.ID)
.from(FLOW_CLASSIFICATION_RULE)
.leftJoin(ehOrgUnit)
.on(ehOrgUnit.ANCESTOR_ID.eq(FLOW_CLASSIFICATION_RULE.PARENT_ID)
.and(ehOrgUnit.KIND.eq(EntityKind.ORG_UNIT.name())
.and(FLOW_CLASSIFICATION_RULE.PARENT_KIND.eq(EntityKind.ORG_UNIT.name()))))
.innerJoin(declaredDataType)
.on(declaredDataType.ID.eq(FLOW_CLASSIFICATION_RULE.DATA_TYPE_ID))
.innerJoin(FLOW_CLASSIFICATION).on(FLOW_CLASSIFICATION.DIRECTION.eq(direction.name())
.and(FLOW_CLASSIFICATION_RULE.FLOW_CLASSIFICATION_ID.eq(FLOW_CLASSIFICATION.ID)))
.innerJoin(ehDataType)
.on(ehDataType.ANCESTOR_ID.eq(declaredDataType.ID).and(ehDataType.KIND.eq(EntityKind.DATA_TYPE.name())))
.innerJoin(FLOW_CLASSIFICATION).on(FLOW_CLASSIFICATION_RULE.FLOW_CLASSIFICATION_ID.eq(FLOW_CLASSIFICATION.ID))
.where(FLOW_CLASSIFICATION.DIRECTION.eq(direction.name())
.and(vantagePointCondition))
.orderBy(
FLOW_CLASSIFICATION_RULE.PARENT_KIND,
ehOrgUnit.LEVEL.desc(),
ehDataType.LEVEL.desc(),
ehOrgUnit.ID,
ehDataType.ID);
.on(ehDataType.KIND.eq(EntityKind.DATA_TYPE.name())
.and(ehDataType.ANCESTOR_ID.eq(FLOW_CLASSIFICATION_RULE.DATA_TYPE_ID)))
.leftJoin(ehOrgUnit)
.on(FLOW_CLASSIFICATION_RULE.PARENT_KIND.eq(EntityKind.ORG_UNIT.name())
.and(ehOrgUnit.KIND.eq(EntityKind.ORG_UNIT.name())
.and(ehOrgUnit.ANCESTOR_ID.eq(FLOW_CLASSIFICATION_RULE.PARENT_ID)
.and(ehOrgUnit.ID.in(orgVantagePointIds)))))
.where(vantagePointCondition);

return select
.fetch(TO_VANTAGE_MAPPER);
return select.fetch(TO_VANTAGE_MAPPER);
}


Expand All @@ -413,7 +397,7 @@ private List<FlowClassificationRuleVantagePoint> findFlowClassificationRuleVanta
FLOW_CLASSIFICATION_RULE.PARENT_KIND,
vantagePointLevel,
ehDataType.ID,
declaredDataTypeLevel,
ehDataType.LEVEL,
FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_ID,
FLOW_CLASSIFICATION_RULE.SUBJECT_ENTITY_KIND,
FLOW_CLASSIFICATION.CODE,
Expand Down Expand Up @@ -647,9 +631,14 @@ public Set<FlowClassificationRule> findCompanionDataTypeRules(long ruleId) {


public Set<FlowClassificationRule> findAppliedClassificationRulesForFlow(Long logicalFlowId) {
return baseSelect()
SelectConditionStep<Record> outboundRules = baseSelect()
.innerJoin(LOGICAL_FLOW_DECORATOR).on(LOGICAL_FLOW_DECORATOR.FLOW_CLASSIFICATION_RULE_ID.eq(FLOW_CLASSIFICATION_RULE.ID))
.where(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID.eq(logicalFlowId))
.where(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID.eq(logicalFlowId));
SelectConditionStep<Record> inboundRules = baseSelect()
.innerJoin(LOGICAL_FLOW_DECORATOR).on(LOGICAL_FLOW_DECORATOR.INBOUND_FLOW_CLASSIFICATION_RULE_ID.eq(FLOW_CLASSIFICATION_RULE.ID))
.where(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID.eq(logicalFlowId));
return outboundRules
.union(inboundRules)
.fetchSet(TO_DOMAIN_MAPPER);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public static void main(String[] args) {
Set<DataTypeDecoratorRatingCharacteristics> calculated = calc.calculate(waltz, apptio, Optional.empty());
System.out.printf("Calculated %d\n", calculated.size());

System.out.println(calculated);
// System.exit(-1);
}

Expand Down
11 changes: 6 additions & 5 deletions waltz-ng/client/common/svelte/DataTypeNodeTooltipContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import Icon from "./Icon.svelte";
import RatingIndicatorCell from "../../ratings/components/rating-indicator-cell/RatingIndicatorCell.svelte";
import _ from "lodash";
import DescriptionFade from "./DescriptionFade.svelte";

export let name;
export let description;
Expand All @@ -21,33 +22,33 @@
</div>
<div class="row">
<div class="col-sm-12">
{description}
<DescriptionFade text={description}/>
</div>
</div>
{#if !_.isEmpty(ratingCharacteristics)}
<hr>
{/if}
{#if ratingCharacteristics}
<div class="row">
<div class="col-sm-4">Source Outbound Rating:</div>
<div class="col-sm-4">Producer Rating:</div>
<div class="col-sm-8">
<RatingIndicatorCell {...ratingCharacteristics.sourceOutboundClassification} showName={true}/>
</div>
</div>
<div class="row">
<div class="col-sm-12 help-block small">
This describes the rating of the data flow looking at outbound flow classification rules from the upstream entity.
This indicates the rating of the flow according whether this source entity is authorised to distribute this data type
</div>
</div>
<div class="row">
<div class="col-sm-4">Target Inbound Rating:</div>
<div class="col-sm-4">Consumer Rating:</div>
<div class="col-sm-8">
<RatingIndicatorCell {...ratingCharacteristics.targetInboundClassification} showName={true}/>
</div>
</div>
<div class="row">
<div class="col-sm-12 help-block small">
This describes the rating of the data flow looking at inbound flow classification rules for the downstream target entity.
This rating expresses whether the target entity has a preference for or against this type of data being sent to it
</div>
</div>
{/if}
Expand Down
8 changes: 7 additions & 1 deletion waltz-ng/client/common/svelte/DataTypeTreeNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
{/if}

{#if expanded || node.isExpanded}
<ul>
<ul class:root={isRoot}>
{#each sortedNodes as childNode}
<li>
{#if childNode.children.length > 0}
Expand Down Expand Up @@ -179,5 +179,11 @@
border-left: 1px solid #eee;
}

.root {
border-left: none;
padding-left: 0;
margin-left: 0;
}


</style>
7 changes: 5 additions & 2 deletions waltz-ng/client/common/svelte/DataTypeTreeSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
export let dataTypeIds = [];
export let ratingCharacteristics = [];
export let usageCharacteristics = [];
export let showSearch = true;

const root = {name: "Root", isExpanded: true};

Expand Down Expand Up @@ -61,9 +62,11 @@

</script>

<SearchInput bind:value={qry}/>
{#if showSearch}
<SearchInput bind:value={qry}/>
{/if}

<div class="waltz-scroll-region-350">
<div class:waltz-scroll-region-350={showSearch}>
<DataTypeTreeNode {multiSelect}
{selectionFilter}
{nonConcreteSelectable}
Expand Down
1 change: 1 addition & 0 deletions waltz-ng/client/common/svelte/EntitySearchSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
localFiltering={false}
{placeholder}
{showClear}
className="waltz-search-input"
bind:selectedItem={selectedItem} />
39 changes: 39 additions & 0 deletions waltz-ng/client/common/svelte/FlowRatingCell.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script>

import _ from "lodash";

export let sourceOutboundClassification;
export let targetInboundClassification;

</script>

<div style="display: inline-block; width: 10px;">
<svg width="100%"
height="100%"
preserveAspectRatio="xMidYMin"
style="vertical-align: middle"
viewbox="0 0 100 100">
{#if _.isEmpty(sourceOutboundClassification) || sourceOutboundClassification.code === "NO_OPINION"}
<polygon stroke="black"
stroke-width="5"
fill="none"
points="0,0 0,100 100,0" />
{:else}
<polygon fill={sourceOutboundClassification.color}
stroke="black"
stroke-width="5"
points="0,0 0,100 100,0" />
{/if}
{#if _.isEmpty(targetInboundClassification) || targetInboundClassification.code === "NO_OPINION"}
<polygon stroke="black"
stroke-width="5"
fill="none"
points="0,100 100,100 100,0" />
{:else}
<polygon fill={targetInboundClassification.color}
stroke="black"
stroke-width="5"
points="0,100 100,100 100,0" />
{/if}
</svg>
</div>
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<script>

import Icon from "./Icon.svelte";
import RatingIndicatorCell from "../../ratings/components/rating-indicator-cell/RatingIndicatorCell.svelte";
import FlowRatingCell from "./FlowRatingCell.svelte";

export let ratingCharacteristics;
export let hasDecorator = false;

</script>

<span>
<span class="waltz-visibility-parent">
<span class:waltz-visibility-child-30={!hasDecorator}>
<RatingIndicatorCell {...ratingCharacteristics.sourceOutboundClassification} showName={false}/>
<Icon style="vertical-align: middle"
name="long-arrow-right"
size="xl"/>
<RatingIndicatorCell {...ratingCharacteristics.targetInboundClassification} showName={false}/>
</span>
</span>
</span>
<div style="display: inline-block"
class="waltz-visibility-parent">
<div class:waltz-visibility-child-30={!hasDecorator}>
<FlowRatingCell targetInboundClassification={ratingCharacteristics.targetInboundClassification}
sourceOutboundClassification={ratingCharacteristics.sourceOutboundClassification}/>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@
{#if !isConcrete && !_.isEmpty(usageCharacteristics)}
<span class="waltz-error-icon" title="This data type is non-concrete so should not be mapped to">
<Icon name="exclamation-triangle"
style="vertical-align: middle"
size="xl"/>
style="vertical-align: middle"/>
</span>
{/if}
{#if isEditMode && !_.isEmpty(usageCharacteristics.warningMessageForEditors)}
<span class="waltz-warning-icon" title={usageCharacteristics.warningMessageForEditors}>
<Icon name="exclamation-triangle"
style="vertical-align: middle"
size="xl"/>
style="vertical-align: middle"/>
</span>
{/if}
{#if !isEditMode && !_.isEmpty(usageCharacteristics.warningMessageForViewers)}
<span class="waltz-warning-icon" title={usageCharacteristics.warningMessageForViewers}>
<Icon name="exclamation-triangle"
style="vertical-align: middle"
size="xl"/>
style="vertical-align: middle"/>
</span>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
import Toggle from "../../../common/svelte/Toggle.svelte";
import DataTypeDecoratorViewGrid from "./DataTypeDecoratorViewGrid.svelte";
import {dataTypeDecoratorStore} from "../../../svelte-stores/data-type-decorator-store";
import {
selectedDecorator,
viewData,
enrichedDecorators,
selectedDataType
} from "./data-type-decorator-section-store";
import {prepareData} from "./data-type-decorator-view-grid-utils";
import {selectedDataType, selectedDecorator, viewData} from "./data-type-decorator-section-store";
import {onDestroy, onMount} from "svelte";
import localWritable from "../../../common/svelte/local-writable";

Expand Down Expand Up @@ -54,12 +48,6 @@

$: $viewData = $viewCall?.data;

$: {
if ($viewData) {
$enrichedDecorators = prepareData($viewData);
}
}

</script>

<div class="decorator-section">
Expand Down
Loading
Loading