Skip to content

Commit 90e6788

Browse files
committed
redone TimerEvent.
1 parent fedfbb1 commit 90e6788

File tree

12 files changed

+363
-361
lines changed

12 files changed

+363
-361
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ jobs:
1717
jvm: zulu:21
1818
- name: Compile
1919
run: sbt compile
20-
- name: Documentation
21-
run: sbt documentation/laikaSite
2220
- name: Test
2321
run: sbt -v "test:compile; domain/test; bpmn/test;"
2422
- name: Test Report
2523
uses: dorny/test-reporter@v1
26-
if: success() || failure() # run this step even if previous step failed
24+
if: success() # run this step even if previous step failed
2725
with:
2826
name: Test Report # Name of the check run which will be created
2927
path: "**/test-reports/*.xml" # Path to test results.

00-documentation/src/docs/bpmnDsl.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ end MyUserTask
221221
An _External Task_ describes a worker.
222222
We distinguish different types of Tasks, which are described in the next subchapters.
223223

224-
```scala
225224
### Custom Task
226225
A _Custom Task_ is a description for a worker that does some business logic, like mapping.
227226

@@ -369,4 +368,17 @@ end MySignalEvent
369368
- You can send process variables with the `In` object.
370369
- A _SignalEvent_ extends _CompanyBpmnSignalEventDsl_.
371370

371+
## Timer Event
372+
A _Timer Event_ represents a timer event.
373+
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.
374+
This works only as intermediate event.
375+
376+
```scala
377+
object MyTimerEvent extends CompanyBpmnTimerEventDsl:
372378

379+
val title = "mycompany-myproject-mytimer"
380+
val descr: String = "my timer..."
381+
382+
lazy val example = timerEvent()
383+
end MyTimerEvent
384+
```

02-bpmn/src/main/scala/camundala/bpmn/BpmnProcessDsl.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ trait BpmnProcessDsl extends BpmnDsl:
206206
): SignalEvent[Msg] =
207207
signalEvent(messageName, in, id, descr)
208208

209+
@deprecated("Use .. extends BpmnTimerDsl")
210+
def timerEvent(
211+
title: String,
212+
descr: Optable[String] = None
213+
): TimerEvent =
214+
TimerEvent(
215+
title,
216+
InOutDescr(title, descr = descr.value)
217+
)
218+
209219
private def msgNameDescr(messageName: String, descr: Optable[String]) =
210220
val msgNameDescr = s"- _messageName_: `$messageName`"
211221
Some(descr.value.map(_ + s"\n$msgNameDescr").getOrElse(msgNameDescr))
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package camundala.bpmn
2+
3+
import camundala.domain.*
4+
5+
import scala.reflect.ClassTag
6+
7+
trait BpmnTimerEventDsl extends BpmnDsl:
8+
9+
def title: String
10+
11+
def timerEvent(
12+
): TimerEvent =
13+
TimerEvent(
14+
title,
15+
InOutDescr(title, descr = Some(descr))
16+
)
17+
end BpmnTimerEventDsl
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package camundala.examples.demos.bpmn
2+
3+
import camundala.bpmn.*
4+
5+
object TimerExample extends BpmnProcessDsl:
6+
7+
lazy val processName: String = "timer-example"
8+
lazy val descr: String = ""
9+
val companyDescr = ""
10+
11+
lazy val example = process()
12+
13+
end TimerExample
14+
15+
object TheTimer extends BpmnTimerEventDsl:
16+
17+
lazy val title: String = "the timer event"
18+
lazy val descr: String = ""
19+
def companyDescr: String = ""
20+
21+
lazy val example = timerEvent()
22+
23+
end TheTimer

05-examples/demos/03-api/src/main/scala/camundala/examples/demos/api/ProjectApiCreator.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ object ProjectApiCreator extends DefaultApiCreator:
2828
.withPort(8034)
2929

3030
document(
31-
DecisionResultTypes.singleEntryDMN
32-
.withDiagramName("DecisionResultTypes"),
33-
DecisionResultTypes.collectEntriesDMN
34-
.withDiagramName("DecisionResultTypes"),
35-
DecisionResultTypes.singleResultDMN
36-
.withDiagramName("DecisionResultTypes"),
37-
DecisionResultTypes.resultListDMN
38-
.withDiagramName("DecisionResultTypes"),
3931
api(
4032
DecisionResultTypes.demoProcess
4133
.withDiagramName("mapping-example")
@@ -46,16 +38,20 @@ object ProjectApiCreator extends DefaultApiCreator:
4638
DecisionResultTypes.resultListDMN.withDiagramName("DecisionResultTypes")
4739
),
4840
GenericServiceExample.example,
49-
EnumExample.example,
41+
api(EnumExample.example)(
5042
EnumWorkerExample.example,
5143
DateExample.DateExampleDMN,
5244
VariablesExample.VariablesExampleDMN,
45+
),
5346
SimulationTestOverridesExample.simulationProcess,
5447
group("SignalMessageExample")(
5548
SignalExample.signalExample,
5649
MessageForExample.messageExample,
5750
SignalExample.signalIntermediateExample,
5851
MessageForExample.messageIntermediateExample
52+
),
53+
api(TimerExample.example)(
54+
TheTimer.example
5955
)
6056
)
6157
end ProjectApiCreator
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package camundala.examples.demos.simulation
2+
3+
import camundala.examples.demos.bpmn.*
4+
import camundala.simulation.*
5+
6+
// exampleDemosSimulation/test
7+
// exampleDemosSimulation/testOnly *TimerExampleSimulation
8+
class TimerExampleSimulation extends DemosSimulation:
9+
10+
simulate(
11+
scenario(`timerProcess waiting for job`)(
12+
TheTimer.example
13+
),
14+
scenario(`timerProcess waiting for variable`)(
15+
TheTimer.example
16+
.waitFor("timerReady")
17+
)
18+
)
19+
20+
private lazy val `timerProcess waiting for job` = TimerExample.example
21+
private lazy val `timerProcess waiting for variable` = TimerExample.example
22+
end TimerExampleSimulation

05-examples/demos/catalog.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
### Demos Example Process API
2-
- [Bpmn: camundala-mapping-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20camundala-mapping-example)
32
- [Bpmn: enum-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20enum-example)
4-
- [Bpmn: message-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20message-for-example)
3+
- [Bpmn: example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20example)
4+
- [Bpmn: example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20example)
55
- [Bpmn: myservice.api.v1.post](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20myservice.api.v1.post)
66
- [Bpmn: signal-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20signal-example)
77
- [Bpmn: simulation-TestOverrides](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20simulation-TestOverrides)
88
- [Bpmn: timer-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20timer-example)
9+
- [Dmn: DateExample](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20DateExample)
10+
- [Dmn: VariablesExample](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20VariablesExample)
911
- [Dmn: collectEntries](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20collectEntries)
1012
- [Dmn: resultList](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20resultList)
1113
- [Dmn: singleEntry](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20singleEntry)
1214
- [Dmn: singleResult](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20singleResult)
13-
- [Message: intermediate-message-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Message:%20intermediate-message-for-example)
14-
- [Signal: intermediate-signal-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Signal:%20intermediate-signal-for-example)
15-
- [Timer: wait for one day](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Timer:%20wait%20for%20one%20day)
15+
- [Message: for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Message:%20for-example)
16+
- [Signal: for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Signal:%20for-example)
17+
- [Timer: the timer event](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Timer:%20the%20timer%20event)
18+
- [Worker: myEnumWorker.Topic](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Worker:%20myEnumWorker.Topic)

0 commit comments

Comments
 (0)