Prerequisites • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6
BPMN processes might require additional information during execution, e.g. for configuration purposes.
We will take a look at two possibilities on how to pass additional information to a BPMN process: Environment Variables and Input Parameters.
The goal of this exercise is to enhance the dsfdev_dicProcess
by trying them both.
In both cases the information will be available in the doExecute
method of your service class.
In order to solve this exercise, you should have solved the first exercise and read the topics on Environment Variables, Task Input Parameters, Accessing Task Resources During Execution, Placeholders and Read Access Tag.
Solutions to this exercise are found on the branch solutions/exercise-2
.
-
Add a new boolean variable to the
TutorialConfig
class. It will enable/disable logging and have its value injected from an environment variable. Add the annotation and specify the default value asfalse
. You may freely choose a name for your environment variable here. Just make sure you follow the naming convention explained earlier. -
Modify the constructor of the
DicTask
class to use the newly created variable. Don't forget to change theDicTask
bean inTutorialConfig
. -
Use the value of the environment variable in the
DicTask
class to decide whether the log message from exercise 1 should be printed. -
Add the new environment variable to the
dic-bpe
service indev-setup/docker-compose.yml
and set the value to"true"
. -
Create a new CodeSystem with url
http://dsf.dev/fhir/CodeSystem/tutorial
having a concept with codetutorial-input
. Don't forget to add theread-access-tag
.Don't how to create a CodeSystem?
Check out this guide.
Don't know where to put the CodeSystem?
tutorial-process/src/main/resources/fhir/CodeSystem
. -
Create a new ValueSet with url
http://dsf.dev/fhir/ValueSet/tutorial
that includes all concepts from the CodeSystem. Don't forget to add theread-access-tag
.Don't how to create a ValueSet?
Check out this guide.
Don't know where to put the ValueSet?
tutorial-process/src/main/resources/fhir/ValueSet
. -
Add a new input parameter of type
tutorial-input
withTask.input.value[x]
as astring
to thetask-start-dic-process.xml
Task profile.Don't how to add a new input parameter?
Check out this guide.
-
task-start-dic-process
and by extension the processdsfdev_dicProcess
now require additional FHIR resources. Make sure the return value forTutorialProcessPluginDefinition#getFhirResourcesByProcessId
also includes the new CodeSystem and ValueSet resources for thedsfdev_dicProcess
. -
Read the new input parameter in the
DicTask
class from the start Task and add the value to the log message from exercise 1.Don't know how to get the input parameter?
The
TaskHelper
instance will prove useful here. Use it in conjunction withvariables
to get the right Task resource from the BPMN process execution. -
We just changed the elements a Task resource has to include. So you need to change
example-task.xml
for cURL orTask/task-start-dic-process.xml
, if you want to use the web interface, to include the new input parameter. The actual value may be any arbitrary string.
Execute a maven build of the dsf-process-tutorial
parent module via:
mvn clean install -Pexercise-2
Verify that the build was successful and no test failures occurred.
To verify the dsfdev_dicProcess
can be executed successfully, we need to deploy it into a DSF instance and execute the process. The maven install
build is configured to create a process jar file with all necessary resources and copy the jar to the appropriate locations of the docker dev setup.
-
Start the DSF FHIR server for the
Test_DIC
organization in a console at location.../dsf-process-tutorial/dev-setup
:docker-compose up dic-fhir
Verify the DSF FHIR server started successfully.
-
Start the DSF BPE server for the
Test_DIC
organization in second console at location.../dsf-process-tutorial/dev-setup
:docker-compose up dic-bpe
Verify the DSF BPE server started successfully and deployed the
dsfdev_dicProcess
. -
Start the
dsfdev_dicProcess
by posting an appropriate FHIR Task resource to the DSF FHIR server of theTest_DIC
organization using either cURL or the DSF FHIR server's web interface. Check out Starting A Process Via Task Resources again if you are unsure.Verify that the
dsfdev_dicProcess
was executed by the DSF BPE server. The BPE server should:- Print a message showing that the process was started.
- If logging is enabled - print the log message and the value of the input parameter you added to the
DicTask
implementation. - Print a message showing that the process finished.
Check that you can disable logging of your message by modifying the docker-compose.yml
file and configuring your environment variable with the value "false"
or removing the environment variable.
Note: Changes to environment variable require recreating the docker container.
Also check that modification to the Task input parameter specified in the TutorialExampleStarter
class, have the appropriate effect on your log message.
Prerequisites • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6