Skip to content

Commit

Permalink
redone TimerEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Dec 8, 2024
1 parent fedfbb1 commit 90e6788
Show file tree
Hide file tree
Showing 12 changed files with 363 additions and 361 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ jobs:
jvm: zulu:21
- name: Compile
run: sbt compile
- name: Documentation
run: sbt documentation/laikaSite
- name: Test
run: sbt -v "test:compile; domain/test; bpmn/test;"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
if: success() # run this step even if previous step failed
with:
name: Test Report # Name of the check run which will be created
path: "**/test-reports/*.xml" # Path to test results.
Expand Down
14 changes: 13 additions & 1 deletion 00-documentation/src/docs/bpmnDsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ end MyUserTask
An _External Task_ describes a worker.
We distinguish different types of Tasks, which are described in the next subchapters.

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

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

## Timer Event
A _Timer Event_ represents a timer event.
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.
This works only as intermediate event.

```scala
object MyTimerEvent extends CompanyBpmnTimerEventDsl:

val title = "mycompany-myproject-mytimer"
val descr: String = "my timer..."

lazy val example = timerEvent()
end MyTimerEvent
```
10 changes: 10 additions & 0 deletions 02-bpmn/src/main/scala/camundala/bpmn/BpmnProcessDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ trait BpmnProcessDsl extends BpmnDsl:
): SignalEvent[Msg] =
signalEvent(messageName, in, id, descr)

@deprecated("Use .. extends BpmnTimerDsl")
def timerEvent(
title: String,
descr: Optable[String] = None
): TimerEvent =
TimerEvent(
title,
InOutDescr(title, descr = descr.value)
)

private def msgNameDescr(messageName: String, descr: Optable[String]) =
val msgNameDescr = s"- _messageName_: `$messageName`"
Some(descr.value.map(_ + s"\n$msgNameDescr").getOrElse(msgNameDescr))
Expand Down
17 changes: 17 additions & 0 deletions 02-bpmn/src/main/scala/camundala/bpmn/BpmnTimerEventDsl.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package camundala.bpmn

import camundala.domain.*

import scala.reflect.ClassTag

trait BpmnTimerEventDsl extends BpmnDsl:

def title: String

def timerEvent(
): TimerEvent =
TimerEvent(
title,
InOutDescr(title, descr = Some(descr))
)
end BpmnTimerEventDsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package camundala.examples.demos.bpmn

import camundala.bpmn.*

object TimerExample extends BpmnProcessDsl:

lazy val processName: String = "timer-example"
lazy val descr: String = ""
val companyDescr = ""

lazy val example = process()

end TimerExample

object TheTimer extends BpmnTimerEventDsl:

lazy val title: String = "the timer event"
lazy val descr: String = ""
def companyDescr: String = ""

lazy val example = timerEvent()

end TheTimer
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ object ProjectApiCreator extends DefaultApiCreator:
.withPort(8034)

document(
DecisionResultTypes.singleEntryDMN
.withDiagramName("DecisionResultTypes"),
DecisionResultTypes.collectEntriesDMN
.withDiagramName("DecisionResultTypes"),
DecisionResultTypes.singleResultDMN
.withDiagramName("DecisionResultTypes"),
DecisionResultTypes.resultListDMN
.withDiagramName("DecisionResultTypes"),
api(
DecisionResultTypes.demoProcess
.withDiagramName("mapping-example")
Expand All @@ -46,16 +38,20 @@ object ProjectApiCreator extends DefaultApiCreator:
DecisionResultTypes.resultListDMN.withDiagramName("DecisionResultTypes")
),
GenericServiceExample.example,
EnumExample.example,
api(EnumExample.example)(
EnumWorkerExample.example,
DateExample.DateExampleDMN,
VariablesExample.VariablesExampleDMN,
),
SimulationTestOverridesExample.simulationProcess,
group("SignalMessageExample")(
SignalExample.signalExample,
MessageForExample.messageExample,
SignalExample.signalIntermediateExample,
MessageForExample.messageIntermediateExample
),
api(TimerExample.example)(
TheTimer.example
)
)
end ProjectApiCreator
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package camundala.examples.demos.simulation

import camundala.examples.demos.bpmn.*
import camundala.simulation.*

// exampleDemosSimulation/test
// exampleDemosSimulation/testOnly *TimerExampleSimulation
class TimerExampleSimulation extends DemosSimulation:

simulate(
scenario(`timerProcess waiting for job`)(
TheTimer.example
),
scenario(`timerProcess waiting for variable`)(
TheTimer.example
.waitFor("timerReady")
)
)

private lazy val `timerProcess waiting for job` = TimerExample.example
private lazy val `timerProcess waiting for variable` = TimerExample.example
end TimerExampleSimulation
13 changes: 8 additions & 5 deletions 05-examples/demos/catalog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
### Demos Example Process API
- [Bpmn: camundala-mapping-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20camundala-mapping-example)
- [Bpmn: enum-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20enum-example)
- [Bpmn: message-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20message-for-example)
- [Bpmn: example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20example)
- [Bpmn: example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20example)
- [Bpmn: myservice.api.v1.post](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20myservice.api.v1.post)
- [Bpmn: signal-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20signal-example)
- [Bpmn: simulation-TestOverrides](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20simulation-TestOverrides)
- [Bpmn: timer-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Bpmn:%20timer-example)
- [Dmn: DateExample](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20DateExample)
- [Dmn: VariablesExample](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20VariablesExample)
- [Dmn: collectEntries](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20collectEntries)
- [Dmn: resultList](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20resultList)
- [Dmn: singleEntry](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20singleEntry)
- [Dmn: singleResult](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Dmn:%20singleResult)
- [Message: intermediate-message-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Message:%20intermediate-message-for-example)
- [Signal: intermediate-signal-for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Signal:%20intermediate-signal-for-example)
- [Timer: wait for one day](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Timer:%20wait%20for%20one%20day)
- [Message: for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Message:%20for-example)
- [Signal: for-example](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Signal:%20for-example)
- [Timer: the timer event](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Timer:%20the%20timer%20event)
- [Worker: myEnumWorker.Topic](https://webstor.ch/camundala/myCompany/demos-example/OpenApi.html#operation/Worker:%20myEnumWorker.Topic)
Loading

0 comments on commit 90e6788

Please sign in to comment.