Flowable工作流学习

参考资料:

1.Flowable 学习笔记 https://www.jianshu.com/p/799b1ebf5dc4?tdsourcetag=s_pctim_aiomsg

2.Flowable中文文档 https://tkjohn.github.io/flowable-userguide/#_introduction

3.Flowable英文文档 https://www.flowable.org/docs/userguide/index.html

 

前公司用过自行开发的工作流LBPM(Longrise Business Process Management),总体思想还是那一套。

一、怎么画工作流

1.手写BPMN 2.0 XML 文件,这种用来做小修改还行,画大图不太适合

节点定义
开始节点 <startEvent/>
结束节点<endEvent />
用户任务节点<userTask />

连线定义
<sequenceFlow sourceRef="approveTask" targetRef="decision"/>
sourceRef 源 targetRef目标

2.借助工具,目前有两种

Eclipse的 Flowable Designer插件或Flowable Web Modeler的war包

Eclipse的 Flowable Designer插件安装

要求版本 Eclipse Mars或Neon

安装方法

选择Help → Install New Software。在下图面板中,点击Add按钮,并填写下列字段:

Name: Flowable BPMN 2.0 designer

Location: http://www.flowable.org/designer/update/

 

Flowable Web Modeler的war包

下载地址:https://www.flowable.org/downloads.html

最新jar包下载地址:https://github.com/flowable/flowable-engine/releases/download/flowable-6.4.2/flowable-6.4.2.zip

镜像下载:https://download.csdn.net/download/softcm/11596694

5个war包放一起部署,不能缺

直接放tomcat

http://localhost:8080/flowable-task

http://localhost:8080/flowable-modeler

http://localhost:8080/flowable-idm

http://localhost:8080/flowable-admin

http://localhost:8080/flowable-rest/docs

 

设计器登陆http://localhost:8080/flowable-modeler

用户名密码全部都是admin/test

 

Flowable Modeler:流程定义管理

Flowable Task:用户任务管理

Flowable IDM:用户组权限管理

Flowable REST API:流程引擎对外提供的API接口

Flowable Admin:后台管理

 

 

二、war包改造用自己的表

参考:https://blog.csdn.net/weixin_37481769/article/details/87938260
修改各项目目录中WEB-INF/classes/flowable-default.properties的数据库配置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.24.11.205:3306/flowable_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=xxxx
将mysql-connector-java-version.jar引入各个包中的lib文件夹
 

若报如下错误

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes

建表语句
CREATE TABLE flowable_test.ACT_ADM_SERVER_CONFIG (ID_ VARCHAR(255) NOT NULL, NAME_ VARCHAR(50) NULL, DESCRIPTION_ VARCHAR(255) NULL, SERVER_ADDRESS_ VARCHAR(100) NULL, PORT_ INT NULL, CONTEXT_ROOT_ VARCHAR(100) NULL, REST_ROOT_ VARCHAR(100) NULL, USER_NAME_ VARCHAR(100) NULL, PASSWORD_ VARCHAR(100) NULL, ENDPOINT_TYPE_ INT NULL, TENANT_ID_ VARCHAR(50) NULL, CONSTRAINT PK_ACT_ADM_SERVER_CONFIG PRIMARY KEY (ID_))
参考:https://blog.csdn.net/chenjianhuideyueding/article/details/88426021
改utf-8字符集,或者改innodb_large_prefix解决

 

三、有哪些表

工作流表相关
ACT_RE_*: 'RE'表示repository。 这个前缀的表包含了流程定义和流程静态资源 (图片,规则,等等)。
ACT_RU_*: 'RU'表示runtime。 这些运行时的表,包含流程实例,任务,变量,异步任务,等运行中的数据。 Activiti只在流程实例执行过程中保存这些数据, 在流程结束时就会删除这些记录。 这样运行时表可以一直很小速度很快。
ACT_ID_*: 'ID'表示identity。 这些表包含身份信息,比如用户,组等等。
ACT_HI_*: 'HI'表示history。 这些表包含历史数据,比如历史流程实例, 变量,任务等等。
ACT_GE_*: 'GE'表示general。通用数据, 用于不同场景下,如存放资源文件。

注意:表的个数随版本增长,21张->25张->34张(Flowable BPMN v6.3.0)->38张(Flowable BPMN v6.4.2)

具体表含义和字段含义可参考:https://blog.csdn.net/zhongzk69/article/details/90944593

 

四、手册5.7.4节REST 支持替代方案

这一节有不少curl命令,这个命令在windows下支持的不是很好,实际上可用postman替代

转换参考:https://www.cnblogs.com/helloTerry1987/p/11408577.html
Postman,点击左上角import ,选择Paste Raw Text ,粘贴文章中的curl命令,点Import按钮导入
转换后
curl --user 语法会变成 请求的Authentication 认证选项,类型为basic
curl -F "file=@holiday-request.bpmn20.xml" 上传文件选项导入postman需要改postman的header的key ,key名为file ,类型选file,文件通过选择框选择

五、手册7.3.7添加任务清单添加用户替代方案

7.3.7添加任务清单有bug,需要用代码添加用户,页面添加的用户无法搜索和加入组,代码如下

package org.flowable;

import org.flowable.engine.IdentityService;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngines;
import org.flowable.idm.api.User;

public class FinancialUser {

    public static void main(String[] args) {

        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        IdentityService identityService = processEngine.getIdentityService();
        newUser(identityService);

    }


    private static void newUser(IdentityService identityService) {
        //添加kermit用户
        User user = identityService.newUser("kermit");
        user.setPassword("kermit");
        user.setEmail("kermit@qq.com");
        user.setFirstName("kermit");
        user.setLastName("Admin");
        identityService.saveUser(user);
        //添加fozzie用户
        User user2 = identityService.newUser("fozzie");
        user2.setPassword("fozzie");
        user2.setEmail("fozzie@qq.com");
        user2.setFirstName("fozzie");
        user2.setLastName("Admin");
        identityService.saveUser(user2);
    }
}

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值