2
2
3
3
This _ DSL_ will bring your domain into your _ BPMN-Process_ .
4
4
5
- Its elements are more or less constructors with the same structure:
5
+ As the pattern is always the same, we can setup each _ BPMN Element _ in the same way.
6
6
7
7
``` scala
8
- BPMN_ELEMENT (
9
- id : String ,
10
- in : Input ,
11
- out : Output ,
12
- descr : Optable [String ]
13
- )
14
- ```
8
+ object BpmnElement extends CompanyBpmn <Element >Dsl :
15
9
16
- So each BPMN Element has:
10
+ val processName = " mycompany-myproject-myelement" // depending on the element this can be different
11
+ lazy val descr = " my element..."
17
12
18
- - _ id _ : a unique identifier, depending on the element it must be unique within its process, or within a Camunda Instance ( _ process, dmn _ ).
19
- - _ in _ : an input object that we descibed in the [ _ Domain Specification _ ] ( specification.md ) .
20
- - _ out _ : an output object that we descibed in the [ _ Domain Specification _ ] ( specification.md ) .
21
- - _ descr _ : an optional description of this element.
13
+ case class In (...)
14
+ object In :
15
+ given ApiSchema [ In ] = deriveApiSchema
16
+ given InOutCodec [ In ] = deriveInOutCodec
22
17
23
- Here is an example:
24
- ``` scala
25
- process(
26
- id = InvoiceReceiptPIdent ,
27
- descr = " This starts the Invoice Receipt Process." ,
28
- in = InvoiceReceipt (),
29
- out = InvoiceReceiptCheck () // just for testing
30
- )
18
+ case class Out (...)
19
+ object Out :
20
+ given ApiSchema [Out ] = deriveApiSchema
21
+ given InOutCodec [Out ] = deriveInOutCodec
22
+
23
+ lazy val example = <bpmnElement >(
24
+ In (),
25
+ Out (),
26
+ )
27
+ end BpmnElement
31
28
```
32
29
33
- The element is a _ process_ with its inputs and outputs. As we also want to test its execution,
34
- we defined also an output, also the process does not have one.
30
+ So each BPMN Element has:
31
+
32
+ - _ id_ : a unique identifier, it must be unique within a Camunda Instance.
33
+ Depending on the element this is named differently, e.g. ` processName ` , ` messageName ` etc.
34
+ - _ descr_ : a description of this element.
35
+ - _ In_ : an input class with the input process variables that we descibed in the [ _ Domain Specification_ ] ( specification.md ) .
36
+ - _ Out_ : an output class with the output process variables that we descibed in the [ _ Domain Specification_ ] ( specification.md ) .
37
+ - _ example_ : a method that creates an example of this element.
35
38
36
- @ : callout (info)
37
- If your element has no Input and/or Output, just leave it empty, as this is the default case.
39
+ ### Special Case Enums
40
+ If you have an _ Enum _ as an In or Out class, you need to define the example like this:
38
41
39
42
``` scala
40
- process(
41
- id = MyDoItItselfProcess
42
- )
43
+
44
+ lazy val example = <bpmnElement >(
45
+ In .CaseA (),
46
+ Out .CaseA (),
47
+ ).withEnumInExamples(In .CaseB ())
48
+ .withEnumOutExamples(Out .CaseB ())
43
49
```
44
- @:@
50
+ - This is needed to document both cases and also to handle them correctly in the _ Workers _ .
45
51
46
- We only support elements you can interact with. The next subchapters describe them with an example.
52
+ We support the following elements:
47
53
48
54
## Process
49
55
50
- We already showed a process example above. Here the sub process _ Review Invoice_ :
56
+ The Process is the main element of a BPMN.
57
+ It is the most complex element and looks like this:
51
58
52
59
``` scala
53
- process(
54
- id = " example-invoice-c7-review" ,
55
- descr = " This starts the Review Invoice Process." ,
56
- in = InvoiceReceipt (),
57
- out = InvoiceReviewed ()
58
- )
60
+ object MyProcess extends CompanyBpmnProcessDsl :
61
+
62
+ val processName = " mycompany-myproject-myprocess"
63
+ lazy val descr = " my process..."
64
+
65
+ case class In (
66
+ ...
67
+ inConfig : Option [InConfig ] = None
68
+ ) extends WithConfig [InConfig ]
69
+
70
+ object In :
71
+ given ApiSchema [In ] = deriveApiSchema
72
+ given InOutCodec [In ] = deriveInOutCodec
73
+
74
+ case class InConfig (
75
+ // Process Configuration
76
+ ...
77
+ // Mocks
78
+ ... )
79
+ object InConfig :
80
+ given ApiSchema [InConfig ] = deriveApiSchema
81
+ given InOutCodec [InConfig ] = deriveInOutCodec
82
+
83
+ case class InitIn (...)
84
+ object InitIn :
85
+ given ApiSchema [InitIn ] = deriveApiSchema
86
+ given InOutCodec [InitIn ] = deriveInOutCodec
87
+
88
+ case class Out (...)
89
+ object Out :
90
+ given ApiSchema [Out ] = deriveApiSchema
91
+ given InOutCodec [Out ] = deriveInOutCodec
92
+
93
+ lazy val example = process(
94
+ In (),
95
+ Out (),
96
+ InitIn ()
97
+ )
98
+ end MyProcess
59
99
```
60
100
61
101
## Business Rule Tasks (Decision DMNs)
@@ -134,13 +174,31 @@ resultList(
134
174
A _ User Task_ describes its form values that it offers and the values it must be completed with.
135
175
136
176
``` scala
137
- userTask(
138
- id = " ApproveInvoiceUT" ,
139
- descr = " Approve the invoice (or not)." ,
140
- in = InvoiceReceipt (),
141
- out = ApproveInvoice ()
177
+ object MyUserTask extends CompanyBpmnUserTaskDsl :
178
+
179
+ val name = " mycompany-myproject-myusertask"
180
+ val descr : String = " my user task..."
181
+
182
+ case class In (...)
183
+ object In :
184
+ given ApiSchema [In ] = deriveApiSchema
185
+ given InOutCodec [In ] = deriveInOutCodec
186
+
187
+ case class Out (...)
188
+ object Out :
189
+ given ApiSchema [Out ] = deriveApiSchema
190
+ given InOutCodec [Out ] = deriveInOutCodec
191
+
192
+ lazy val example = userTask(
193
+ In (),
194
+ Out ()
142
195
)
196
+ end MyUserTask
143
197
```
198
+ - The ` name ` is the name of the user task, ** be aware** at the moment this is only for documentation.
199
+ - A _ UserTask_ extends _ CompanyBpmnUserTaskDsl_ .
200
+ - The ` In ` object are the input variables you expect for the UI-Form of the _ UserTask_ .
201
+ - The ` Out ` object are the process variables, the UI-Form sends, when it completes the _ UserTask_ .
144
202
145
203
## Receive Message Event
146
204
A _ Receive Message Event_ represents a catching message event.
@@ -149,11 +207,24 @@ This works only as intermediate event.
149
207
As we don't support _ throwing Message events_ we can simplify this to _ messageEvent_ :
150
208
151
209
``` scala
152
- lazy val messageExample = messageEvent(
153
- " message-for-example" ,
154
- in = MessageExampleIn (),
155
- )
210
+ object MyMessageEvent extends CompanyBpmnMessageEventDsl :
211
+
212
+ val messageName = " mycompany-myproject-mymessage"
213
+ val descr : String = " my message..."
214
+
215
+ case class In (...)
216
+ object In :
217
+ given ApiSchema [In ] = deriveApiSchema
218
+ given InOutCodec [In ] = deriveInOutCodec
219
+
220
+ lazy val example = messageEvent(In ())
221
+ end MyMessageEvent
156
222
```
223
+ - The ` messageName ` is the name of the message you expect.
224
+ The correlation can be the business key or the process instance id.
225
+ In the _ Simulation_ we will use the _ processInstanceId_ .
226
+ - You can send process variables with the ` In ` object.
227
+ - A _ MessageEvent_ extends _ CompanyBpmnMessageEventDsl_ .
157
228
158
229
## Receive Signal Event
159
230
A _ Receive Signal Event_ represents a catching signal event.
@@ -162,21 +233,23 @@ This works only as intermediate event.
162
233
As we don't support _ Throwing Signal events_ we can simplify this to _ signalEvent_ :
163
234
164
235
``` scala
165
- lazy val signalExample = signalEvent(
166
- " signal-for-example" ,
167
- in = SignalExampleIn (),
168
- )
236
+ object MySignalEvent extends CompanyBpmnSignalEventDsl :
237
+
238
+ val messageName = " mycompany-myproject-mysignal-{processInstanceId}"
239
+ val descr : String = " my signal..."
240
+
241
+ case class In (...)
242
+ object In :
243
+ given ApiSchema [In ] = deriveApiSchema
244
+ given InOutCodec [In ] = deriveInOutCodec
245
+
246
+ lazy val example = signalEvent(In ())
247
+ end MySignalEvent
169
248
```
249
+ - The ` messageName ` is the name of the signal you expect.
250
+ To correlate the signal to a certain process instance, you can use the ` {processInstanceId} ` as a part in the signal name.
251
+ This will be replaced in the _ Simulation_ with the actual _ processInstanceId_ .
252
+ - You can send process variables with the ` In ` object.
253
+ - A _ SignalEvent_ extends _ CompanyBpmnSignalEventDsl_ .
170
254
171
255
172
- ## Timer Event
173
- A _ Timer Event_ represents a timer event.
174
- There is no input needed, you can use it to describe the timers in your API doc, or using them in the Simulations to execute the job of the timer immediately.
175
- This works only as intermediate event.
176
-
177
- ``` scala
178
- lazy val timerExample = timerEvent(
179
- " timer-for-example" ,
180
- )
181
- ```
182
-
0 commit comments