前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >项目实践工作流之Activiti学习(十七)

项目实践工作流之Activiti学习(十七)

作者头像
用户1289394
发布2023-10-30 14:53:39
2660
发布2023-10-30 14:53:39
举报
文章被收录于专栏:Java学习网

流程定义

6.1流程定义

6.1.1 什么是流程定义

流程定义是线下按照 bpmn2.0 标准去描述 业务流程,通常使用 activiti-explorer(web 控制台)或 activiti-eclipse-designer 插件对业务流程进行建模,这两种方式都遵循 bpmn2.0 标准。本教程使用activiti-eclipse-designer 插件完成流程建模。使用 designer 设计器绘制流程,会生成两个文件:.bpmn和.png

6.1.2 .bpmn 文件

使用 activiti-desinger 设计业务流程,会生成.bpmn 文件,

首先将 holiday.bpmn 文件改名为 holiday.xml,如下图:

.bpmn 内容如下:

代码语言:javascript
复制
<?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/test" 
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="m1539820628606" name="" 
targetNamespace="http://www.activiti.org/test" 
typeLanguage="http://www.w3.org/2001/XMLSchema">
 <process id="myProcess_1" isClosed="false" isExecutable="true" processType="None">
 <startEvent id="_2" name="StartEvent"/>
 <userTask activiti:exclusive="true" id="_3" name="UserTask"/>
 <sequenceFlow id="_4" sourceRef="_2" targetRef="_3"/>
 <userTask activiti:exclusive="true" id="_5" name="UserTask"/>
 <sequenceFlow id="_6" sourceRef="_3" targetRef="_5"/>
 </process>
 <bpmndi:BPMNDiagram 
documentation="background=#FFFFFF;count=1;horizontalcount=1;orientation=0;width=842
.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageab
leY=5.0" id="Diagram-_1" name="New Diagram">
 <bpmndi:BPMNPlane bpmnElement="myProcess_1">
 <bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2">
 <omgdc:Bounds height="32.0" width="32.0" x="200.0" y="70.0"/>
 <bpmndi:BPMNLabel>
 <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
 </bpmndi:BPMNLabel>
 </bpmndi:BPMNShape>
 <bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3">
 <omgdc:Bounds height="55.0" width="85.0" x="165.0" y="175.0"/>
 <bpmndi:BPMNLabel>
 <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
 </bpmndi:BPMNLabel>
 </bpmndi:BPMNShape>
 <bpmndi:BPMNShape bpmnElement="_5" id="Shape-_5">
 <omgdc:Bounds height="55.0" width="85.0" x="160.0" y="295.0"/>
 <bpmndi:BPMNLabel>
 <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
 </bpmndi:BPMNLabel>
 </bpmndi:BPMNShape>
 <bpmndi:BPMNEdge bpmnElement="_4" id="BPMNEdge__4" sourceElement="_2" 
targetElement="_3">
 <omgdi:waypoint x="216.0" y="102.0"/>
 <omgdi:waypoint x="216.0" y="175.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="_3" 
targetElement="_5">
 <omgdi:waypoint x="205.0" y="230.0"/>
 <omgdi:waypoint x="205.0" y="295.0"/>
 <bpmndi:BPMNLabel>
 <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
 </bpmndi:BPMNLabel>
 </bpmndi:BPMNEdge>
 </bpmndi:BPMNPlane>
 </bpmndi:BPMNDiagram>
</definitions>

BPMN 2.0 根节点是 definitions 节点。 这个元素中,可以定义多个流程定义(不过我们建议每个文件只包含一个流程定义, 可以简化开发过程中的维护难度)。 注意,definitions 元素 最少也要包含 xmlns 和 targetNamespace 的声明。 targetNamespace 可以是任意值,它用来对流程实例进行分类。

流程定义部分:定义了流程每个结点的描述及结点之间的流程流转。

流程布局定义:定义流程每个结点在流程图上的位置坐标等信息。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-10-29,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Java学习网 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档