Skip to content

Commit

Permalink
[FEAT] Detect all Conditional events (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyPicky authored Oct 21, 2020
1 parent 2414454 commit 22bacaf
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 24 deletions.
24 changes: 24 additions & 0 deletions docs/bpmn-support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ The event definition can be defined on the event or on the definitions.
|Signal Start Event
|icon:check-circle-o[]
|The stroke & icon width may be adjusted

|Conditional Start Event
|
|
|===


Expand Down Expand Up @@ -197,6 +201,10 @@ The event definition can be defined on the event or on the definitions.
|Compensation Interrupting Start Event
|icon:check-circle-o[]
|The stroke & icon width may be adjusted

|Conditional Interrupting Start Event
|
|
|===


Expand All @@ -218,6 +226,10 @@ The event definition can be defined on the event or on the definitions.
|Signal Non-interrupting Start Event
|icon:check-circle-o[]
|The stroke & icon width may be adjusted

|Conditional Non-interrupting Start Event
|
|
|===


Expand All @@ -243,6 +255,10 @@ The event definition can be defined on the event or on the definitions.
|Link Intermediate Catch Event
|icon:check-circle-o[]
|The stroke & icon width may be adjusted

|Conditional Intermediate Catch Event
|
|
|===


Expand Down Expand Up @@ -305,6 +321,10 @@ The event definition can be defined on the event or on the definitions.
|Cancel Interrupting Boundary Event
|
|

|Conditional Interrupting Boundary Event
|
|
|===


Expand All @@ -326,6 +346,10 @@ The event definition can be defined on the event or on the definitions.
|Signal Non-interrupting Boundary Event
|icon:check-circle-o[]
|The stroke & icon width may be adjusted

|Conditional Non-interrupting Boundary Event
|
|
|===


Expand Down
3 changes: 3 additions & 0 deletions src/component/mxgraph/shape/event-shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ abstract class EventShape extends mxEllipse {
if (eventKind == ShapeBpmnEventKind.CANCEL) {
c.setFillColor('deeppink');
c.setFillAlpha(0.3);
} else if (eventKind == ShapeBpmnEventKind.CONDITIONAL) {
c.setFillColor('chartreuse');
c.setFillAlpha(0.3);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/model/bpmn/internal/shape/ShapeBpmnEventKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ export const supportedBpmnEventKinds = [
ShapeBpmnEventKind.ERROR,
ShapeBpmnEventKind.COMPENSATION,
ShapeBpmnEventKind.CANCEL,
ShapeBpmnEventKind.CONDITIONAL,
];
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 72 additions & 2 deletions test/e2e/mxGraph.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ describe('mxGraph model', () => {
label: 'Signal Start Event On Top',
parentId: 'participant_1_id',
});
expect('start_event_conditional_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Conditional Start Event',
parentId: 'participant_1_id',
});
expect('start_event_conditional_on_top_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Conditional Start Event On Top',
parentId: 'participant_1_id',
});

// end event
expect('end_event_terminate_id').toBeEndEvent({
Expand Down Expand Up @@ -232,12 +242,12 @@ describe('mxGraph model', () => {
});
expect('intermediate_catch_event_timer_id').toBeIntermediateCatchEvent({
eventKind: ShapeBpmnEventKind.TIMER,
label: 'Timer Intermediate Catch Event',
label: 'Catch Timer Intermediate Event',
parentId: 'participant_1_id',
});
expect('intermediate_catch_event_timer_on_top_id').toBeIntermediateCatchEvent({
eventKind: ShapeBpmnEventKind.TIMER,
label: 'Timer Intermediate Catch Event On Top',
label: 'Catch Timer Intermediate Event On Top',
parentId: 'participant_1_id',
});
expect('intermediate_catch_event_signal_id').toBeIntermediateCatchEvent({
Expand All @@ -260,6 +270,16 @@ describe('mxGraph model', () => {
label: 'Catch Link Intermediate Event On Top',
parentId: 'participant_1_id',
});
expect('intermediate_catch_event_conditional_id').toBeIntermediateCatchEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Catch Conditional Intermediate Event',
parentId: 'participant_1_id',
});
expect('intermediate_catch_event_conditional_on_top_id').toBeIntermediateCatchEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Catch Conditional Intermediate Event On Top',
parentId: 'participant_1_id',
});

// boundary event: interrupting
expect('boundary_event_interrupting_message_id').toBeBoundaryEvent({
Expand Down Expand Up @@ -334,6 +354,18 @@ describe('mxGraph model', () => {
label: 'Interrupting Cancel Boundary Intermediate Event On Top',
parentId: 'receive_task_non_instantiating_id',
});
expect('boundary_event_interrupting_conditional_id').toBeBoundaryEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
isInterrupting: true,
label: 'Interrupting Conditional Boundary Intermediate Event',
parentId: 'receive_task_instantiating_id',
});
expect('boundary_event_interrupting_conditional_on_top_id').toBeBoundaryEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
isInterrupting: true,
label: 'Interrupting Conditional Boundary Intermediate Event On Top',
parentId: 'receive_task_instantiating_id',
});

// boundary event: non-interrupting
expect('boundary_event_non_interrupting_message_id').toBeBoundaryEvent({
Expand Down Expand Up @@ -372,6 +404,18 @@ describe('mxGraph model', () => {
label: 'Non-interrupting Signal Boundary Intermediate Event On Top',
parentId: 'collapsed_call_activity_id',
});
expect('boundary_event_non_interrupting_conditional_id').toBeBoundaryEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
isInterrupting: false,
label: 'Non-interrupting Conditional Boundary Intermediate Event',
parentId: 'collapsed_call_activity_with_loop_id',
});
expect('boundary_event_non_interrupting_conditional_on_top_id').toBeBoundaryEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
isInterrupting: false,
label: 'Non-interrupting Conditional Boundary Intermediate Event On Top',
parentId: 'collapsed_call_activity_with_loop_id',
});

// Sub-process
expect('expanded_embedded_sub_process_id').toBeSubProcess({
Expand Down Expand Up @@ -572,6 +616,18 @@ describe('mxGraph model', () => {
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: true,
});
expect('start_event_interrupting_conditional_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Interrupting Conditional Start Event In Sub-Process',
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: true,
});
expect('start_event_interrupting_conditional_on_top_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Interrupting Conditional Start Event On Top In Sub-Process',
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: true,
});

// Non-interrupting Start Event
expect('start_event_non_interrupting_message_id').toBeStartEvent({
Expand Down Expand Up @@ -610,6 +666,18 @@ describe('mxGraph model', () => {
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: false,
});
expect('start_event_non_interrupting_conditional_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Non-interrupting Conditional Start Event In Sub-Process',
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: false,
});
expect('start_event_non_interrupting_conditional_on_top_id').toBeStartEvent({
eventKind: ShapeBpmnEventKind.CONDITIONAL,
label: 'Non-interrupting Conditional Start Event On Top In Sub-Process',
parentId: 'expanded_event_sub_process_with_start_events_id',
isInterrupting: false,
});

// Call Activity calling process
// Expanded
Expand Down Expand Up @@ -931,10 +999,12 @@ describe('mxGraph model', () => {
// boundary event: interrupting
expect('boundary_event_interrupting_message_id').not.toBeCell();
expect('boundary_event_interrupting_timer_id').not.toBeCell();
expect('boundary_event_interrupting_conditional_id').not.toBeCell();

// boundary event: non-interrupting
expect('boundary_event_non_interrupting_message_id').not.toBeCell();
expect('boundary_event_non_interrupting_timer_id').not.toBeCell();
expect('boundary_event_non_interrupting_conditional_id').not.toBeCell();
});

it('bpmn element shape should have coordinates relative to the pool when no lane', async () => {
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/bpmn/model-badly-attached-elements.bpmn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<semantic:boundaryEvent attachedToRef="nothing" cancelActivity="false" name="Boundary Intermediate Event Non-nterrupting Timer" id="boundary_event_non_interrupting_timer_id">
<semantic:timerEventDefinition/>
</semantic:boundaryEvent>
<semantic:boundaryEvent attachedToRef="nothing" cancelActivity="true" name="Boundary Intermediate Event Interrupting Conditional" id="boundary_event_interrupting_conditional_id">
<semantic:conditionalEventDefinition/>
</semantic:boundaryEvent>
<semantic:boundaryEvent attachedToRef="nothing" cancelActivity="false" name="Boundary Intermediate Event Non-nterrupting Conditional" id="boundary_event_non_interrupting_conditional_id">
<semantic:conditionalEventDefinition/>
</semantic:boundaryEvent>
</semantic:process>
<bpmndi:BPMNDiagram documentation="" id="Trisotech_Visio-_6" name="A.1.0" resolution="96.00000267028808">
<bpmndi:BPMNPlane bpmnElement="WFP-6-">
Expand Down
Loading

0 comments on commit 22bacaf

Please sign in to comment.