Active 工作流

Active 工作流

https://blog.csdn.net/m0_37327416/article/details/71743368
https://www.activiti.org/before-you-start
https://blog.csdn.net/fanxiangru999/article/details/79381966
https://www.cnblogs.com/jpfss/p/11077178.html

评分 7.0 阿里云社区:https://yq.aliyun.com/articles/697485
评分 6.0 CSDN:https://blog.csdn.net/wangwangli6/article/details/80349542

demo

| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.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:tns="http://www.activiti.org/processdef" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1591768431763" name="" targetNamespace="http://www.activiti.org/processdef" typeLanguage="http://www.w3.org/2001/XMLSchema"> <process id="scm_appoint" isClosed="false" isExecutable="true" processType="None"> <startEvent id="taskStart" name="开始节点"/> <userTask activiti:assignee="${parameterName}" activiti:exclusive="true" id="usertask2" name="审批人员:指定人员"/> <userTask activiti:assignee="${configurationName}" activiti:exclusive="true" id="usertask3" name="对应业务配置工程师"/> <userTask activiti:assignee="${developerName}" activiti:exclusive="true" id="usertask4" name="开发人员"/> <userTask activiti:assignee="${createApproveName}" activiti:exclusive="true" id="usertask5" name="功能验证(申请人 )"/> <userTask activiti:assignee="${createApproveName}" activiti:exclusive="true" id="usertask7" name="申请人反馈"/> <endEvent id="endevent1" name="终点"/> <sequenceFlow id="sid-ACD5BE74-6CE8-4CD4-A838-0BA51F2AF95C" sourceRef="usertask7" targetRef="endevent1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_next'}]]></conditionExpression> </sequenceFlow> <userTask activiti:assignee="${createApproveName}" activiti:exclusive="true" id="usertask1" name="草稿"/> <sequenceFlow id="sid-22CCC8E1-DBDA-4C82-AB1A-9ADD91F6F0FA" name="同意" sourceRef="usertask2" targetRef="usertask3"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_next'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="sid-EAA32CD0-4B1E-4D22-A75D-79FBA07E10B7" name="同意" sourceRef="usertask5" targetRef="usertask7"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_next'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="sid-41C9C88D-442F-46C0-B37F-061479E843D8" name="同意" sourceRef="usertask4" targetRef="usertask5"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_next'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="sid-D08E5539-B1FB-468C-BB24-37161AB78820" sourceRef="usertask1" targetRef="usertask2"> <conditionExpression xsi:type="tFormalExpression"/> </sequenceFlow> <sequenceFlow id="_2" name="退回" sourceRef="usertask5" targetRef="usertask4"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_last'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_3" name="退回" sourceRef="usertask4" targetRef="usertask3"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_last'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_4" name="退回" sourceRef="usertask2" targetRef="usertask1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_start'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_13" name="终止" sourceRef="usertask2" targetRef="endevent1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_over'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_6" name="同意" sourceRef="usertask3" targetRef="usertask5"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_next'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_7" name="转开发人员" sourceRef="usertask3" targetRef="usertask4"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_transfer'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_8" name="退回" sourceRef="usertask3" targetRef="usertask1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_start'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_9" name="退回" sourceRef="usertask5" targetRef="usertask3"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_last'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_12" name="终止" sourceRef="usertask3" targetRef="endevent1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_over'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_14" name="终止" sourceRef="usertask4" targetRef="endevent1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='approve_over'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="_17" name="同意" sourceRef="taskStart" targetRef="usertask1"/> <sequenceFlow id="_5" name="退回" sourceRef="usertask7" targetRef="usertask5"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${operation=='return_last'}]]></conditionExpression> </sequenceFlow> </process> <bpmndi:BPMNDiagram documentation="background=#FFFFFF;count=2;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram"> <bpmndi:BPMNPlane bpmnElement="scm_appoint"> <bpmndi:BPMNShape bpmnElement="taskStart" id="Shape-taskStart"> <omgdc:Bounds height="32.0" width="32.0" x="410.0" y="-25.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask2" id="Shape-usertask2"> <omgdc:Bounds height="80.0" width="100.0" x="390.0" y="240.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask3" id="Shape-usertask3"> <omgdc:Bounds height="80.0" width="100.0" x="390.0" y="375.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask4" id="Shape-usertask4"> <omgdc:Bounds height="80.0" width="100.0" x="675.0" y="370.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask5" id="Shape-usertask5"> <omgdc:Bounds height="80.0" width="100.0" x="375.0" y="585.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask7" id="Shape-usertask7"> <omgdc:Bounds height="80.0" width="100.0" x="400.0" y="815.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="endevent1" id="Shape-endevent1"> <omgdc:Bounds height="32.0" width="32.0" x="426.0" y="960.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask1" id="Shape-usertask1"> <omgdc:Bounds height="80.0" width="100.0" x="390.0" y="60.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="_13" id="BPMNEdge__13" sourceElement="usertask2" targetElement="taskOver"> <omgdi:waypoint x="375.0" y="280.0"/> <omgdi:waypoint x="90.0" y="570.0"/> <omgdi:waypoint x="426.0" y="976.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_12" id="BPMNEdge__12" sourceElement="usertask3" targetElement="taskOver"> <omgdi:waypoint x="390.0" y="415.0"/> <omgdi:waypoint x="255.0" y="725.0"/> <omgdi:waypoint x="426.0" y="976.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_14" id="BPMNEdge__14" sourceElement="usertask4" targetElement="taskOver"> <omgdi:waypoint x="675.0" y="410.0"/> <omgdi:waypoint x="458.0" y="976.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_17" id="BPMNEdge__17" sourceElement="taskStart" targetElement="usertask1"> <omgdi:waypoint x="426.0" y="7.0"/> <omgdi:waypoint x="426.0" y="60.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-D08E5539-B1FB-468C-BB24-37161AB78820" id="BPMNEdge_sid-D08E5539-B1FB-468C-BB24-37161AB78820" sourceElement="usertask1" targetElement="usertask2"> <omgdi:waypoint x="435.0" y="140.0"/> <omgdi:waypoint x="435.0" y="205.0"/> <omgdi:waypoint x="435.0" y="240.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-41C9C88D-442F-46C0-B37F-061479E843D8" id="BPMNEdge_sid-41C9C88D-442F-46C0-B37F-061479E843D8" sourceElement="usertask4" targetElement="usertask5"> <omgdi:waypoint x="700.0" y="450.0"/> <omgdi:waypoint x="700.0" y="595.0"/> <omgdi:waypoint x="475.0" y="595.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-50.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-22CCC8E1-DBDA-4C82-AB1A-9ADD91F6F0FA" id="BPMNEdge_sid-22CCC8E1-DBDA-4C82-AB1A-9ADD91F6F0FA" sourceElement="usertask2" targetElement="usertask3"> <omgdi:waypoint x="440.0" y="335.0"/> <omgdi:waypoint x="440.0" y="375.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_2" id="BPMNEdge__2" sourceElement="usertask5" targetElement="usertask4"> <omgdi:waypoint x="475.0" y="665.0"/> <omgdi:waypoint x="750.0" y="665.0"/> <omgdi:waypoint x="750.0" y="450.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-ACD5BE74-6CE8-4CD4-A838-0BA51F2AF95C" id="BPMNEdge_sid-ACD5BE74-6CE8-4CD4-A838-0BA51F2AF95C" sourceElement="usertask7" targetElement="taskOver"> <omgdi:waypoint x="442.0" y="895.0"/> <omgdi:waypoint x="442.0" y="960.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_3" id="BPMNEdge__3" sourceElement="usertask4" targetElement="usertask3"> <omgdi:waypoint x="675.0" y="395.0"/> <omgdi:waypoint x="635.0" y="395.0"/> <omgdi:waypoint x="490.0" y="395.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_4" id="BPMNEdge__4" sourceElement="usertask2" targetElement="usertask1"> <omgdi:waypoint x="505.0" y="280.0"/> <omgdi:waypoint x="665.0" y="155.0"/> <omgdi:waypoint x="490.0" y="100.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_5" id="BPMNEdge__5" sourceElement="usertask7" targetElement="usertask5"> <omgdi:waypoint x="400.0" y="855.0"/> <omgdi:waypoint x="395.0" y="735.0"/> <omgdi:waypoint x="395.0" y="665.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="usertask3" targetElement="usertask5"> <omgdi:waypoint x="432.5" y="455.0"/> <omgdi:waypoint x="432.5" y="585.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_7" id="BPMNEdge__7" sourceElement="usertask3" targetElement="usertask4"> <omgdi:waypoint x="490.0" y="430.0"/> <omgdi:waypoint x="575.0" y="430.0"/> <omgdi:waypoint x="675.0" y="430.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-EAA32CD0-4B1E-4D22-A75D-79FBA07E10B7" id="BPMNEdge_sid-EAA32CD0-4B1E-4D22-A75D-79FBA07E10B7" sourceElement="usertask5" targetElement="usertask7"> <omgdi:waypoint x="437.5" y="665.0"/> <omgdi:waypoint x="437.5" y="815.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="usertask3" targetElement="usertask1"> <omgdi:waypoint x="490.0" y="415.0"/> <omgdi:waypoint x="600.0" y="265.0"/> <omgdi:waypoint x="490.0" y="100.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_9" id="BPMNEdge__9" sourceElement="usertask5" targetElement="usertask3"> <omgdi:waypoint x="390.0" y="585.0"/> <omgdi:waypoint x="390.0" y="515.0"/> <omgdi:waypoint x="390.0" y="455.0"/> <bpmndi:BPMNLabel> <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>|

历史背景_概念名词

OpenWFE 、jBPM 、Shark、Activiti

JBoss 社区的jBPM 、OpenSymphony 的OSWorkflow

“业务流程建模标记法” CBusiness Process Modeling Notation, BPMN )

Activiti 的创始人Tom Baeyens 是jBPM 的创始人,由于在jBPM 的未来架构上产生意见
分歧, Tom Baeyens 在2010 年离开了JBoss 并加入Alfresco 公司, Tom Baeyens 的离开使得
jBPMS 完全放弃了jBPM4 的架构,基于Drools Flow 重新开发。而在2010 年的5 月, TomBaeyens
发布了第一个Activiti 版本( 5.0alphal) ,由此看来, Activiti 更像是jBPM4 的延续,也许为了
让其看起来更像jBPM4 的延续, Activiti 团队直接将Activiti 的第一个版本定义为5.0

大纲

第一部分:
对Activiti 的基础知识进行讲解,包括框架起源、基本的设计模式、数据库设置
以及框架配置等。该部分知识可以帮助读者对Activiti 有一个较为深入的认识,对Activiti 的设
计有一个初步的印象,该部分内容也可以作为整合Activiti 到项目中的参考。
第二部分:
从源代码的实现上讲解Activiti 各个模块的API ,除了讲述这些API 的作用外,
还会引领读者深入到这些API 的内部。此部分内容可以作为一个详细的Activiti API 的帮助文挡。
第三部分:
详细讲述了BPMN2.0 规范的内容,包括目前Activiti 对该规范的实现情况。在
讲解BPMN 2.0 规范时,将规范与Acti viti 的实现进行结合,让读者在通俗易懂的例子示范下,
对Activiti 的实现及BPMN 2 .0 规范有较为深入的了解。
第四部分:
Activiti 6 支持的DMN 规范,本书将在第15 章中讲述Acti vi ti 基于D孔创规范的
规则引擎。Acti vi ti 的规则引擎目前尚未正式面世, 笔者研读了当前版本的源代码,并带领读者
优先体会了Activiti 的规则引擎。
第五部分:
讲述如何在实际企业应用中使用Ac ti vi ti ,并与其他流行的开源框架进行整合,
包括企业应用开发所必须使用的Web Service 、企业服务总线、规则引擎、IoC 框架和ORM 框
•IV•
架等。除了主要的Activiti 知识外,企业中常用框架的知识,也在该部分内容中得到了体现。通
过学习这部分内容,可以极大丰富你的实战知识,让你成为一个更全面的技术人员。
第六部分:
在第18 章中讲述了Activiti 的核心架构及Activiti 的表单知识。本书最后一章,
通过讲解一个办公系统的开发过程,让读者更了解Activiti 在实际生产中的应用,从而从理论层
面走上实践的道路。
估算,不清楚代码里生成对象数量,执行时间等信息,后面如果线上运行性能不理想,看gc日志,调整堆大小。优化代码。

BPMN 2.0 元素

BPMN
中定义了5 个基础的元素类别。
》流对象( Flow O同ects ): 在一个业务流程中,流对象是用于定义行为的图形元素,
主要有事件CEvents )、活动( Activities )和网关( Gateways ) 三种流对象。
》数据( Data ): 主要有数据对象( Data Objects )、数据输入( Data Inputs )、数据输
出( Data Inputs )和数据存储( Data Stores) 4 种元素。
》连接对象( Connecting O同ects ):用于连接流对象, 主要有4 种连接流对象的方式,
包括顺序流( Sequence Flows )、消息流( Message Flows )、关联( Associations )和
数据关联( Data Associations )。
~ ~.永道( Swimlanes ):泳道提供了两种途径用于组织基础的模型元素,分别是池( Pools)
和道( Lanes )。
》制品(Artifacts ):制品主要用于为流程提供附加信息, 当前制品包括组( Group )和
注释( Text Annotation )。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

DEMO1:

主界面的三个菜单主要完成以下功能。
Kickstart App : 主要用于流程模型管理、表单管理及应用( App ) 管理, 一个应用可以
包含多个流程模型,应用可发布给其他用户使用。
> Task App : 用于管理整个activiti -app 的任务,在该功能里面也可以启动流程。
Identity management : 身份信息管理,可以管理用户、用户组等数据。
单击“ Identity management ”菜单,再单击Users 菜单,界面如图2-10 所示。

0YML配置

spring:
  activiti:
    check-process-definitions: true #自动检查、部署流程定义文件
    database-schema-update: true #自动更新数据库结构
    history-level: full #保存历史数据级别设置为full最高级别,便于历史数据的追溯
     #process-definition-location-prefix: classpath:/processes/ #流程定义文件存放目录
    #process-definition-location-suffixes: #流程文件格式
    #  - **.bpmn20.xml
    #  - **.bpmn
# com.mysql.cj.jdbc.Driver
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3310/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
    username: root
    password: 111111
server:
  port: 8080

1创建用户

2创建流程

3发布流程

数据库表详解

表名解读

运行时数据表,会以ACT RU 作为开头;
历史数据表以ACT HI作为开头;
通用数据表有两个,它们都以“ ACT GE ” 开头,GE 是单词general 的缩写;
部署仓库表:流程引擎使用仓储表来保存流程定义和部署信息这类数据,存储表名称以“ ACT RE ”开
头,“阻”是reposit。可单词的缩写。
'流程定义表( ACT RE PROCDEF )'

REV :数据版本, Activiti 为一些有可能会被频繁修改的数据表,加入该字段,用来
表示该数据被操作的次数。
》NAME : 资源名称,类型为varchar ,长度为255 字节。
~ DEPLOYEMENT_ID : 一次由曙可以励口多个资源,该字段与剖曙表ACT 阻DEPI.DYMENT
的主键相关联。
~ BYTES_:资源内容,数据类型为longblob ,最大可存4GB 数据。
》GE阳RATED :是否由Ac ti vi ti 自动产生的资源, 0 表示false, 1 为阳。

3.1.2 属性表
Activiti 将全部的属性抽象为key-value 对,每个属性都有名称和值, 使用
ACT GE PROPERTY 来保存这些属性,该表有以下三个字段。
》NAME :属性名称, varchar 类型。
~ VALUE :属性值, varchar 类型。
〉阻V :数据的版本号。

自定义配置:

在这里插入图片描述

错误收集:

Springboot 集成 Activiti时启动报错!

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.activiti.spring.boot.SecurityAutoConfiguration': Initialization of bean failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at com.tian.activiti.ActivitiApplication.main(ActivitiApplication.java:10) [classes/:na]
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_201]
	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_201]
	at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_201]
	at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_201]
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_201]
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_201]
	at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_201]
	at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_201]
	at java.lang.Class.createAnnotationData(Class.java:3526) ~[na:1.8.0_201]
	at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_201]
	at java.lang.Class.getAnnotation(Class.java:3415) ~[na:1.8.0_201]
	at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258) ~[na:1.8.0_201]
	at java.lang.Class.isAnnotationPresent(Class.java:3425) ~[na:1.8.0_201]
	at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:599) ~[spring-core-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.support.annotation.AnnotationClassFilter.matches(AnnotationClassFilter.java:65) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:288) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:269) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.isEligible(AbstractAdvisingBeanPostProcessor.java:133) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.isEligible(AbstractAdvisingBeanPostProcessor.java:115) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor.isEligible(AbstractBeanFactoryAwareAdvisingPostProcessor.java:70) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:85) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:429) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
	... 14 common frames omitted

解决方法

'Isn't this fun?'

'@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class ActivitiApplication {
public static void main(String[] args) {
SpringApplication.run(ActivitiApplication.class, args);
}
}

BPMN 画图

user taskcall activity tasksub processpoollaneparallel gatewayExclusive Gatewayinclusive gatewayevent gatewayboundary eventintermediate catching eventintermediate throwing evnetannotation

在这里插入图片描述

Active 工作流与Spring Boot结合可以通过以下步骤实现: 1. 在Spring Boot项目中添加Active工作流的依赖,可以在pom.xml文件中添加以下依赖: ``` <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic</artifactId> <version>6.0.0</version> </dependency> ``` 2. 配置数据源和JPA,可以在application.properties文件中配置: ``` spring.datasource.url=jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update ``` 3. 创建流程定义文件,通常是BPMN 2.0格式的XML文件,定义流程的节点、顺序、条件等信息。 4. 使用Java代码启动工作流引擎,可以在Spring Boot的启动类中添加以下代码: ``` @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); DeploymentBuilder deploymentBuilder = repositoryService.createDeployment(); deploymentBuilder.addClasspathResource("processes/holiday-request.bpmn20.xml"); deploymentBuilder.deploy(); } } ``` 5. 调用工作流引擎,可以在Controller中添加以下代码: ``` @RestController @RequestMapping("/holiday") public class HolidayController { @Autowired private RuntimeService runtimeService; @Autowired private TaskService taskService; @PostMapping public ResponseEntity startProcessInstance(@RequestBody HolidayRequest holidayRequest) { Map<String, Object> variables = new HashMap<>(); variables.put("employeeName", holidayRequest.getEmployeeName()); variables.put("numberOfDays", holidayRequest.getNumberOfDays()); variables.put("startDate", holidayRequest.getStartDate()); variables.put("endDate", holidayRequest.getEndDate()); runtimeService.startProcessInstanceByKey("holidayRequest", variables); return ResponseEntity.ok().build(); } @GetMapping("/{taskId}") public ResponseEntity completeTask(@PathVariable String taskId) { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (task == null) { return ResponseEntity.notFound().build(); } taskService.complete(taskId); return ResponseEntity.ok().build(); } } ``` 以上就是Active工作流与Spring Boot结合的基本步骤,具体实现可以根据业务需求进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值