Hands on Bonitasoft with BPMN 2.0 for Beginner

Christian Mahardhika
8 min readOct 2, 2023

--

Introduction BPMN 2.0

Business Process Model and Notation (BPMN) 2.0 is a graphical notation used to represent business processes in a standard way. It provides a common language that allows both technical and non-technical stakeholders to communicate effectively about how a business process works.

Using BPMN 2.0 in software design provides several benefits. It allows designers to model business processes in a clear and standardized way, making it easier to understand and communicate the design. It also helps to identify inefficiencies and bottlenecks in the process, allowing for optimization and improvement. Additionally, BPMN 2.0 models can be used to generate executable code, reducing the time and effort required to develop software that reflects the business process. Overall, the use of BPMN 2.0 in software design can lead to more efficient and effective development processes and better software products.

source: BPMN 2.0 | Business Process Diagram (conceptdraw.com)

This diagram represents a simple BPMN 2.0 process with a start event, three tasks, a gateway, and an end event. The start and end keywords represent the start and end events, respectively. The if and endif keywords represent the gateway and its decision points. The: symbol represents a task. You can customize the appearance of the diagram by using different icons and colors.

Introduction Bonitasoft

Bonitasoft BPMN 2.0 application is a software solution that allows you to design, execute, and manage business processes using the standard notation of Business Process Model and Notation (BPMN). BPMN is a graphical language that enables you to model any kind of process, from simple workflows to complex orchestration of services and systems. With Bonitasoft BPMN 2.0 application, you can:

  • Draw BPMN diagrams using an intuitive and user-friendly graphical interface.
  • Define the data, forms, connectors, and operations that make up your process logic.
  • Deploy and run your processes on a scalable and robust execution engine.
  • Monitor and optimize your processes using dashboards, reports, and analytics.

Bonitasoft BPMN 2.0 application is based on the open source Bonita platform, which is one of the leading providers of BPM solutions in the market. Bonitasoft BPMN 2.0 application is compatible with the latest version of the BPMN standard (version 2.0), which offers more features and capabilities than the previous versions. You can learn more about BPMN and its benefits from The Ultimate Guide to BPMN 2 or BPMN 2.0: Business Process Modeling and Notation. You can also follow this tutorial to start building your first application with Bonitasoft BPMN 2.0 application.

Usecase Project

In this tutorial, you will learn how to create a simple BPMN 2.0 process that uses a weather API to check the temperature of a given city (by longitude and latitude) and display a message based on whether it is warm or cold. You will use Bonita, an open source Business Process Management (BPM) platform, to design, execute, and manage your process. You will also learn how to use connectors, data, and forms to integrate with external services and provide user interactions.

What you will learn

  • Create a BPMN 2.0 diagram using Bonita Studio, the graphical modeling environment of Bonita
  • Use a REST connector to call a weather API and get the temperature of a city
  • Use a data variable to store the temperature value
  • Use a script task to compare the temperature with a threshold and set a flag
  • Use an exclusive gateway to branch the process flow based on the flag
  • Use user tasks and forms to display different messages to the user based on the flag
  • Deploy and run your process on Bonita Runtime, the execution engine of Bonita
  • Interact with your process through the Bonita Portal, the web-based user interface of Bonita

What you will need

To complete this tutorial, you will need:

Let’s get started

Are you ready to create your simple weather API process with Bonita? Let’s go!

  1. Open Your Bonita Studio and create a new process. On the welcome screen, click on Create a new process. Then, select Create a new process from scratch and click on Next. Name your process Weather API and click on Finish.

2. On first screen, you can see the process diagram. There are a starter process diagram that contain a start event and a task called Step 1. You can rename the task by double clicking on it and change the name to Get Weather. Change task type to service.

3. Now, we need to add a connector to the task. Click Execution tab, On Connector In click add. Then, select REST API and click on Next.

4. Arrange the process diagram to make it easier to work with. You can drag and drop the task and connector to make it look like this:

5. Since we need to put initialize value when start the process then we need to define contract value. Create pool contract variable. Click on Pool square. Now, we need to define the connector input. Click on Connector In square, then click on Execution tab, click on Add button. Name the variable dataWeatherInput and change the type to Complex (it same with nested json), add variable latitude and longitude with type text.

6. Back step 3 we need to define the connector input. Click on Execution square, then click on Connector In tab, click on Add button. Click Rest Bonita connector, then click GET Method Name the connector GetWeatherInformation and edit url field put the url like screen capture. Put Latitude and Longitude from pool Process Variables become query param value. Click OK then click next until window Output operations. In this window we need to save the output of Api to process variable as show in this screen capture. And click Edit Script, put the script below. Click OK then click Finish.

7. Now, we need to print the weather information to console. First click on line top (cold) then we need to define “how cold is temperature” yg filtering the value using comparator operation. Click on General set the name as cold and set the condition by click edit button. Put the script below. Click OK then click Finish.

Explanation, the dataWeather.getTemperature() is method that already exist on bonita Business Variables.

8. The flow need default value. So we need set the warm flow to become Default Flow. Click on General set the name as warm and tick the Default Flow checkbox.

9. Then at last we need to print the weather information to console. Click on Execution then click on Operations click Add like below screen shoot

10. Edit the script to print if the weather is cold and the temperature is below 25 degree. Put the script below. Click OK then click Finish.

11. Do as same with step 9 and 10 but this time we need to print if the weather is warm and the temperature is above 25 degree. Put the script below. Click OK then click Finish.

12. Now, we can to test the process. Deploy and run the process localy by Click on Run button.

13. Download the bonita api collection https://api-documentation.bonitasoft.com/latest/ and import to postman. Since we interact with bonita soft process by API not by form.

14. Login to bonita api by using postman. Put the url like screen capture below. We use default username walter.bates and password bpm. Click Send button.

15. Find the current running process id. Put the url like screen capture below. Click Send button. And copy the id from response.

16. Instanciate the process by Put Process ID on url paramter. And set the body like screen capture below. Click Send button.

17. After we send the request, the api should return the response case id number like screen capture below.

18. Check the result by open the bonita administrator portal. Click on BPM then Proceses then click on details button on Weather API process. Click on Archived Cases tab. You can see the case that we just created. Click on the case id.

Click on case list to see the case that we just created. Click on the case id. then click detail -> process variables tab. You can see the process variables that we just created. Click on printTextWeather to see the weather information.

19. Finish, we already create simple weather API process with Bonita. You can try to change the latitude and longitude value to see the different result.

Conclusion and Improvement Insight

In this tutorial, we have learned how to create a simple weather API process with Bonita. We have learned how to create a process, add a connector, and add a condition. We also have learned how to test the process by using Postman.

support us/ buy me a coffee?
https://sociabuzz.com/christianmahardhika/tribe

--

--