Skip to content

Commit

Permalink
refactor: single method to compute process and subprocess inner elements
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard committed Aug 12, 2020
1 parent 5158f23 commit 93b3b46
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/component/parser/json/converter/ProcessConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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> | TLaneSet): void {
Expand Down

0 comments on commit 93b3b46

Please sign in to comment.