Activiti工作流 绘制流程

什么是Activiti

Activiti介绍:

Alfresco软件在2010年5月17日宣布Activiti业务流程管理(BPM-Business Process Management)开源项目的正式启动,,其首席架构师由业务流程管理BPM的专家Tom Baeyens担任,Tom Baeyens就是原来jbpm的架构师,而JBPM是一个非常有名的工作流引擎,当然activiti也是一个工作流引擎。

Activiti是一个工作流引擎,activiti可以将业务系统中复杂的业务流程抽取出来,使用专门的建模语言(BPMN2.0)进行定义,业务系统按照预先定义的流程进行执行,实现了业务系统的业务流程由activiti进行管理,减少业务系统由于流程变更进行系统升级改造的工作量,从而提高系统的健壮性,同时也减少了系统开发维护成本。

准备工作

1、安装插件

在画activiti的流程图时,需要在IDEA中安装actiBPM插件,安装完成后,会提示重启操作,立即重启即可将插件生效。

2、检验是否安装成功

在已安装的插件中查看是否有刚才安装的actiBPM插件,若存在则证明安装成功。

使用Activiti

1、创建BPMN文件

点击菜单【file】-->【new】-->【Bpmnfile】,创建一个bpmn文件

输入文件名称,点击OK

会出现如下的绘制界面。

拖拽元素介绍:

  1. Start event:开始事件
  2. End event:结束事件
  3. User task:用户任务活动
  4. Service task:服务任务活动
  5. Exclusive gateway:独家网关,排它网关通道,只能由一条分支执行,如if  else
  6. Parallel gateway:并行网关,并行网关通道,所有分支一块执行

2、绘制流程图

鼠标左键拖拽右侧图标,将其拖下左侧界面上,同样的方式再绘制其他图标

将此bpmn文件修改为xml文件,

右击此xml文件-->【diagram】-->【show bpmn2.0 designer】,然后再点击【export  to  file】图标,即可导出png图片

打开刚才修改过后的Sophia-wen-test.xml文件,如下:

<?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="m1565532759395" 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="开始"/>
    <userTask activiti:exclusive="true" id="_3" name="请求申请"/>
    <userTask activiti:exclusive="true" id="_4" name="通过申请"/>
    <endEvent id="_5" name="结束"/>
    <sequenceFlow id="_6" sourceRef="_2" targetRef="_3"/>
    <sequenceFlow id="_7" sourceRef="_3" targetRef="_4"/>
    <sequenceFlow id="_8" sourceRef="_4" targetRef="_5"/>
  </process>
  <bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;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="myProcess_1">
      <bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2">
        <omgdc:Bounds height="32.0" width="32.0" x="255.0" y="55.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="230.0" y="155.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_4" id="Shape-_4">
        <omgdc:Bounds height="55.0" width="85.0" x="230.0" y="285.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="32.0" width="32.0" x="260.0" y="385.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="_2" targetElement="_3">
        <omgdi:waypoint x="271.0" y="87.0"/>
        <omgdi:waypoint x="271.0" y="155.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="_3" targetElement="_4">
        <omgdi:waypoint x="272.5" y="210.0"/>
        <omgdi:waypoint x="272.5" y="285.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="_4" targetElement="_5">
        <omgdi:waypoint x="276.0" y="340.0"/>
        <omgdi:waypoint x="276.0" y="385.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>

工作流的学习后续会继续分享~

发布了176 篇原创文章 · 获赞 185 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/Sophia_0331/article/details/99235973