Java SpringBoot integrates Activiti7 workflow

Java SpringBoot integrates Activiti7 workflow

The project demo address of this article is attached at the end of the article

Official website homepage: http://activiti.org

insert image description here

introduce

Activitiis a lightweight workflow and business process management (BPM) platform for business professionals, developers and system administrators. At its heart is Javathe super-fast and rock-solid BPMN 2crafting engine that works for you. It is open source and Apachedistributed under the license. ActivitiRun in any Java application, server, cluster or cloud. It integrates perfectly with Spring, is extremely light weight, and is based on simple concepts.

project integration

Introduce dependencies

<!-- Activiti7依赖 -->
<dependency>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-spring-boot-starter</artifactId>
    <version>7.1.0.M6</version>
</dependency>
<dependency>
    <groupId>org.activiti.dependencies</groupId>
    <artifactId>activiti-dependencies</artifactId>
    <version>7.1.0.M6</version>
    <type>pom</type>
</dependency>

YML configuration file

server:
  port: 8600
spring:
  application:
    name: activity7
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      url: jdbc:mysql://127.0.0.1:3306/activiti7?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&nullCatalogMeansCurrent=true
      username: root
      password: 
      driverClassName: com.mysql.cj.jdbc.Driver
  # activiti7配置
  activiti:
    # 自动部署验证设置:true-开启(默认)、false-关闭
    check-process-definitions: false
    # 保存历史数据
    history-level: full
    # 检测历史表是否存在
    db-history-used: true
    # 关闭自动部署
    deployment-mode: never-fail
    database-schema-update: true
    # 解决频繁查询SQL问题
    async-executor-activate: false

configuration class

import org.activiti.api.runtime.shared.identity.UserGroupManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ActivitiSpringIdentityAutoConfiguration {
    
    

   @Bean
   public UserGroupManager userGroupManager() {
    
    
       return new UserGroupManager() {
    
    
           @Override
           public List<String> getUserGroups(String s) {
    
    
               return new ArrayList<>();
          }
           @Override
           public List<String> getUserRoles(String s) {
    
    
               return null;
          }
           @Override
           public List<String> getGroups() {
    
    
               return null;
          }
           @Override
           public List<String> getUsers() {
    
    
               return null;
          }
      };
  }

}

Startup Project Generate Table Structure

insert image description here

insert image description here
画出来的就是开始创建表结构

Activiti's database support

Activiti needs the support of the database at runtime, and uses 25 tables to read the content of the process definition node into the database table for subsequent use.

The databases and versions supported by activiti are as follows:

database type Version JDBC connection example illustrate
h2 1.3.168 jdbc:h2:tcp://localhost/activiti Database configured by default
mysql 5.1.21 jdbc:mysql://localhost:3306/activiti?autoReconnect=true Use mysql-connector-java to drive the test
oracle 11.2.0.1.0 jdbc:oracle:thin:@localhost:1521:xe
postgres 8.1 jdbc:postgresql://localhost:5432/activiti
db2 DB2 10.1 using db2jcc4 jdbc:db2://localhost:50000/activiti
mssql 2008 using sqljdbc4 jdbc:sqlserver://localhost:1433/activiti

Activiti data table introduction

table classification Table Name explain
general data
[ACT_GE_BYTEARRAY] Generic process definitions and process resources
[ACT_GE_PROPERTY] system related properties
Process History
[ACT_HI_ACTINST] Historical Process Examples
[ACT_HI_ATTACHMENT] Historical Process Attachments
[ACT_HI_COMMENT] historical descriptive information
[ACT_HI_DETAIL] Detailed information on historical process runs
[ACT_HI_IDENTITYLINK] User relationship during historical process running
[ACT_HI_PROCINST] Historical Process Examples
[ACT_HI_TASKINST] Examples of historical tasks
[ACT_HI_VARINST] Variable information in the historical process running
Process definition table
[ACT_RE_DEPLOYMENT] Deployment unit information
[ACT_RE_MODEL] model information
[ACT_RE_PROCDEF] Deployed Process Definition
run instance table
[ACT_RU_EVENT_SUBSCR] runtime events
[ACT_RU_EXECUTION] Runtime process execution instance
[ACT_RU_IDENTITYLINK] Runtime user relationship information, storing information about task nodes and participants
[ACT_RU_JOB] runtime job
[ACT_RU_TASK] runtime task
[ACT_RU_VARIABLE] runtime variable table

Project demo address:

insert image description here
Send: "Get Workflow Items" to download

Guess you like

Origin blog.csdn.net/A_yonga/article/details/132106475