Skip to content

Commit e65a849

Browse files
Ticket #114 : Support boundary Event
1 parent 41e1b2e commit e65a849

32 files changed

Lines changed: 588 additions & 62 deletions
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="8.7.1">
3+
<message id="userMessage" name="user" />
4+
<process id="Process_1" isExecutable="false">
5+
<serviceTask id="Task_1hcentk" name="Send Email">
6+
<incoming>Flow_0kge1w3</incoming>
7+
</serviceTask>
8+
<userTask id="Activity_0fhwdxz" name="Submit Password">
9+
<incoming>Flow_1fdpmlk</incoming>
10+
<outgoing>Flow_08bn5nb</outgoing>
11+
</userTask>
12+
<endEvent id="Event_08zcpaz">
13+
<incoming>Flow_1p3mrfd</incoming>
14+
</endEvent>
15+
<sequenceFlow id="Flow_08bn5nb" sourceRef="Activity_0fhwdxz" targetRef="Activity_0yov4bm" />
16+
<sequenceFlow id="Flow_1p3mrfd" sourceRef="Activity_0yov4bm" targetRef="Event_08zcpaz" />
17+
<serviceTask id="Activity_0yov4bm" name="Update Password">
18+
<incoming>Flow_08bn5nb</incoming>
19+
<outgoing>Flow_1p3mrfd</outgoing>
20+
</serviceTask>
21+
<startEvent id="StartEvent_1y45yut">
22+
<outgoing>Flow_1fdpmlk</outgoing>
23+
<messageEventDefinition id="MessageEventDefinition_01rnx81" messageRef="userMessage" />
24+
</startEvent>
25+
<sequenceFlow id="Flow_1fdpmlk" sourceRef="StartEvent_1y45yut" targetRef="Activity_0fhwdxz" />
26+
<sequenceFlow id="Flow_0kge1w3" sourceRef="Event_0q7uygb" targetRef="Task_1hcentk" />
27+
<boundaryEvent id="Event_0q7uygb" attachedToRef="Activity_0fhwdxz">
28+
<outgoing>Flow_0kge1w3</outgoing>
29+
<messageEventDefinition id="MessageEventDefinition_135rspe" />
30+
</boundaryEvent>
31+
</process>
32+
<bpmndi:BPMNDiagram id="BpmnDiagram_1">
33+
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1">
34+
<bpmndi:BPMNEdge id="Flow_1p3mrfd_di" bpmnElement="Flow_1p3mrfd">
35+
<omgdi:waypoint x="820" y="150" />
36+
<omgdi:waypoint x="912" y="150" />
37+
</bpmndi:BPMNEdge>
38+
<bpmndi:BPMNEdge id="Flow_08bn5nb_di" bpmnElement="Flow_08bn5nb">
39+
<omgdi:waypoint x="490" y="150" />
40+
<omgdi:waypoint x="720" y="150" />
41+
</bpmndi:BPMNEdge>
42+
<bpmndi:BPMNEdge id="Flow_1fdpmlk_di" bpmnElement="Flow_1fdpmlk">
43+
<omgdi:waypoint x="188" y="150" />
44+
<omgdi:waypoint x="390" y="150" />
45+
</bpmndi:BPMNEdge>
46+
<bpmndi:BPMNEdge id="Flow_0kge1w3_di" bpmnElement="Flow_0kge1w3">
47+
<omgdi:waypoint x="490" y="208" />
48+
<omgdi:waypoint x="490" y="280" />
49+
</bpmndi:BPMNEdge>
50+
<bpmndi:BPMNShape id="Event_08zcpaz_di" bpmnElement="Event_08zcpaz">
51+
<omgdc:Bounds x="912" y="132" width="36" height="36" />
52+
</bpmndi:BPMNShape>
53+
<bpmndi:BPMNShape id="Activity_0hieezl_di" bpmnElement="Activity_0yov4bm">
54+
<omgdc:Bounds x="720" y="110" width="100" height="80" />
55+
</bpmndi:BPMNShape>
56+
<bpmndi:BPMNShape id="Event_0bfv2sq_di" bpmnElement="StartEvent_1y45yut">
57+
<omgdc:Bounds x="152" y="132" width="36" height="36" />
58+
</bpmndi:BPMNShape>
59+
<bpmndi:BPMNShape id="Activity_1j5vxke_di" bpmnElement="Activity_0fhwdxz">
60+
<omgdc:Bounds x="390" y="110" width="100" height="80" />
61+
</bpmndi:BPMNShape>
62+
<bpmndi:BPMNShape id="Activity_1saua76_di" bpmnElement="Task_1hcentk">
63+
<omgdc:Bounds x="440" y="280" width="100" height="80" />
64+
</bpmndi:BPMNShape>
65+
<bpmndi:BPMNShape id="Event_10s7arv_di" bpmnElement="Event_0q7uygb">
66+
<omgdc:Bounds x="472" y="172" width="36" height="36" />
67+
</bpmndi:BPMNShape>
68+
</bpmndi:BPMNPlane>
69+
</bpmndi:BPMNDiagram>
70+
</definitions>

src/CaseManagement.BPMN/Builders/ProcessFlowNodeBuilder.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public abstract class ActivityNodeBuilder : FlowNodeBuilder
4444
public ActivityNodeBuilder(string id, string name) : base(id, name)
4545
{
4646
StartQuantity = 1;
47+
BoundaryEvtRefs = new List<string>();
4748
}
4849

4950
public ActivityNodeBuilder SetStartQuantity(int startQuantity)
@@ -52,12 +53,20 @@ public ActivityNodeBuilder SetStartQuantity(int startQuantity)
5253
return this;
5354
}
5455

56+
internal List<string> BoundaryEvtRefs { get; set; }
5557
internal int StartQuantity { get; set; }
5658

59+
public ActivityNodeBuilder AddBoundaryEventRef(string boundaryEvtRef)
60+
{
61+
BoundaryEvtRefs.Add(boundaryEvtRef);
62+
return this;
63+
}
64+
5765
protected void FeedActivityNode(BaseActivity node)
5866
{
5967
FeedFlowNode(node);
6068
node.StartQuantity = StartQuantity;
69+
node.BoundaryEvtRefs = BoundaryEvtRefs;
6170
}
6271
}
6372

@@ -198,6 +207,18 @@ public override BaseFlowNode Build()
198207
}
199208
}
200209

210+
public class BoundaryEventBuilder : CatchEventBuilder
211+
{
212+
public BoundaryEventBuilder(string id, string name) : base(id, name) { }
213+
214+
public override BaseFlowNode Build()
215+
{
216+
var result = new BoundaryEvent();
217+
FeedCatchEvt(result);
218+
return result;
219+
}
220+
}
221+
201222
#endregion
202223

203224
#region Evt Definitions

src/CaseManagement.BPMN/Builders/ProcessInstanceBuilder.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ public ProcessInstanceBuilder AddEndEvent(string id, string name, Action<EndEven
8686
return this;
8787
}
8888

89+
public ProcessInstanceBuilder AddBoundaryEvent(string id, string name, Action<BoundaryEventBuilder> callback = null)
90+
{
91+
var boundaryEvtBuilder = new BoundaryEventBuilder(id, name);
92+
if (callback != null)
93+
{
94+
callback(boundaryEvtBuilder);
95+
}
96+
97+
Builders.Add(boundaryEvtBuilder);
98+
return this;
99+
}
100+
89101
#endregion
90102

91103
#region Build tasks

src/CaseManagement.BPMN/CaseManagement.BPMN.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<PackageReference Include="DynamicExpresso.Core" Version="2.3.1" />
1616
<PackageReference Include="IdentityModel" Version="4.5.0" />
1717
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
18+
<PackageReference Include="MassTransit" Version="7.1.7" />
19+
<PackageReference Include="MassTransit.Extensions.DependencyInjection" Version="7.1.7" />
1820
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
1921
</ItemGroup>
2022
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
@@ -37,4 +39,7 @@
3739
<LastGenOutput>Global.Designer.cs</LastGenOutput>
3840
</EmbeddedResource>
3941
</ItemGroup>
42+
<ItemGroup>
43+
<Folder Include="Domains\ProcessInstance\Defs\Events\ThrowEvts\" />
44+
</ItemGroup>
4045
</Project>

src/CaseManagement.BPMN/Domains/ProcessInstance/BaseActivity.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
namespace CaseManagement.BPMN.Domains
1+
using System.Collections.Generic;
2+
3+
namespace CaseManagement.BPMN.Domains
24
{
35
public abstract class BaseActivity : BaseFlowNode
46
{
57
public BaseActivity()
68
{
79
StartQuantity = 1;
810
CompletionQuantity = 1;
11+
BoundaryEvtRefs = new List<string>();
912
}
1013

1114
/// <summary>
@@ -16,12 +19,14 @@ public BaseActivity()
1619
/// This attribute defines the number of tokens that must be generated from the Activity.
1720
/// </summary>
1821
public int CompletionQuantity { get; set; }
22+
public List<string> BoundaryEvtRefs { get; set; }
1923

2024
protected void FeedActivity(BaseActivity activity)
2125
{
2226
FeedFlowNode(activity);
2327
activity.StartQuantity = StartQuantity;
2428
activity.CompletionQuantity = CompletionQuantity;
29+
activity.BoundaryEvtRefs = BoundaryEvtRefs;
2530
}
2631
}
2732
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace CaseManagement.BPMN.Domains
2+
{
3+
public class BoundaryEvent : BaseCatchEvent
4+
{
5+
public override FlowNodeTypes FlowNode => FlowNodeTypes.BOUNDARYEVENT;
6+
public string AttachedToRef { get; set; }
7+
8+
public override object Clone()
9+
{
10+
var result = new BoundaryEvent();
11+
FeedCatchEvent(result);
12+
result.AttachedToRef = AttachedToRef;
13+
return result;
14+
}
15+
16+
public static new BoundaryEvent Deserialize(string json)
17+
{
18+
return BaseCatchEvent.Deserialize<BoundaryEvent>(json);
19+
}
20+
}
21+
}

src/CaseManagement.BPMN/Domains/ProcessInstance/Defs/Events/ThrowEvts/EndEvent.cs renamed to src/CaseManagement.BPMN/Domains/ProcessInstance/Defs/Events/CatchEvts/EndEvent.cs

File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using CaseManagement.Common.Domains;
2+
using System;
3+
using System.Diagnostics;
4+
5+
namespace CaseManagement.BPMN.Domains
6+
{
7+
[DebuggerDisplay("Complete execution pointer")]
8+
[Serializable]
9+
public class ExecutionPointerExitedEvent : DomainEvent
10+
{
11+
public ExecutionPointerExitedEvent(string id, string aggregateId, int version, string executionPathId, string executionPointerId, DateTime exitDateTime) : base(id, aggregateId, version)
12+
{
13+
ExecutionPathId = executionPathId;
14+
ExecutionPointerId = executionPointerId;
15+
ExitDateTime = exitDateTime;
16+
}
17+
18+
public string ExecutionPathId { get; set; }
19+
public string ExecutionPointerId { get; set; }
20+
public DateTime ExitDateTime { get; set; }
21+
}
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using CaseManagement.Common.Domains;
2+
using System;
3+
using System.Diagnostics;
4+
5+
namespace CaseManagement.BPMN.Domains
6+
{
7+
[DebuggerDisplay("Restart process instance")]
8+
[Serializable]
9+
public class ProcessInstanceRestartedEvent : DomainEvent
10+
{
11+
public ProcessInstanceRestartedEvent(string id, string aggregateId, int version, DateTime updateDateTime) : base(id, aggregateId, version)
12+
{
13+
UpdateDateTime = updateDateTime;
14+
}
15+
16+
public DateTime UpdateDateTime { get; set; }
17+
}
18+
}

src/CaseManagement.BPMN/Domains/ProcessInstance/Enums/FlowNodeTypes.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum FlowNodeTypes
1010
PARALLELGATEWAY = 5,
1111
INCLUSIVEGATEWAY = 6,
1212
USERTASK = 7,
13-
ENDEVENT = 8
13+
ENDEVENT = 8,
14+
BOUNDARYEVENT = 9
1415
}
1516
}

0 commit comments

Comments
 (0)