diff --git a/waltz-data/src/main/java/org/finos/waltz/data/change_unit/ChangeUnitIdSelectorFactory.java b/waltz-data/src/main/java/org/finos/waltz/data/change_unit/ChangeUnitIdSelectorFactory.java index 72104987f5..49ef005b89 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/change_unit/ChangeUnitIdSelectorFactory.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/change_unit/ChangeUnitIdSelectorFactory.java @@ -46,7 +46,8 @@ public Select> apply(IdSelectionOptions options) { switch(options.entityReference().kind()) { case ACTOR: case APPLICATION: - // all physical flows where the app is a source or target + case END_USER_APPLICATION: + // all physical flows where the node is a source or target return mkForFlowEndpoint(options); case ALL: case APP_GROUP: diff --git a/waltz-data/src/main/java/org/finos/waltz/data/flow_diagram/FlowDiagramEntityDao.java b/waltz-data/src/main/java/org/finos/waltz/data/flow_diagram/FlowDiagramEntityDao.java index 9e1d3c61ba..43871a4e94 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/flow_diagram/FlowDiagramEntityDao.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/flow_diagram/FlowDiagramEntityDao.java @@ -63,23 +63,23 @@ public class FlowDiagramEntityDao { EntityKind.ACTOR, EntityKind.CHANGE_INITIATIVE, EntityKind.DATA_TYPE, + EntityKind.END_USER_APPLICATION, EntityKind.LOGICAL_DATA_FLOW, EntityKind.MEASURABLE, EntityKind.PHYSICAL_FLOW); - private static Field ENTITY_NAME_FIELD = InlineSelectFieldFactory.mkNameField( + private static final Field ENTITY_NAME_FIELD = InlineSelectFieldFactory.mkNameField( fde.ENTITY_ID, fde.ENTITY_KIND, POSSIBLE_ENTITY_KINDS); - private static Field ENTITY_LIFECYCLE_PHASE_FIELD = InlineSelectFieldFactory.mkEntityLifecycleField( + private static final Field ENTITY_LIFECYCLE_PHASE_FIELD = InlineSelectFieldFactory.mkEntityLifecycleField( fde.ENTITY_ID, fde.ENTITY_KIND, POSSIBLE_ENTITY_KINDS); - private static final RecordMapper TO_DOMAIN_MAPPER = r -> { FlowDiagramEntityRecord record = r.into(FLOW_DIAGRAM_ENTITY); EntityReference ref = mkRef( diff --git a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowDao.java b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowDao.java index d43a03d6e1..062f4854ef 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowDao.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowDao.java @@ -85,23 +85,23 @@ public class LogicalFlowDao { private static final Field SOURCE_NAME_FIELD = InlineSelectFieldFactory.mkNameField( LOGICAL_FLOW.SOURCE_ENTITY_ID, LOGICAL_FLOW.SOURCE_ENTITY_KIND, - newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR)); + newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR, EntityKind.END_USER_APPLICATION)); private static final Field TARGET_NAME_FIELD = InlineSelectFieldFactory.mkNameField( LOGICAL_FLOW.TARGET_ENTITY_ID, LOGICAL_FLOW.TARGET_ENTITY_KIND, - newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR)); + newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR, EntityKind.END_USER_APPLICATION)); private static final Field SOURCE_EXTERNAL_ID_FIELD = InlineSelectFieldFactory.mkExternalIdField( LOGICAL_FLOW.SOURCE_ENTITY_ID, LOGICAL_FLOW.SOURCE_ENTITY_KIND, - newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR)); + newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR, EntityKind.END_USER_APPLICATION)); private static final Field TARGET_EXTERNAL_ID_FIELD = InlineSelectFieldFactory.mkExternalIdField( LOGICAL_FLOW.TARGET_ENTITY_ID, LOGICAL_FLOW.TARGET_ENTITY_KIND, - newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR)); + newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR, EntityKind.END_USER_APPLICATION)); public static final RecordMapper TO_DOMAIN_MAPPER = r -> { diff --git a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowIdSelectorFactory.java b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowIdSelectorFactory.java index 2a127f1196..1d798eb351 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowIdSelectorFactory.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowIdSelectorFactory.java @@ -18,6 +18,7 @@ package org.finos.waltz.data.logical_flow; +import org.finos.waltz.model.EntityReference; import org.finos.waltz.schema.tables.Application; import org.finos.waltz.data.IdSelectorFactory; import org.finos.waltz.data.SelectorUtilities; @@ -62,7 +63,8 @@ public Select> apply(IdSelectionOptions options) { checkNotNull(options, "options cannot be null"); switch (options.entityReference().kind()) { case ACTOR: - return mkForActor(options); + case END_USER_APPLICATION: + return mkForSpecificNode(options); case ALL: case APPLICATION: case APP_GROUP: @@ -93,14 +95,16 @@ public Select> apply(IdSelectionOptions options) { } } - private Select> mkForActor(IdSelectionOptions options) { + + private Select> mkForSpecificNode(IdSelectionOptions options) { SelectorUtilities.ensureScopeIsExact(options); + EntityReference ref = options.entityReference(); - Condition sourceCondition = LOGICAL_FLOW.SOURCE_ENTITY_ID.eq(options.entityReference().id()) - .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.ACTOR.name())); + Condition sourceCondition = LOGICAL_FLOW.SOURCE_ENTITY_ID.eq(ref.id()) + .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(ref.kind().name())); - Condition targetCondition = LOGICAL_FLOW.TARGET_ENTITY_ID.eq(options.entityReference().id()) - .and(LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(EntityKind.ACTOR.name())); + Condition targetCondition = LOGICAL_FLOW.TARGET_ENTITY_ID.eq(ref.id()) + .and(LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(ref.kind().name())); return DSL .select(LOGICAL_FLOW.ID) diff --git a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowStatsDao.java b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowStatsDao.java index 6ab5f98024..73a44836f7 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowStatsDao.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowStatsDao.java @@ -76,6 +76,7 @@ public class LogicalFlowStatsDao { private static final org.finos.waltz.schema.tables.LogicalFlowDecorator lfd = LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR.as("lfd"); private static final Application counterpart_app = APPLICATION.as("counterpart_app"); private static final Actor counterpart_actor = ACTOR.as("counterpart_actor"); + private static final EndUserApplication counterpart_euc = END_USER_APPLICATION.as("counterpart_euc"); private static final DataType rollup_dt = Tables.DATA_TYPE.as("rollup_dt"); private static final DataType actual_dt = Tables.DATA_TYPE.as("actual_dt"); @@ -256,8 +257,10 @@ public Map> getFlowInfoByDirection(EntityReference Condition sourceAppCondition = lf.SOURCE_ENTITY_ID.eq(counterpart_app.ID).and(lf.SOURCE_ENTITY_KIND.eq(EntityKind.APPLICATION.name())); Condition sourceActorCondition = lf.SOURCE_ENTITY_ID.eq(counterpart_actor.ID).and(lf.SOURCE_ENTITY_KIND.eq(EntityKind.ACTOR.name())); + Condition sourceEucCondition = lf.SOURCE_ENTITY_ID.eq(counterpart_euc.ID).and(lf.SOURCE_ENTITY_KIND.eq(EntityKind.END_USER_APPLICATION.name())); Condition targetAppCondition = lf.TARGET_ENTITY_ID.eq(counterpart_app.ID).and(lf.TARGET_ENTITY_KIND.eq(EntityKind.APPLICATION.name())); Condition targetActorCondition = lf.TARGET_ENTITY_ID.eq(counterpart_actor.ID).and(lf.TARGET_ENTITY_KIND.eq(EntityKind.ACTOR.name())); + Condition targetEucCondition = lf.TARGET_ENTITY_ID.eq(counterpart_euc.ID).and(lf.TARGET_ENTITY_KIND.eq(EntityKind.END_USER_APPLICATION.name())); Condition dataTypeCondition = datatypeId == null ? rollup_dt.PARENT_ID.isNull() : rollup_dt.PARENT_ID.eq(datatypeId); @@ -267,6 +270,7 @@ public Map> getFlowInfoByDirection(EntityReference SelectConditionStep> sourceQry = mkDirectionalQuery( sourceAppCondition, sourceActorCondition, + sourceEucCondition, dataTypeCondition, isDownstream, INBOUND); @@ -274,6 +278,7 @@ public Map> getFlowInfoByDirection(EntityReference SelectConditionStep> targetQry = mkDirectionalQuery( targetAppCondition, targetActorCondition, + targetEucCondition, dataTypeCondition, isUpstream, OUTBOUND); @@ -315,6 +320,7 @@ record -> { private SelectConditionStep> mkDirectionalQuery(Condition appDirectionCondition, Condition actorDirectionCondition, + Condition eucDirectionCondition, Condition dataTypeCondition, Condition parentDirection, FlowDirection direction) { @@ -326,10 +332,13 @@ private SelectConditionStep> apply(IdSelectionOptions options) { case APPLICATION: case ACTOR: case APP_GROUP: + case END_USER_APPLICATION: case CHANGE_INITIATIVE: case MEASURABLE: case ORG_UNIT: diff --git a/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java b/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java index d490fb6e67..ce33e7d16d 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java @@ -51,7 +51,8 @@ public Select> apply(IdSelectionOptions options) { switch(options.entityReference().kind()) { case ACTOR: case APPLICATION: - return mkForApplicationOrActor(options); + case END_USER_APPLICATION: + return mkForSpecificNode(options); case PHYSICAL_FLOW: return mkForPhysicalFlow(options); case LOGICAL_DATA_ELEMENT: @@ -72,7 +73,7 @@ public Select> apply(IdSelectionOptions options) { } - private Select> mkForApplicationOrActor(IdSelectionOptions options) { + private Select> mkForSpecificNode(IdSelectionOptions options) { SelectorUtilities.ensureScopeIsExact(options); Condition lifecycleCondition = options.entityLifecycleStatuses().contains(EntityLifecycleStatus.REMOVED) diff --git a/waltz-data/src/main/java/org/finos/waltz/data/process_diagram/ProcessDiagramIdSelectorFactory.java b/waltz-data/src/main/java/org/finos/waltz/data/process_diagram/ProcessDiagramIdSelectorFactory.java index 37b1ddeed3..0f1327eb2c 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/process_diagram/ProcessDiagramIdSelectorFactory.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/process_diagram/ProcessDiagramIdSelectorFactory.java @@ -42,6 +42,8 @@ public Select> apply(IdSelectionOptions options) { checkNotNull(options, "options cannot be null"); switch(options.entityReference().kind()) { case ACTOR: + case END_USER_APPLICATION: + return mkForSpecificEntity(options); case ALL: case APPLICATION: case CHANGE_INITIATIVE: @@ -58,6 +60,18 @@ public Select> apply(IdSelectionOptions options) { } + private Select> mkForSpecificEntity(IdSelectionOptions options) { + + return DSL + .select(PROCESS_DIAGRAM_ENTITY.DIAGRAM_ID) + .from(PROCESS_DIAGRAM_ENTITY) + .innerJoin(MEASURABLE_RATING).on(PROCESS_DIAGRAM_ENTITY.ENTITY_ID.eq(MEASURABLE_RATING.MEASURABLE_ID) + .and(PROCESS_DIAGRAM_ENTITY.ENTITY_KIND.eq(EntityKind.MEASURABLE.name()))) + .where(MEASURABLE_RATING.ENTITY_ID.eq(options.entityReference().id()) + .and(MEASURABLE_RATING.ENTITY_KIND.eq(options.entityReference().kind().name()))); + } + + private Select> mkViaApplication(IdSelectionOptions options) { Select> relatedApplications = applicationIdSelectorFactory.apply(options); diff --git a/waltz-ng/client/common/entity-utils.js b/waltz-ng/client/common/entity-utils.js index ece55b4de6..428b2f2558 100644 --- a/waltz-ng/client/common/entity-utils.js +++ b/waltz-ng/client/common/entity-utils.js @@ -20,6 +20,9 @@ import _ from "lodash"; import {checkIsEntityRef} from "./checks"; import {CORE_API} from "./services/core-api-utils"; +import {applicationStore} from "../svelte-stores/application-store"; +import {actorStore} from "../svelte-stores/actor-store"; +import {endUserApplicationStore} from "../svelte-stores/end-user-application-store"; export function sameRef(r1, r2, options = { skipChecks: false }) { if (! options.skipChecks) { @@ -138,6 +141,20 @@ export function loadEntity(serviceBroker, entityRef) { } +export function loadSvelteEntity(entityRef, force = false) { + const id = entityRef.id; + switch (entityRef.kind) { + case "APPLICATION": + return applicationStore.getById(id, force); + case "ACTOR": + return actorStore.getById(id, force); + case "END_USER_APPLICATION": + return endUserApplicationStore.getById(id, force); + default: + throw "Don't know how to load entity for kind: " + entityRef.kind; + } +} + export function loadByExtId(serviceBroker, kind, extId) { try { const remoteCall = determineLoadByExtIdCall(kind); diff --git a/waltz-ng/client/common/selector-utils.js b/waltz-ng/client/common/selector-utils.js index a9fb67fefe..0a7adda7f1 100644 --- a/waltz-ng/client/common/selector-utils.js +++ b/waltz-ng/client/common/selector-utils.js @@ -44,6 +44,7 @@ export function determineDownwardsScopeForKind(kind) { case "APPLICATION": case "APP_GROUP": case "CHANGE_INITIATIVE": + case "END_USER_APPLICATION": case "FLOW_DIAGRAM": case "LICENCE": case "LEGAL_ENTITY": diff --git a/waltz-ng/client/common/svelte/ViewLink.svelte b/waltz-ng/client/common/svelte/ViewLink.svelte index f3277db4b4..2c4f59e8c8 100644 --- a/waltz-ng/client/common/svelte/ViewLink.svelte +++ b/waltz-ng/client/common/svelte/ViewLink.svelte @@ -49,6 +49,10 @@ path: ctx => `flow-diagram/${ctx.id}`, title: "Flow Diagram View" }, + "main.end-user-application.view": { + path: ctx => `end-user-application/id/${ctx.id}`, + title: "End User Application View" + }, "main.flow-classification-rule.view": { path: ctx => `flow-classification-rule/${ctx.id}`, title: "Flow Classification Rule View" diff --git a/waltz-ng/client/common/svelte/info-panels/EntityInfoPanel.svelte b/waltz-ng/client/common/svelte/info-panels/EntityInfoPanel.svelte index d540049fed..5ae60cd5d9 100644 --- a/waltz-ng/client/common/svelte/info-panels/EntityInfoPanel.svelte +++ b/waltz-ng/client/common/svelte/info-panels/EntityInfoPanel.svelte @@ -8,6 +8,7 @@ import LogicalDataFlowPanel from "./LogicalDataFlowInfoPanel.svelte" import SurveyInstanceInfoPanel from "./SurveyInstanceInfoPanel.svelte"; import PersonInfoPanel from "./PersonInfoPanel.svelte"; + import EndUserApplicationInfoPanel from "./EndUserApplicationInfoPanel.svelte"; export let primaryEntityRef; @@ -21,6 +22,8 @@ return ChangeInitiativeInfoPanel; case "DATA_TYPE": return DataTypeInfoPanel; + case "END_USER_APPLICATION": + return EndUserApplicationInfoPanel; case "LOGICAL_DATA_FLOW": return LogicalDataFlowPanel; case "MEASURABLE": diff --git a/waltz-ng/client/data-flow/components/svelte/FlowDecoratorExplorerPanel.svelte b/waltz-ng/client/data-flow/components/svelte/FlowDecoratorExplorerPanel.svelte index 7307eb7602..a896e81a5d 100644 --- a/waltz-ng/client/data-flow/components/svelte/FlowDecoratorExplorerPanel.svelte +++ b/waltz-ng/client/data-flow/components/svelte/FlowDecoratorExplorerPanel.svelte @@ -38,16 +38,14 @@ import Icon from "../../../common/svelte/Icon.svelte"; import NoData from "../../../common/svelte/NoData.svelte"; import {flowClassificationStore} from "../../../svelte-stores/flow-classification-store"; - import {sameRef} from "../../../common/entity-utils"; + import {loadSvelteEntity, sameRef} from "../../../common/entity-utils"; export let primaryEntityRef; let flowGraphSummaryCall = logicalFlowStore.getFlowGraphSummary(primaryEntityRef, null); let flowClassificationCall = flowClassificationStore.findAll() let physicalFlowCall = physicalFlowStore.findBySelector(mkSelectionOptions(primaryEntityRef, "EXACT")); - let entityCall = primaryEntityRef.kind === 'APPLICATION' - ? applicationStore.getById(primaryEntityRef.id) - : actorStore.getById(primaryEntityRef.id); + let entityCall = loadSvelteEntity(primaryEntityRef); let breadcrumbs = []; let additionalBreadcrumbs = []; @@ -75,8 +73,8 @@ $: baseBreadcrumb = { id: -1, name: $flowDirection === flowDirections.INBOUND - ? `${$focusClient?.name || entity.name} Inbound flows` - : `${$focusClient?.name || entity.name} Outbound flows`, + ? `${$focusClient?.name || entity?.name} Inbound flows` + : `${$focusClient?.name || entity?.name} Outbound flows`, classes: "breadcrumb-root", onClick: () => { const parent = $focusClient || entity @@ -87,7 +85,7 @@ $: homeBreadcrumb = { id: -2, - name: `Home (${entity.name})`, + name: `Home (${entity?.name})`, classes: "breadcrumb-home", onClick: () => { $focusClient = null; @@ -197,7 +195,7 @@ } - +{#if entity}
+{/if}