├── .gitattributes
├── .gitignore
├── README.md
├── img
├── Camunda-BPM-Intializer.png
├── Camunda-is-running.png
├── Cockpit-process.png
├── Navigation-Camunda-webapps.png
├── TweetServiceTask.png
├── XORgateway.png
├── active-token.png
├── cancel-token.png
├── claim-complete-task.png
├── complete-token.png
├── display-events-task.png
├── error-event-details.png
├── error-event-prop.png
├── error-history.png
├── implement-EventDelegate.png
├── imported-project.png
├── model-with-error-event.png
├── running-instance.png
├── send-tweet-properties.png
├── seqence-flow-yes.png
├── simple-filter.png
├── start-a-process.png
├── start-process-console-output.png
├── start-process-one.png
├── start-process-two.png
├── strawberries.jpg
├── strawberry-process-one.png
├── strawberry-process-two.png
├── token-on-tweet.png
├── tweet-console.png
└── welcome-page.png
├── solution-bpmn-models
├── Exercise_02.bpmn
├── Exercise_03.bpmn
└── Exercise_04.bpmn
└── solutions-full-exercises
├── exercise 1
├── .gitignore
├── camunda-h2-database.mv.db
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── workflow
│ │ └── Application.java
│ └── resources
│ ├── application.yaml
│ └── process.bpmn
├── exercise 2
├── .gitignore
├── camunda-h2-database.mv.db
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── workflow
│ │ ├── Application.java
│ │ └── WaterChecker.java
│ └── resources
│ ├── application.yaml
│ └── process.bpmn
├── exercise 3
├── .gitignore
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── workflow
│ │ ├── Application.java
│ │ └── WaterChecker.java
│ └── resources
│ ├── application.yaml
│ └── process.bpmn
├── exercise 4
├── .gitignore
├── camunda-h2-database.mv.db
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── workflow
│ │ ├── Application.java
│ │ └── WaterChecker.java
│ └── resources
│ ├── application.yaml
│ └── process.bpmn
├── exercise 5
├── .gitignore
├── TweetWorker
│ └── TweetWorker.js
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── workflow
│ │ ├── Application.java
│ │ └── WaterChecker.java
│ └── resources
│ ├── application.yaml
│ └── process.bpmn
└── exercise 6
├── .gitignore
├── TweetWorker
├── TweetWorker.js
└── package-lock.json
├── pom.xml
└── src
└── main
├── java
└── com
│ └── example
│ └── workflow
│ ├── Application.java
│ └── WaterChecker.java
└── resources
├── application.yaml
└── process.bpmn
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Camunda 7 Code Studio
2 |
3 |
4 |
5 |
6 |
7 | 
8 |
9 | The goal of this workshop is for me to teach the world what i have learned from my short time growing strawberries. I'll of course be doing this through the magic of Camunda and BPMN. I'll go going through 4 objectives
10 |
11 | Welcome to Camunda's Code studio. These exercises has been designed for an online course. But you can follow the exercises here without attending the online event - just imagine that you hear Niall talking to you. The readme contains the detailed instruction on how to complete the exercises. In the other folders you find the model solutions as well as the full code solutions. The presentation from the workshop is provided as well.
12 |
13 |
14 | 1. Create your camunda project
15 | 1. Model and execute process
16 | 1. Route your process
17 | 1. Add BPMN Events to your process
18 |
19 |
20 | To make that an even better learning experience Pull request are very welcome!
21 |
22 |
23 |
24 | ## Exercise 1: Set up a Camunda Springboot appliaction
25 | :trophy: Goal of exercise number 1 is to create a running Camunda instance with Springboot.
26 |
27 |
28 | Luckily we have the [Camunda BPM Intitializer](https://start.camunda.com/), which will create a plain Camunda Springboot project for us.
29 |
30 | 
31 |
32 | If you want to create the project manually and understand what the Camunda BPM Intitializer does, this [tutorial](https://docs.camunda.org/get-started/spring-boot/) guides you through it.
33 |
34 | By generating your project you will download a zip file that contains a pom file with the needed dependencies as well as a simple application class in order to start Camunda as a spring boot application. Extract the file and import the project to an IDE of your choice (e.g.: in Eclipse: import -> existing maven project -> select unzipped folder or simply opening the pom.xml file with intellij)
35 |
36 | 
37 |
38 |
39 | Navigate to scr/main/java/com.example.workshop/Application.java. right click on the class and run it on your server. Springboot will start up Camunda. You should see this in the console.
40 |
41 | 
42 |
43 |
44 | To ensure that the webapps are working visit http://localhost:8080 and login with the credentials you have create in the Camunda BPM Intializer. The default is:
45 |
46 | ```
47 | Usrename: demo
48 | Password: demo
49 | ```
50 |
51 | **:tada: Congrats you have a Camunda running**
52 |
53 |
54 | ## Exercise 2: Add a Process model to your application
55 | :trophy: The goal of this exercise is to create a process for our application.
56 |
57 | For this exercise we need the Camunda Modeler. If you don't have it already download it [here](https://camunda.com/download/modeler/)
58 |
59 |
60 | Next, in the project you've created ``scr/main/ressource`` you'll see a file called process.bpmn open that process in the Camunda Modeler. We're going to change this process into something a little more interesting. Specifically something that has been taking up a lot of my time recently. Strawberries.
61 |
62 | 
63 |
64 |
65 |
66 | :pencil2:
67 | One import part of keeping strawberries is not killing them. I've found that killing strawberries can be done by either not enough water or too much water. So in this process i can see is the amount of water i give my strawberries going to kill it.
68 |
69 |
70 | Model the process.
71 | *Hint: [Here](/solution-bpmn-models) you find the modeling solutions for the exercises.*
72 | Save your model.
73 |
74 |
75 | In order to make it run within Camunda we need to add the technical details. That means we need to provide code for the Service task. Three are a number of ways of running client code, but in this case, because i'm using spring boot i'm going to call a Java Class Directly. Which means using implmentation type: ``Delegate Expression`` and adding an expession which will point a java class that i'll write shortly. In this case we'll call it ``#{waterChecker}``
76 |
77 |
78 | 
79 |
80 |
81 | After adding the implmentation type to the model it's time i go ahead and write the java class that i intend to use.
82 | Below is the code itself.
83 |
84 | ```java
85 | package com.example.workflow;
86 |
87 | import org.camunda.bpm.engine.delegate.DelegateExecution;
88 | import org.camunda.bpm.engine.delegate.JavaDelegate;
89 |
90 | import javax.inject.Named;
91 |
92 | @Named
93 | public class WaterChecker implements JavaDelegate {
94 |
95 | @Override
96 | public void execute(DelegateExecution delegateExecution) throws Exception {
97 | String strawberryStatus = "";
98 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
99 |
100 | if(inchesOfWater == 2){
101 | strawberryStatus = "You've added the right amount of water";
102 | delegateExecution.setVariable("waterSuccess", true);
103 | }else{
104 | strawberryStatus = "it's not looking good for your strawberries";
105 | delegateExecution.setVariable("waterSuccess", false);
106 | }
107 |
108 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
109 | System.out.println(strawberryStatus);
110 | }
111 |
112 | }
113 | ```
114 |
115 |
116 | Once you've added the class to your project the engine will find it in runtime and exectue the code. Settting a bunch of variables.
117 | ``waterSuccess`` is a boolean which is ``true`` if you've added enough water and ``strawberryStatus`` is a String in which a user can read the restults of the water they've added in plane english.
118 |
119 | Now it's time to see it in action.
120 |
121 | Restart your springboot application and once again naviat to http://localhost:8080/ login as before and you'll be greated by the welcome page
122 |
123 | 
124 |
125 | Click on the link for Tasklist where you can start your process my clicking the link on the top right of the screen.
126 |
127 | .
128 |
129 | Once you've clicked start process you'll able to see a list of processes - in this case there should only be one to click on. ``code-studio-process``
130 |
131 | 
132 |
133 | Clicking on it will bring up the start form - this is where we need to enter the amonut of water that we're going to add to the strawberries. The variable name is ``inchesOfWater`` and this can be entered by clicking on ``Add a variable`` and entering
134 |
135 | ```
136 | Name: inchesOfWater
137 | Type: Integer
138 | Value: 2
139 | ```
140 |
141 | The screeshot beblow should indicate what you should see.
142 |
143 | 
144 |
145 | So now the moment of truth... click ``Start`` to see your process run!
146 | The first way you can tell that it's successful is by checking the console in your IDE. It should print something as seen Here
147 |
148 | 
149 |
150 | So - with that output we know that we've started an instance, but after that the process (according to our model) should move to a User Task in which we should be eating some strawberries. So see this task a simple filter will be required and this can be done with the click of a button. On the right of the screen you'll see a ``Add a simple filter`` button.
151 |
152 | 
153 |
154 | After clicking it a filter will be created revealing the user task, at which point you can
155 |
156 | 1. Select the Task
157 | 1. Click ``Claim`` on the Task
158 | 1. Inpect the variables by clicking ``Load Variables`` claim-complete-task.png
159 | 1. Compete the Task.
160 |
161 | 
162 |
163 |
164 | **:tada: Congrats your first process in Camunda runs and you have completed one instance of it**
165 |
166 |
167 | ## Exercise 3: Use process data to route your process
168 | :trophy: The goal of this exercise is to use the data from the Service task to route your process.
169 |
170 |
171 | :pencil2: Obviously our processes is not quite right, if we badly water our strawberries they're going to die and we wont be able to eat any :cry:. So we'll use the data generated by our Java class to route our process so ensure we only eat strawberries if we've properly watered it. So I'm going to need to change my model to the following
172 |
173 | 
174 |
175 | *Hint: [Here](/solution-bpmn-models) you find the modeling solutions for the exercises.*
176 |
177 | Now we need to implement the technical details for the new version of the model. This means adding expressions to the Sequence flows that are leaving the XOR Gateway.
178 |
179 | Each sequence flow will be evaluating the same variable ``waterSuccess`` if it's true we want to try our strawberries if it's false we'll want to head out and buy more strawberries.
180 |
181 | Selecting the ``Yes`` sequence flow well let you add an expression. That expression should be
182 | ```
183 | #{waterSuccess}
184 | ```
185 |
186 | while the sequence flow for ``No`` should read
187 | ```
188 | #{!waterSuccess}
189 | ```
190 |
191 | 
192 |
193 |
194 | The expression language used is from Java the Unified Expression Language (UEL). If you want to find an overview and more information you can look [here](https://docs.oracle.com/javaee/5/tutorial/doc/bnahq.html).
195 |
196 | Restrating your spring boot applicatoin will create a new veresion of the model and so by following the same procedure of starting the process instance as in the previous step, you should be able to see the ``Try to eat a strawberry!`` user task if you've entered 2 inches of water or ``Go buy some strawberries`` if you have any other number.
197 |
198 |
199 | **:tada: Congrats now your process can be routed depending the data you get**
200 |
201 | ## Exercise 4: Adding BPMN events to you process
202 | :trophy: Trigger and Catch a BPMN Error event which will ensure that we water our strawberries too much.
203 |
204 | To do this we need to check the amount of water and decided if we should throw an error or not. The error will be then need to be caught by the model. So first things first. I'm going ot add an error event to my model as well as a user task.
205 |
206 | 
207 |
208 | The error event needs to expect a specific Error Code. This can be added via the modeler.
209 |
210 | 1. After selecting the error event click the plus button to create the error object.
211 | 1. Then enter ``TooMuchWater`` as both the Error Name and Error Code.
212 | 1. Finally add ``WaterError`` as the Error Message Variable.
213 |
214 |
215 | 
216 |
217 | Now that the model is read to each an error with the code ``TooMuchWater`` i'm going to need to throw the Error event from my code. I can do this by going back to my ``WaterChecker.java`` class and making a small change to the code. If the water is more than 2 inches i want to throw an error.
218 |
219 | ```Java
220 |
221 | if(inchesOfWater > 2){
222 | throw new BpmnError("TooMuchWater", "Add Less water or the Strawberries will die!");
223 | }
224 | else if(inchesOfWater == 2){
225 | strawberryStatus = "You've added the right amount of water";
226 | delegateExecution.setVariable("waterSuccess", true);
227 | }else{
228 | strawberryStatus = "it's not looking good for your strawberries";
229 | delegateExecution.setVariable("waterSuccess", false);
230 | }
231 |
232 | ```
233 | After making this change, it's time to re-launch the application and once again start a new instance. this time the variable ``inchesOfWater`` should be ``3``. in this case once we start the instance we should be brought to the ``Enter new amount of water`` user task. Claim the task and then load the variables in order to see and changes the inches of water. You should also be able to see the erorr message that was added via the Java class.
234 | Change the variable and complete the task to finish the excersise.
235 |
236 | **:tada: Congrats you've triggered an error event!**
237 |
238 | ## Exercise 5: Adding An External Task to your process
239 | :trophy: Create an external worker which runs independently and is triggered to run by the process.
240 |
241 | Right now everything we've done has been contained within the same spring boot project but now we're going to create an `External Worker`. This is a little bit of JavaScript code which runs on it's own and subscribes to a `Topic` which is defined in our process model as an `External Service Task`. We call this the external task pattern. The diagram below explains the principle.
242 |
243 | 
244 |
245 | First we need to add a new service task to our model. We're going to use a parallel gateway so that we can both Tweet about our strawberries while we water them.
246 | 
247 |
248 | When implementing this service task, we're not going to call a bean. Instead we're going to select `External Task` from the implementation dropdown and then enter ``SendTweet`` in the `Topic` field.
249 |
250 | 
251 |
252 | You can restart your project now and the new version of the process should be deployed - then you can start a new instance just as you have before from `tasklist`
253 | If all goes according to plan you should see a token waiting on the tweet Task in `Cockpit`.
254 |
255 | 
256 |
257 | Now it's time to actually build the external worker itself. I'm going to using the [Camunda JavaScript External Task Client](https://github.com/camunda/camunda-external-task-client-js) for this example so you'll need to [install npm](https://www.npmjs.com/get-npm) if you'd like to do this part.
258 |
259 | Create a new directory in your project ``TweetWorker`` and then open a console window in that folder and enter the following:
260 |
261 | ```
262 | npm install -s camunda-external-task-client-js
263 | ```
264 | That should have created a ``node_modules`` folder.
265 | Now we're ready to actually build the worker. So create a new file TweetWorker.js
266 | In that file drop the following Java Script code
267 |
268 |
269 | ```JavaScript
270 |
271 | const { Client, logger } = require("camunda-external-task-client-js");
272 |
273 | // configuration for the Client:
274 | // - 'baseUrl': url to the Workflow Engine
275 | // - 'logger': utility to automatically log important events
276 | const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger, asyncResponseTimeout: 5000, workerId: "Justinian" };
277 |
278 | // create a Client instance with custom configuration
279 | const client = new Client(config);
280 |
281 | // susbscribe to the topic: 'SendTweet'
282 | client.subscribe("SendTweet", async function({ task, taskService }) {
283 | // Put your business logic
284 | console.log('Watering my strawberries - its great!');
285 | // complete the task
286 | await taskService.complete(task);
287 | });
288 |
289 | ```
290 |
291 | Now save the fine, return to the console window and to start the worker entered
292 |
293 | ``
294 | node TweetWorker.js
295 | ``
296 |
297 | If all goes according to plan you should be able to see that the worker has locked and complete the task and the process has moved on.
298 |
299 | 
300 |
301 |
302 | **:tada: Congrats you've got yourself an external task running**
303 |
304 | ## Exercise 6: Throwing an Error Event from an External Task
305 |
306 | :trophy: The goal here is to trigger an error event from the external task which stops the process.
307 |
308 | We all know that if social media can't be informed of your actions, you might as well have never performed them. So lets take that into account by adding a feature which would stop the whole process if we can't send out a tweet about our strawberries.
309 |
310 | This requires two changes.
311 | 1. Our External task needs to throw a ``BPMN Error`` under certain circumstances
312 | 1. The process needs to catch that error and end the process.
313 |
314 | Throwing the BPMN is pretty easy we can trigger it by adding a line to our JavaScript worker.
315 |
316 | ```JavaScript
317 | await taskService.handleBpmnError(task, "TwitterDown", "Twitter is down");
318 | ```
319 |
320 | Catching the error is going to work differently from the previous error example. In this example we're changing to the scope so that when the error is caught it cancels all other tokens in the process. This will be done using my favorite BPMN symbol the [Event Based Sub process](https://camunda.com/best-practices/building-flexibility-into-bpmn-models/#_event_sub_processes).
321 |
322 | We'll add it to the model with an Error start event and then tell it to wait for the ``TwitterDown`` error.
323 | 
324 |
325 | Now If the error event is send from the external task it will be caught and the act of catching the error will cancel any other token in the process and the user will be asked to read a book - I personally would recommend [Lafayette In The Somewhat United States by Sarah Vowell](https://www.hive.co.uk/Product/Sarah-Vowell/Lafayette-In-The-Somewhat-United-States/19468181)
326 |
327 | The below model illustrates this.
328 |
329 | | Active Tokens | Completed Tokens | Canceled Tokens |
330 | | -------------------- |:---------------------------:| ----------------:|
331 | |  |  | |
332 |
333 |
334 |
335 |
336 | 
337 |
338 |
339 | ## Enjoy your strawberries
340 |
341 | 
342 |
--------------------------------------------------------------------------------
/img/Camunda-BPM-Intializer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/Camunda-BPM-Intializer.png
--------------------------------------------------------------------------------
/img/Camunda-is-running.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/Camunda-is-running.png
--------------------------------------------------------------------------------
/img/Cockpit-process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/Cockpit-process.png
--------------------------------------------------------------------------------
/img/Navigation-Camunda-webapps.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/Navigation-Camunda-webapps.png
--------------------------------------------------------------------------------
/img/TweetServiceTask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/TweetServiceTask.png
--------------------------------------------------------------------------------
/img/XORgateway.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/XORgateway.png
--------------------------------------------------------------------------------
/img/active-token.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/active-token.png
--------------------------------------------------------------------------------
/img/cancel-token.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/cancel-token.png
--------------------------------------------------------------------------------
/img/claim-complete-task.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/claim-complete-task.png
--------------------------------------------------------------------------------
/img/complete-token.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/complete-token.png
--------------------------------------------------------------------------------
/img/display-events-task.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/display-events-task.png
--------------------------------------------------------------------------------
/img/error-event-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/error-event-details.png
--------------------------------------------------------------------------------
/img/error-event-prop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/error-event-prop.png
--------------------------------------------------------------------------------
/img/error-history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/error-history.png
--------------------------------------------------------------------------------
/img/implement-EventDelegate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/implement-EventDelegate.png
--------------------------------------------------------------------------------
/img/imported-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/imported-project.png
--------------------------------------------------------------------------------
/img/model-with-error-event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/model-with-error-event.png
--------------------------------------------------------------------------------
/img/running-instance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/running-instance.png
--------------------------------------------------------------------------------
/img/send-tweet-properties.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/send-tweet-properties.png
--------------------------------------------------------------------------------
/img/seqence-flow-yes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/seqence-flow-yes.png
--------------------------------------------------------------------------------
/img/simple-filter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/simple-filter.png
--------------------------------------------------------------------------------
/img/start-a-process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/start-a-process.png
--------------------------------------------------------------------------------
/img/start-process-console-output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/start-process-console-output.png
--------------------------------------------------------------------------------
/img/start-process-one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/start-process-one.png
--------------------------------------------------------------------------------
/img/start-process-two.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/start-process-two.png
--------------------------------------------------------------------------------
/img/strawberries.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/strawberries.jpg
--------------------------------------------------------------------------------
/img/strawberry-process-one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/strawberry-process-one.png
--------------------------------------------------------------------------------
/img/strawberry-process-two.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/strawberry-process-two.png
--------------------------------------------------------------------------------
/img/token-on-tweet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/token-on-tweet.png
--------------------------------------------------------------------------------
/img/tweet-console.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/tweet-console.png
--------------------------------------------------------------------------------
/img/welcome-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/img/welcome-page.png
--------------------------------------------------------------------------------
/solution-bpmn-models/Exercise_02.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_0y2ak32
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_0y2ak32
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/solution-bpmn-models/Exercise_03.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_0y2ak32
19 |
20 |
21 |
22 | Flow_0y2ak32
23 | Flow_07jcun5
24 | Flow_1ooqxuz
25 |
26 |
27 |
28 |
29 | Flow_0u34s0i
30 |
31 |
32 |
33 | Flow_1ooqxuz
34 | Flow_0u34s0i
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/solution-bpmn-models/Exercise_04.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_08crt6r
19 | Flow_0y2ak32
20 |
21 |
22 |
23 | Flow_0y2ak32
24 | Flow_07jcun5
25 | Flow_1ooqxuz
26 |
27 |
28 | #{waterSuccess}
29 |
30 |
31 | #{!waterSuccess}
32 |
33 |
34 | Flow_0u34s0i
35 |
36 |
37 |
38 | Flow_1ooqxuz
39 | Flow_0u34s0i
40 |
41 |
42 | Flow_1ypxlo7
43 |
44 |
45 |
46 |
47 |
48 | Flow_1ypxlo7
49 | Flow_08crt6r
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/camunda-h2-database.mv.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/solutions-full-exercises/exercise 1/camunda-h2-database.mv.db
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
24 | org.camunda.bpm.springboot
25 | camunda-bpm-spring-boot-starter-rest
26 | 7.15.0
27 |
28 |
29 |
30 | org.camunda.bpm.springboot
31 | camunda-bpm-spring-boot-starter-webapp
32 | 7.15.0
33 |
34 |
35 |
36 | com.h2database
37 | h2
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-data-jpa
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-maven-plugin
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 1/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | SequenceFlow_1fp17al
14 | SequenceFlow_16gzt2m
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/camunda-h2-database.mv.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/solutions-full-exercises/exercise 2/camunda-h2-database.mv.db
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
24 | org.camunda.bpm.springboot
25 | camunda-bpm-spring-boot-starter-rest
26 | 7.15.0
27 |
28 |
29 |
30 | org.camunda.bpm.springboot
31 | camunda-bpm-spring-boot-starter-webapp
32 | 7.15.0
33 |
34 |
35 |
36 | com.h2database
37 | h2
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-data-jpa
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-maven-plugin
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/src/main/java/com/example/workflow/WaterChecker.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.camunda.bpm.engine.delegate.DelegateExecution;
4 | import org.camunda.bpm.engine.delegate.JavaDelegate;
5 |
6 | import javax.inject.Named;
7 |
8 | @Named
9 | public class WaterChecker implements JavaDelegate {
10 |
11 | @Override
12 | public void execute(DelegateExecution delegateExecution) throws Exception {
13 | String strawberryStatus = "";
14 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
15 |
16 | if(inchesOfWater == 2){
17 | strawberryStatus = "You've added the right amount of water";
18 | delegateExecution.setVariable("waterSuccess", true);
19 | }else{
20 | strawberryStatus = "it's not looking good for your strawberries";
21 | delegateExecution.setVariable("waterSuccess", false);
22 | }
23 |
24 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
25 | System.out.println(strawberryStatus);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 2/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_0y2ak32
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_0y2ak32
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
24 | org.camunda.bpm.springboot
25 | camunda-bpm-spring-boot-starter-rest
26 | 7.15.0
27 |
28 |
29 |
30 | org.camunda.bpm.springboot
31 | camunda-bpm-spring-boot-starter-webapp
32 | 7.15.0
33 |
34 |
35 |
36 | com.h2database
37 | h2
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-data-jpa
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-maven-plugin
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/src/main/java/com/example/workflow/WaterChecker.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.camunda.bpm.engine.delegate.DelegateExecution;
4 | import org.camunda.bpm.engine.delegate.JavaDelegate;
5 |
6 | import javax.inject.Named;
7 |
8 | @Named
9 | public class WaterChecker implements JavaDelegate {
10 |
11 | @Override
12 | public void execute(DelegateExecution delegateExecution) throws Exception {
13 | String strawberryStatus = "";
14 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
15 |
16 | if(inchesOfWater == 2){
17 | strawberryStatus = "You've added the right amount of water";
18 | delegateExecution.setVariable("waterSuccess", true);
19 | }else{
20 | strawberryStatus = "it's not looking good for your strawberries";
21 | delegateExecution.setVariable("waterSuccess", false);
22 | }
23 |
24 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
25 | System.out.println(strawberryStatus);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 3/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_0y2ak32
19 |
20 |
21 |
22 | Flow_0y2ak32
23 | Flow_07jcun5
24 | Flow_1ooqxuz
25 |
26 |
27 | #{waterSuccess}
28 |
29 |
30 | #{!waterSuccess}
31 |
32 |
33 | Flow_0u34s0i
34 |
35 |
36 |
37 | Flow_1ooqxuz
38 | Flow_0u34s0i
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/camunda-h2-database.mv.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/camunda-community-hub/CamundaCodeStudioOne/7edb5cdaddedb0cd5a1a57de65df48f7f4428e6d/solutions-full-exercises/exercise 4/camunda-h2-database.mv.db
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
24 | org.camunda.bpm.springboot
25 | camunda-bpm-spring-boot-starter-rest
26 | 7.15.0
27 |
28 |
29 |
30 | org.camunda.bpm.springboot
31 | camunda-bpm-spring-boot-starter-webapp
32 | 7.15.0
33 |
34 |
35 |
36 | com.h2database
37 | h2
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-data-jpa
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-maven-plugin
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/src/main/java/com/example/workflow/WaterChecker.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.camunda.bpm.engine.delegate.BpmnError;
4 | import org.camunda.bpm.engine.delegate.DelegateExecution;
5 | import org.camunda.bpm.engine.delegate.JavaDelegate;
6 |
7 | import javax.inject.Named;
8 |
9 | @Named
10 | public class WaterChecker implements JavaDelegate {
11 |
12 | @Override
13 | public void execute(DelegateExecution delegateExecution) throws Exception {
14 | String strawberryStatus = "";
15 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
16 |
17 | if(inchesOfWater > 2){
18 | throw new BpmnError("TooMuchWater", "Add Less water or the Strawberries will die!");
19 | }
20 | else if(inchesOfWater == 2){
21 | strawberryStatus = "You've added the right amount of water";
22 | delegateExecution.setVariable("waterSuccess", true);
23 | }else{
24 | strawberryStatus = "it's not looking good for your strawberries";
25 | delegateExecution.setVariable("waterSuccess", false);
26 | }
27 |
28 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
29 | System.out.println(strawberryStatus);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 4/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | SequenceFlow_1fp17al
18 | Flow_08crt6r
19 | Flow_0y2ak32
20 |
21 |
22 |
23 | Flow_0y2ak32
24 | Flow_07jcun5
25 | Flow_1ooqxuz
26 |
27 |
28 | #{waterSuccess}
29 |
30 |
31 | #{!waterSuccess}
32 |
33 |
34 | Flow_0u34s0i
35 |
36 |
37 |
38 | Flow_1ooqxuz
39 | Flow_0u34s0i
40 |
41 |
42 | Flow_1ypxlo7
43 |
44 |
45 |
46 |
47 |
48 | Flow_1ypxlo7
49 | Flow_08crt6r
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/TweetWorker/TweetWorker.js:
--------------------------------------------------------------------------------
1 |
2 | const { Client, logger } = require("camunda-external-task-client-js");
3 |
4 | // configuration for the Client:
5 | // - 'baseUrl': url to the Workflow Engine
6 | // - 'logger': utility to automatically log important events
7 | const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger, asyncResponseTimeout: 5000, workerId: "Justinian" };
8 |
9 | // create a Client instance with custom configuration
10 | const client = new Client(config);
11 |
12 | // susbscribe to the topic: 'SendTweet'
13 | client.subscribe("SendTweet", async function({ task, taskService }) {
14 | // Put your business logic
15 | console.log('Watering my strawberries - its great!');
16 | // complete the task
17 | await taskService.complete(task);
18 | });
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
38 |
39 |
40 | org.camunda.bpm.springboot
41 | camunda-bpm-spring-boot-starter-rest
42 | 7.15.0
43 |
44 |
45 |
46 | org.camunda.bpm.springboot
47 | camunda-bpm-spring-boot-starter-webapp
48 | 7.15.0
49 |
50 |
51 | com.h2database
52 | h2
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-starter-data-jpa
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.boot
66 | spring-boot-maven-plugin
67 |
68 |
69 |
70 |
82 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/src/main/java/com/example/workflow/WaterChecker.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.camunda.bpm.engine.delegate.BpmnError;
4 | import org.camunda.bpm.engine.delegate.DelegateExecution;
5 | import org.camunda.bpm.engine.delegate.JavaDelegate;
6 |
7 | import javax.inject.Named;
8 |
9 | @Named
10 | public class WaterChecker implements JavaDelegate {
11 |
12 | @Override
13 | public void execute(DelegateExecution delegateExecution) throws Exception {
14 | String strawberryStatus = "";
15 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
16 |
17 | if(inchesOfWater > 2){
18 | throw new BpmnError("TooMuchWater", "Add Less water or the Strawberries will die!");
19 | }
20 | else if(inchesOfWater == 2){
21 | strawberryStatus = "You've added the right amount of water";
22 | delegateExecution.setVariable("waterSuccess", true);
23 | }else{
24 | strawberryStatus = "it's not looking good for your strawberries";
25 | delegateExecution.setVariable("waterSuccess", false);
26 | }
27 |
28 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
29 | System.out.println(strawberryStatus);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 5/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | Flow_08crt6r
18 | Flow_0f2epjq
19 | Flow_0y2ak32
20 |
21 |
22 |
23 | Flow_0y2ak32
24 | Flow_07jcun5
25 | Flow_1ooqxuz
26 |
27 |
28 | #{waterSuccess}
29 |
30 |
31 | #{!waterSuccess}
32 |
33 |
34 | Flow_0u34s0i
35 |
36 |
37 |
38 | Flow_1ypxlo7
39 |
40 |
41 |
42 |
43 |
44 | Flow_1ypxlo7
45 | Flow_08crt6r
46 |
47 |
48 | Flow_1ooqxuz
49 | Flow_0u34s0i
50 |
51 |
52 |
53 | SequenceFlow_1fp17al
54 | Flow_0f2epjq
55 | Flow_0nwzoch
56 |
57 |
58 |
59 | Flow_0hrxugj
60 |
61 |
62 |
63 | Flow_0nwzoch
64 | Flow_0hrxugj
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | ##############################
3 | ## Java
4 | ##############################
5 | .mtj.tmp/
6 | *.class
7 | *.jar
8 | *.war
9 | *.ear
10 | *.nar
11 | *.db
12 | hs_err_pid*
13 |
14 | ##############################
15 | ## JavaScript
16 | ##############################
17 | node_modules/
18 |
19 | ##############################
20 | ## Maven
21 | ##############################
22 | target/
23 | pom.xml.tag
24 | pom.xml.releaseBackup
25 | pom.xml.versionsBackup
26 | pom.xml.next
27 | release.properties
28 | dependency-reduced-pom.xml
29 | buildNumber.properties
30 | .mvn/timing.properties
31 | .mvn/wrapper/maven-wrapper.jar
32 |
33 | ##############################
34 | ## Gradle
35 | ##############################
36 | bin/
37 | build/
38 | .gradle
39 | .gradletasknamecache
40 | gradle-app.setting
41 | !gradle-wrapper.jar
42 |
43 | ##############################
44 | ## IntelliJ
45 | ##############################
46 | out/
47 | .idea/
48 | .idea_modules/
49 | *.iml
50 | *.ipr
51 | *.iws
52 |
53 | ##############################
54 | ## Eclipse
55 | ##############################
56 | .settings/
57 | bin/
58 | tmp/
59 | .metadata
60 | .classpath
61 | .project
62 | *.tmp
63 | *.bak
64 | *.swp
65 | *~.nib
66 | local.properties
67 | .loadpath
68 |
69 | ##############################
70 | ## NetBeans
71 | ##############################
72 | nbproject/private/
73 | build/
74 | nbbuild/
75 | dist/
76 | nbdist/
77 | nbactions.xml
78 | nb-configuration.xml
79 |
80 | ##############################
81 | ## OS X
82 | ##############################
83 | .DS_Store
84 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/TweetWorker/TweetWorker.js:
--------------------------------------------------------------------------------
1 |
2 | const { Client, logger } = require("camunda-external-task-client-js");
3 |
4 | // configuration for the Client:
5 | // - 'baseUrl': url to the Workflow Engine
6 | // - 'logger': utility to automatically log important events
7 | const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger, asyncResponseTimeout: 5000, workerId: "Justinian" };
8 |
9 | // create a Client instance with custom configuration
10 | const client = new Client(config);
11 |
12 | // susbscribe to the topic: 'SendTweet'
13 | client.subscribe("SendTweet", async function({ task, taskService }) {
14 | // Put your business logic
15 | var twitterDown = Math.random() >= 0.5;
16 |
17 | if(twitterDown){
18 |
19 | await taskService.handleBpmnError(task, "TwitterDown", "Twitter is down");
20 |
21 | }else{
22 |
23 | console.log('Watering my strawberries - its great!');
24 | // complete the task
25 | await taskService.complete(task);
26 | }
27 | });
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/TweetWorker/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "requires": true,
3 | "lockfileVersion": 1,
4 | "dependencies": {
5 | "@sindresorhus/is": {
6 | "version": "2.1.1",
7 | "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-2.1.1.tgz",
8 | "integrity": "sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg=="
9 | },
10 | "@szmarczak/http-timer": {
11 | "version": "4.0.5",
12 | "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz",
13 | "integrity": "sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ==",
14 | "requires": {
15 | "defer-to-connect": "^2.0.0"
16 | }
17 | },
18 | "@types/cacheable-request": {
19 | "version": "6.0.1",
20 | "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz",
21 | "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==",
22 | "requires": {
23 | "@types/http-cache-semantics": "*",
24 | "@types/keyv": "*",
25 | "@types/node": "*",
26 | "@types/responselike": "*"
27 | }
28 | },
29 | "@types/http-cache-semantics": {
30 | "version": "4.0.0",
31 | "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz",
32 | "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A=="
33 | },
34 | "@types/keyv": {
35 | "version": "3.1.1",
36 | "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz",
37 | "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==",
38 | "requires": {
39 | "@types/node": "*"
40 | }
41 | },
42 | "@types/node": {
43 | "version": "16.0.0",
44 | "resolved": "https://registry.npmjs.org/@types/node/-/node-16.0.0.tgz",
45 | "integrity": "sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg=="
46 | },
47 | "@types/responselike": {
48 | "version": "1.0.0",
49 | "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
50 | "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==",
51 | "requires": {
52 | "@types/node": "*"
53 | }
54 | },
55 | "ansi-styles": {
56 | "version": "3.2.1",
57 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
58 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
59 | "requires": {
60 | "color-convert": "^1.9.0"
61 | }
62 | },
63 | "cacheable-lookup": {
64 | "version": "2.0.1",
65 | "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-2.0.1.tgz",
66 | "integrity": "sha512-EMMbsiOTcdngM/K6gV/OxF2x0t07+vMOWxZNSCRQMjO2MY2nhZQ6OYhOOpyQrbhqsgtvKGI7hcq6xjnA92USjg==",
67 | "requires": {
68 | "@types/keyv": "^3.1.1",
69 | "keyv": "^4.0.0"
70 | }
71 | },
72 | "cacheable-request": {
73 | "version": "7.0.2",
74 | "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz",
75 | "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==",
76 | "requires": {
77 | "clone-response": "^1.0.2",
78 | "get-stream": "^5.1.0",
79 | "http-cache-semantics": "^4.0.0",
80 | "keyv": "^4.0.0",
81 | "lowercase-keys": "^2.0.0",
82 | "normalize-url": "^6.0.1",
83 | "responselike": "^2.0.0"
84 | }
85 | },
86 | "camunda-external-task-client-js": {
87 | "version": "2.1.0",
88 | "resolved": "https://registry.npmjs.org/camunda-external-task-client-js/-/camunda-external-task-client-js-2.1.0.tgz",
89 | "integrity": "sha512-er0Z4/kiF81QCfBk0DulKbR3wGhywGbGAOoEx85D97DnUCEa1nDlrGwq2rq0D8dQj/z4bcHuKnbmt2e14W36xg==",
90 | "requires": {
91 | "chalk": "^2.3.2",
92 | "got": "^10.6.0"
93 | }
94 | },
95 | "chalk": {
96 | "version": "2.4.2",
97 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
98 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
99 | "requires": {
100 | "ansi-styles": "^3.2.1",
101 | "escape-string-regexp": "^1.0.5",
102 | "supports-color": "^5.3.0"
103 | }
104 | },
105 | "clone-response": {
106 | "version": "1.0.2",
107 | "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
108 | "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
109 | "requires": {
110 | "mimic-response": "^1.0.0"
111 | },
112 | "dependencies": {
113 | "mimic-response": {
114 | "version": "1.0.1",
115 | "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
116 | "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
117 | }
118 | }
119 | },
120 | "color-convert": {
121 | "version": "1.9.3",
122 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
123 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
124 | "requires": {
125 | "color-name": "1.1.3"
126 | }
127 | },
128 | "color-name": {
129 | "version": "1.1.3",
130 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
131 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
132 | },
133 | "decompress-response": {
134 | "version": "5.0.0",
135 | "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-5.0.0.tgz",
136 | "integrity": "sha512-TLZWWybuxWgoW7Lykv+gq9xvzOsUjQ9tF09Tj6NSTYGMTCHNXzrPnD6Hi+TgZq19PyTAGH4Ll/NIM/eTGglnMw==",
137 | "requires": {
138 | "mimic-response": "^2.0.0"
139 | }
140 | },
141 | "defer-to-connect": {
142 | "version": "2.0.1",
143 | "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
144 | "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="
145 | },
146 | "duplexer3": {
147 | "version": "0.1.4",
148 | "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
149 | "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI="
150 | },
151 | "end-of-stream": {
152 | "version": "1.4.4",
153 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
154 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
155 | "requires": {
156 | "once": "^1.4.0"
157 | }
158 | },
159 | "escape-string-regexp": {
160 | "version": "1.0.5",
161 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
162 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
163 | },
164 | "get-stream": {
165 | "version": "5.2.0",
166 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
167 | "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
168 | "requires": {
169 | "pump": "^3.0.0"
170 | }
171 | },
172 | "got": {
173 | "version": "10.7.0",
174 | "resolved": "https://registry.npmjs.org/got/-/got-10.7.0.tgz",
175 | "integrity": "sha512-aWTDeNw9g+XqEZNcTjMMZSy7B7yE9toWOFYip7ofFTLleJhvZwUxxTxkTpKvF+p1SAA4VHmuEy7PiHTHyq8tJg==",
176 | "requires": {
177 | "@sindresorhus/is": "^2.0.0",
178 | "@szmarczak/http-timer": "^4.0.0",
179 | "@types/cacheable-request": "^6.0.1",
180 | "cacheable-lookup": "^2.0.0",
181 | "cacheable-request": "^7.0.1",
182 | "decompress-response": "^5.0.0",
183 | "duplexer3": "^0.1.4",
184 | "get-stream": "^5.0.0",
185 | "lowercase-keys": "^2.0.0",
186 | "mimic-response": "^2.1.0",
187 | "p-cancelable": "^2.0.0",
188 | "p-event": "^4.0.0",
189 | "responselike": "^2.0.0",
190 | "to-readable-stream": "^2.0.0",
191 | "type-fest": "^0.10.0"
192 | }
193 | },
194 | "has-flag": {
195 | "version": "3.0.0",
196 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
197 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
198 | },
199 | "http-cache-semantics": {
200 | "version": "4.1.0",
201 | "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
202 | "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
203 | },
204 | "json-buffer": {
205 | "version": "3.0.1",
206 | "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
207 | "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="
208 | },
209 | "keyv": {
210 | "version": "4.0.3",
211 | "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz",
212 | "integrity": "sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA==",
213 | "requires": {
214 | "json-buffer": "3.0.1"
215 | }
216 | },
217 | "lowercase-keys": {
218 | "version": "2.0.0",
219 | "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
220 | "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
221 | },
222 | "mimic-response": {
223 | "version": "2.1.0",
224 | "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
225 | "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA=="
226 | },
227 | "normalize-url": {
228 | "version": "6.1.0",
229 | "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
230 | "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A=="
231 | },
232 | "once": {
233 | "version": "1.4.0",
234 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
235 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
236 | "requires": {
237 | "wrappy": "1"
238 | }
239 | },
240 | "p-cancelable": {
241 | "version": "2.1.1",
242 | "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz",
243 | "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="
244 | },
245 | "p-event": {
246 | "version": "4.2.0",
247 | "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.2.0.tgz",
248 | "integrity": "sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==",
249 | "requires": {
250 | "p-timeout": "^3.1.0"
251 | }
252 | },
253 | "p-finally": {
254 | "version": "1.0.0",
255 | "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
256 | "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
257 | },
258 | "p-timeout": {
259 | "version": "3.2.0",
260 | "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz",
261 | "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==",
262 | "requires": {
263 | "p-finally": "^1.0.0"
264 | }
265 | },
266 | "pump": {
267 | "version": "3.0.0",
268 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
269 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
270 | "requires": {
271 | "end-of-stream": "^1.1.0",
272 | "once": "^1.3.1"
273 | }
274 | },
275 | "responselike": {
276 | "version": "2.0.0",
277 | "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz",
278 | "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==",
279 | "requires": {
280 | "lowercase-keys": "^2.0.0"
281 | }
282 | },
283 | "supports-color": {
284 | "version": "5.5.0",
285 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
286 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
287 | "requires": {
288 | "has-flag": "^3.0.0"
289 | }
290 | },
291 | "to-readable-stream": {
292 | "version": "2.1.0",
293 | "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-2.1.0.tgz",
294 | "integrity": "sha512-o3Qa6DGg1CEXshSdvWNX2sN4QHqg03SPq7U6jPXRahlQdl5dK8oXjkU/2/sGrnOZKeGV1zLSO8qPwyKklPPE7w=="
295 | },
296 | "type-fest": {
297 | "version": "0.10.0",
298 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.10.0.tgz",
299 | "integrity": "sha512-EUV9jo4sffrwlg8s0zDhP0T2WD3pru5Xi0+HTE3zTUmBaZNhfkite9PdSJwdXLwPVW0jnAHT56pZHIOYckPEiw=="
300 | },
301 | "wrappy": {
302 | "version": "1.0.2",
303 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
304 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
305 | }
306 | }
307 | }
308 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.2.5.RELEASE
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 | com.example.workflow
19 | code-studio
20 | 1.0.0-SNAPSHOT
21 |
22 |
23 |
38 |
39 |
40 | org.camunda.bpm.springboot
41 | camunda-bpm-spring-boot-starter-rest
42 | 7.15.0
43 |
44 |
45 |
46 | org.camunda.bpm.springboot
47 | camunda-bpm-spring-boot-starter-webapp
48 | 7.15.0
49 |
50 |
51 | com.h2database
52 | h2
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-starter-data-jpa
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.boot
66 | spring-boot-maven-plugin
67 |
68 |
69 |
70 |
82 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/src/main/java/com/example/workflow/Application.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/src/main/java/com/example/workflow/WaterChecker.java:
--------------------------------------------------------------------------------
1 | package com.example.workflow;
2 |
3 | import org.camunda.bpm.engine.delegate.BpmnError;
4 | import org.camunda.bpm.engine.delegate.DelegateExecution;
5 | import org.camunda.bpm.engine.delegate.JavaDelegate;
6 |
7 | import javax.inject.Named;
8 |
9 | @Named
10 | public class WaterChecker implements JavaDelegate {
11 |
12 | @Override
13 | public void execute(DelegateExecution delegateExecution) throws Exception {
14 | String strawberryStatus = "";
15 | Integer inchesOfWater = (Integer) delegateExecution.getVariable("inchesOfWater");
16 |
17 | if(inchesOfWater > 2){
18 | throw new BpmnError("TooMuchWater", "Add Less water or the Strawberries will die!");
19 | }
20 | else if(inchesOfWater == 2){
21 | strawberryStatus = "You've added the right amount of water";
22 | delegateExecution.setVariable("waterSuccess", true);
23 | }else{
24 | strawberryStatus = "it's not looking good for your strawberries";
25 | delegateExecution.setVariable("waterSuccess", false);
26 | }
27 |
28 | delegateExecution.setVariable("strawberryStatus", strawberryStatus);
29 | System.out.println(strawberryStatus);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | spring.datasource.url: jdbc:h2:file:./camunda-h2-database
2 |
3 | camunda.bpm.admin-user:
4 | id: demo
5 | password: demo
--------------------------------------------------------------------------------
/solutions-full-exercises/exercise 6/src/main/resources/process.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SequenceFlow_1fp17al
6 |
7 |
8 |
9 | SequenceFlow_16gzt2m
10 |
11 |
12 |
13 | Flow_07jcun5
14 | SequenceFlow_16gzt2m
15 |
16 |
17 | Flow_08crt6r
18 | Flow_0f2epjq
19 | Flow_0y2ak32
20 |
21 |
22 |
23 | Flow_0y2ak32
24 | Flow_07jcun5
25 | Flow_1ooqxuz
26 |
27 |
28 | #{waterSuccess}
29 |
30 |
31 | #{!waterSuccess}
32 |
33 |
34 | Flow_0u34s0i
35 |
36 |
37 |
38 | Flow_1ypxlo7
39 |
40 |
41 |
42 |
43 |
44 | Flow_1ypxlo7
45 | Flow_08crt6r
46 |
47 |
48 | Flow_1ooqxuz
49 | Flow_0u34s0i
50 |
51 |
52 |
53 | SequenceFlow_1fp17al
54 | Flow_0f2epjq
55 | Flow_0nwzoch
56 |
57 |
58 |
59 | Flow_0hrxugj
60 |
61 |
62 |
63 | Flow_0nwzoch
64 | Flow_0hrxugj
65 |
66 |
67 |
68 | Flow_1rqvecf
69 |
70 |
71 |
72 |
73 | Flow_1dxqpcn
74 |
75 |
76 |
77 | Flow_1rqvecf
78 | Flow_1dxqpcn
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
--------------------------------------------------------------------------------