I am using latest flowable enterprise edition trial (Flowable design) to create the decision table.
Below is my spring boot app code.
POM file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.flowable</groupId>
<artifactId>spring-flowable-integration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring-flowable-integration</name>
<description>Demo project for Spring Boot using Flowable BPM</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<flowable.version>6.5.0</flowable.version>
<junit.version>4.13</junit.version>
<junit.jupiter.version>5.3.2</junit.jupiter.version>
<junit.vintage.version>5.3.2</junit.vintage.version>
</properties>
<dependencies>
<!-- Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container -->
<!-- H2 Database Engine -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- H2 Database Engine -->
<!-- Starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!-- Starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web -->
<!-- Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito -->
<!-- Flowable Spring Boot Starter Basic -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-basic</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- Flowable Spring Boot Starter Basic -->
<!-- Flowable Spring Boot Starter Rest Api -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-rest</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- Flowable Spring Boot Starter Rest Api -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-dmn-spring-configurator</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- Flowable Spring Boot Starter Actuator -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-actuator</artifactId>
<version>${flowable.version}</version>
</dependency>
<!-- Flowable Spring Boot Starter Actuator -->
<!-- Starter for using Spring Boot's Actuator which provides production ready features to help you monitor and manage your application -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Starter for using Spring Boot's Actuator which provides production ready features to help you monitor and manage your application -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.vintage.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>
Controller
package com.flowable.springflowableintegration.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.flowable.springflowableintegration.domain.Group;
import com.flowable.springflowableintegration.domain.PV;
import com.flowable.springflowableintegration.service.AssignmentWorkflowService;
@RestController
public class AssignmentController {
@Autowired
private AssignmentWorkflowService service;
@RequestMapping(value="/getAssignmentDetails", method= RequestMethod.POST,consumes= MediaType.APPLICATION_JSON_VALUE, produces= MediaType.APPLICATION_JSON_VALUE)
public Group getAssignmentDetails(@RequestBody PV pv) {
service.startProcess(pv);
System.out.println(pv.toString());
Group assignmentGroup = new Group("A");
return assignmentGroup;
}
}
Service
package com.flowable.springflowableintegration.service;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.flowable.springflowableintegration.domain.PV;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AssignmentWorkflowService {
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Transactional
public void startProcess(PV pv) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("country", pv.getCountry());
variables.put("reportType", pv.getReportType());
variables.put("product", pv.getProduct());
variables.put("therapeuticArea", pv.getTherapeuticArea());
variables.put("seriousness", pv.getSeriousness());
variables.put("receivedFrom", pv.getReceivedFrom());
variables.put("forSubmissionTo", pv.getForSubmissionTo());
runtimeService.startProcessInstanceByKey("groupAssignment", variables);
}
}
Assignment_Group.bpmn20.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-process-palette">
<process id="assignmentGroup" name="Assignment Group" isExecutable="true" flowable:candidateStarterGroups="flowableUser">
<extensionElements>
<design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid>
<design:language><![CDATA[English]]></design:language>
<design:creationdate><![CDATA[2021-09-15T05:32:41.878Z]]></design:creationdate>
<design:modificationdate><![CDATA[2021-09-15T05:34:43.663Z]]></design:modificationdate>
</extensionElements>
<startEvent id="startnoneevent1" flowable:initiator="initiator" flowable:formFieldValidation="false">
<extensionElements>
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation>
<design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid>
</extensionElements>
</startEvent>
<sequenceFlow id="sequenceFlow1" sourceRef="startnoneevent1" targetRef="scriptTask1">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
<scriptTask id="scriptTask1" name="Print" scriptFormat="java" flowable:autoStoreVariables="false">
<extensionElements>
<design:stencilid><![CDATA[ScriptTask]]></design:stencilid>
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid>
</extensionElements>
<script><![CDATA[System.out.println("Eureka");]]></script>
</scriptTask>
<endEvent id="endNoneEvent1">
<extensionElements>
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid>
</extensionElements>
</endEvent>
<sequenceFlow id="sequenceFlow2" sourceRef="scriptTask1" targetRef="endNoneEvent1">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_assignmentGroup">
<bpmndi:BPMNPlane bpmnElement="assignmentGroup" id="BPMNPlane_assignmentGroup">
<bpmndi:BPMNShape bpmnElement="startnoneevent1" id="BPMNShape_startnoneevent1">
<omgdc:Bounds height="30.0" width="30.0" x="117.0" y="261.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="scriptTask1" id="BPMNShape_scriptTask1">
<omgdc:Bounds height="80.0" width="100.0" x="192.0" y="236.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endNoneEvent1" id="BPMNShape_endNoneEvent1">
<omgdc:Bounds height="28.0" width="28.0" x="337.0" y="262.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
<omgdi:waypoint x="146.9499984899576" y="276.0"></omgdi:waypoint>
<omgdi:waypoint x="191.9999999999917" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">
<omgdi:waypoint x="291.949999999934" y="276.0"></omgdi:waypoint>
<omgdi:waypoint x="337.0" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
Application properties
server.port=8081
# ===================================================================
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
# ===================================================================
# spring.datasource.driver-class-name = Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
# spring.datasource.password = Login password of the database.
# spring.datasource.url = JDBC url of the database.
# spring.datasource.username = Login username of the database.
# ===================================================================
spring.datasource.username=flowable
spring.datasource.password=flowable
spring.datasource.url=jdbc:h2:~/flowable-db/db
spring.datasource.driver-class-name=org.h2.Driver
# ===================================================================
# H2 Database
# ===================================================================
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.h2.console.settings.trace=true
# ===================================================================
# Core (Process) [FlowableProperties]
# ===================================================================
# flowable.deployment-name = The name of the auto deployment. Default is SpringBootAutoDeployment
# ===================================================================
flowable.deployment-name=SpringBootAutoDeployment
# ===================================================================
# Actuator
# ===================================================================
# management.endpoint.flowable.cache.time-to-live = Maximum time that a response can be cached. Default is 0ms
# management.endpoint.flowable.enabled = Whether to enable the flowable endpoint. Default is true
# ===================================================================
management.endpoint.flowable.cache.time-to-live=0ms
management.endpoint.flowable.enabled=true
# ===================================================================
# ENDPOINTS GENERAL CONFIGURATION
# ===================================================================
# management.endpoints.enabled-by-default = Whether to enable or disable all endpoints by default.
# ===================================================================
management.endpoints.enabled-by-default=true
# ===================================================================
# ENDPOINTS WEB CONFIGURATION (WebEndpointProperties)
# ===================================================================
# management.endpoints.web.exposure.include = Endpoint IDs that should be included or '*' for all.
# ===================================================================
management.endpoints.web.exposure.include=health,shutdown,env,info,flowable,mappings
# ===================================================================
# HEALTH ENDPOINT (HealthEndpoint, HealthEndpointProperties)
# ===================================================================
# management.endpoint.health.show-details = When to show full health details. Default is never
# ===================================================================
management.endpoint.health.show-details=always