Aciviti流程定义实战

一 代码

package com.syc.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;

public class ProcessDeploy {


    public static void main( String[] args ) {
        //创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
        //得到流程存储服务对象
        RepositoryService repositoryService = engine.getRepositoryService();
        //创建DeploymentBuilder实例
        DeploymentBuilder builder = repositoryService.createDeployment();
        builder.addClasspathResource("bpmn/processDeploy.bpmn").deploy();
    }
}

二 流程文件

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" typeLanguage="http://www.w3.org/2001/XMLSchema"
    expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
    <process id="vacationProcess" name="vacation">
        <userTask id="usertask1" name="User Task"></userTask>
        <endEvent id="endevent1" name="End"></endEvent>
        <sequenceFlow id="flow2" name="" sourceRef="usertask1"
            targetRef="endevent1"></sequenceFlow>
        <startEvent id="startevent1" name="Start"></startEvent>
        <sequenceFlow id="flow3" name="" sourceRef="startevent1"
            targetRef="usertask1"></sequenceFlow>
    </process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_vacationProcess">
        <bpmndi:BPMNPlane bpmnElement="vacationProcess"
            id="BPMNPlane_vacationProcess">
            <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
                <omgdc:Bounds height="55" width="105" x="310" y="160"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
                <omgdc:Bounds height="35" width="35" x="490" y="170"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="startevent1"
                id="BPMNShape_startevent1">
                <omgdc:Bounds height="35" width="35" x="170" y="170"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
                <omgdi:waypoint x="415" y="187"></omgdi:waypoint>
                <omgdi:waypoint x="490" y="187"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
                <omgdi:waypoint x="205" y="187"></omgdi:waypoint>
                <omgdi:waypoint x="310" y="187"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</definitions>

三 运行后数据库

1 act_re_deployment

mysql> select * from act_re_deployment;
+-------+-------+-----------+------+------------+-------------------------+-----------------+
| ID_   | NAME_ | CATEGORY_ | KEY_ | TENANT_ID_ | DEPLOY_TIME_            | ENGINE_VERSION_ |
+-------+-------+-----------+------+------------+-------------------------+-----------------+
| 32501 | NULL  | NULL      | NULL |            | 2020-04-18 09:38:38.271 | NULL            |
+-------+-------+-----------+------+------------+-------------------------+-----------------+
1 row in set (0.00 sec)

2 act_re_procdef

mysql> select * from act_re_procdef;
+-------------------------+------+------------------------------+----------+-----------------+----------+----------------+-------------------------+----------------------------------------+--------------+---------------------+-------------------------+-------------------+------------+-----------------+
| ID_                     | REV_ | CATEGORY_                    | NAME_    | KEY_            | VERSION_ | DEPLOYMENT_ID_ | RESOURCE_NAME_          | DGRM_RESOURCE_NAME_                    | DESCRIPTION_ | HAS_START_FORM_KEY_ | HAS_GRAPHICAL_NOTATION_ | SUSPENSION_STATE_ | TENANT_ID_ | ENGINE_VERSION_ |
+-------------------------+------+------------------------------+----------+-----------------+----------+----------------+-------------------------+----------------------------------------+--------------+---------------------+-------------------------+-------------------+------------+-----------------+
| vacationProcess:1:32504 |    1 | http://www.activiti.org/test | vacation | vacationProcess |        1 | 32501          | bpmn/processDeploy.bpmn | bpmn/processDeploy.vacationProcess.png | NULL         |                   0 |                       1 |                 1 |            | NULL            |
+-------------------------+------+------------------------------+----------+-----------------+----------+----------------+-------------------------+----------------------------------------+--------------+---------------------+-------------------------+-------------------+------------+-----------------+
1 row in set (0.00 sec)

3 act_ge_bytearray

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值