Start with downloading the Beta3 distribution from the Activiti download page. In the wars folder you can find the activiti-app.war that can be deployed on a Tomcat server or another servlet container of your choice. By default it will run with an in-memory H2 database. If you want to use a different database you can change the configuration in the WEB-INF/classes/META-INF/activiti-app/activiti-app.properties file, like the following example for MySQL:
Don't forget to change the Hibernate dialect as well and of course add the necessary database driver JAR to the WEB-INF/lib folder.
When the Activiti app has been booted you can see that the Activiti Engine is also included in the Activiti app and will create the Activiti database tables when not present. In addition, also the new Activiti DMN and Form Engine are booted and both engines will also create their database tables when needed (using Liquibase).
Now you can open your web browser and point it to http://localhost:8080/activiti-app and a login screen will be presented. The default user is admin with password test. The dashboard view is now presented:
The Kickstart App can be used to model processes, forms, decision tables and app definitions. The Task app is a general Activiti Engine app that shows all tasks and processes deployed on the Engine. The Identity management component allows you to edit your profile and if you have admin rights (like the default admin user), to create new users and groups.
Let's start with modeling a simple process in the BPMN editor by opening the Kickstart App and create a process in the process tab. In the popup a model name and key have to be filled-in. The model key will be used as the process identifier / logical key.
For this example process we will model a very simple order process, starting with a order start form. When you select the start event on the canvas there's a referenced form property you can click on. This will open a popup where all created forms are available. But you can also click on the new form button to create a new form. Again a form name and form key needs to be filled-in, and the form key will be used as the logical key to lookup the form in the form engine. The form key also has to be unique for every new form you create. When you would use the same form key twice the form engine will think it's the same form and will deploy it as a new version of the previous form with the same form key.
The form editor is opened and you can start dragging form fields on the canvas. Let's add a product name text field and an amount number field to the canvas.
Click the save button and choose the save and close editor button to go back to the BPMN editor. The order start form is now connected to the start event of the order process. The next step in the process is to execute a decision table to decide on what needs to happen with the new order. In the activities palette group, a decision task can be dragged onto the canvas and connect it to the start event.
The decision task is a new type of service task in the Activiti Engine, which will invoke a decision table deployed on the DMN engine. Similar to attaching a form to the start event, you can select the decision table reference property after selecting the decision task on the canvas. The decision table key needs to be a unique logical key as it will be used as an unique identifier when deploying the decision table on the DMN engine.
Let's create a decision table that checks on a product name and an amount combination, and will return a reviewNeeded boolean variable. Select the first input header and fill-in productname for the variable field. Add another input, and fill-in amount for this variable field. For the output field you can fill-in the reviewNeeded variable name and select the boolean variable type. To fill-in an input or output value in the decision table, you have to double-click on the specific cell. The resulting decision table should look similar to the following screenshot:
We can now use the reviewNeeded variable in the next steps of the process. Let's save and close the decision table editor and add an exclusive gateway as the next step in the order process. Complete the order process like shown in this order process screenshot:
The sequence flow to the review task should have the following flow condition:
And the other sequence flow to the closing exclusive gateway can be the negative of this flow condition like:
For the review task, let's add a very simple review form with an expression field. An expression field can be used to included process variables in a label text on a form. Let's fill it with the following expression:
Now the process design, together with forms and decision table is completed and we can use an app definition to deploy this as a bundle to the Activiti Engine. An app definition also needs a unique logical key and it will be persisted in the key property of the Activiti deployment. Let's create the following order app definition and included the order process model.
When clicking the save button, you can select the publish checkbox, which will deploy the process, forms and decision table to the Activiti Engine in a regular deployment. By default, the Activiti Engine will ignore the form (with extension .form) and decision table (with extension .dmn) files. But when the Activiti DMN and/or the Activiti Form Engine has been enabled for the Activiti Engine this changes. The DMN and Form engine can be enabled using a configurator, and can be configured in an activiti.cfg.xml file or in Java like this:
FormEngineConfiguration formEngineConfiguration = new FormEngineConfiguration();
FormEngineConfigurator formEngineConfigurator = new FormEngineConfigurator();
DmnEngineConfiguration dmnEngineConfiguration = new DmnEngineConfiguration();
DmnEngineConfigurator dmnEngineConfigurator = new DmnEngineConfigurator();
The Form Engine configurator is included in the activiti-form-engine-configurator module and the DMN Engine configurator in activiti-dmn-engine-configurator. When the Form Engine configurator is added every .form file in a deployment will be processed on the Activiti Form Engine and deployed as a new form or a new form version. The same is true for the DMN Engine configurator with .dmn files.
In the Activiti app, the DMN and Form Engine are included by default, so the deployment with the .form and .dmn files will also be processed by the Form and DMN Engine and results in two deployed forms and one deployed decision table.
These configurators also expose 2 new services each in the Activiti Engine. The Form Engine exposes the FormEngineRepositoryService and FormEngineFormService service interfaces and the DMN Engine exposes the DmnEngineRepositoryService and DmnEngineRuleService service interfaces. These services can be used to retrieve a form definition or submit a completed form to the Form Engine for example. Or execute a decision table in the DMN Engine.
By using the configurator approach we tried to decouple the DMN and Form Engine as much as possible from the Activiti Engine. If you don't want to use it then there are only two required dependencies with a few classes, activiti-form-api and activiti-dmn-api, to expose the service interfaces to the Activiti Engine.
But coming back to the publish action when saving the app definition. This will deploy the BPMN process on the Activiti Engine, the forms on the Activiti Form Engine, and the DMN decision table on the Activiti DMN Engine. When we go back to the dashboard by clicking on the Activiti logo in the top left of the screen, we can see a new app has appeared.
In the app, you can create new standalone tasks and start new order process instances. Let's start a new process instance and fill-in the start form.
The start form is retrieved form the Form Engine using the logical key we've chosen. After clicking the start process button the decision task will be executed and with this example input we would expect the reviewNeeded variable to be set to true and a review task to be created.
This concludes the introduction to the new Activiti 6 Angular app included in the Beta3 release. With the introduction of the Form Engine and the DMN Engine things have changed quite a bit since Beta2. But we need only a few additional tables now and the components are modularized and made optional. Let us know what you think about these changes, any feedback is valuable to get this app ready for the first Activiti 6 release.