From 93b3b469f6f231a07d25cf29a1648879401e9915 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 12 Aug 2020 15:08:24 +0200 Subject: [PATCH] refactor: single method to compute process and subprocess inner elements --- .../parser/json/converter/ProcessConverter.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/component/parser/json/converter/ProcessConverter.ts b/src/component/parser/json/converter/ProcessConverter.ts index f894925a1a..fe5c5cb451 100644 --- a/src/component/parser/json/converter/ProcessConverter.ts +++ b/src/component/parser/json/converter/ProcessConverter.ts @@ -100,6 +100,11 @@ export default class ProcessConverter { private parseProcess(process: TProcess): void { const processId = process.id; convertedProcessBpmnElements.set(processId, new ShapeBpmnElement(processId, process.name, ShapeBpmnElementKind.POOL)); + this.buildProcessInnerElements(process); + } + + private buildProcessInnerElements(process: TProcess | TSubProcess): void { + const processId = process.id; // flow nodes ShapeUtil.flowNodeKinds() @@ -246,18 +251,7 @@ export default class ProcessConverter { } private buildSubProcessInnerElements(subProcess: TSubProcess): void { - const processId = subProcess.id; - const process = subProcess; - - // flow nodes - ShapeUtil.flowNodeKinds() - .filter(kind => kind != ShapeBpmnElementKind.EVENT_BOUNDARY) - .forEach(kind => this.buildFlowNodeBpmnElements(processId, process[kind], kind)); - // process boundary events afterwards as we need its parent activity to be available when building it - this.buildFlowNodeBpmnElements(processId, process.boundaryEvent, ShapeBpmnElementKind.EVENT_BOUNDARY); - - // flows - this.buildSequenceFlows(process[FlowKind.SEQUENCE_FLOW]); + this.buildProcessInnerElements(subProcess); } private buildLaneSetBpmnElements(processId: string, laneSets: Array | TLaneSet): void {