Flowable开始事件-信号开始事件

信号开始事件

  • 信号开始事件
  • 一、定义
    • 1. 图形标记
    • 2. XML标记
  • 二、测试用例
    • 2.1 信号开始事件xml文件
    • 2.2 信号开始事件测试用例
  • 总结


信号开始事件


一、定义

接受特定的信号发起流程实例。

1. 图形标记

Flowable开始事件-信号开始事件_第1张图片

2. XML标记

消息开始事件的XML

  
<signal id="startSigon" name="开始信号" flowable:scope="global" />

<startEvent id="aa749c58988794b87acb6770233ebe9ab">
      <extensionElements>
        <flowable:formData />
      extensionElements>
      <signalEventDefinition signalRef="startSigon" />
    startEvent>

二、测试用例

2.1 信号开始事件xml文件


<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:flowable="http://flowable.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:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://flowable.org/bpmn">
  <signal id="startSigon" name="开始信号" flowable:scope="global" />
  <process id="SignalStartEventProcess" name="开始信号事件" isExecutable="true">
    <userTask id="a3cf384f403f14a2b9fa881aba4f3224a" name="上报数据">
      <extensionElements>
        <flowable:formData />
        <flowable:assigneeType>staticflowable:assigneeType>
      extensionElements>
    userTask>
    <sequenceFlow id="a6349aaa3b8f048a98e538ff391611425" sourceRef="aa749c58988794b87acb6770233ebe9ab" targetRef="a3cf384f403f14a2b9fa881aba4f3224a" />
    <endEvent id="Event_0pvi979" />
    <sequenceFlow id="Flow_0cxkubc" sourceRef="a3cf384f403f14a2b9fa881aba4f3224a" targetRef="Event_0pvi979" />
    <startEvent id="aa749c58988794b87acb6770233ebe9ab">
      <extensionElements>
        <flowable:formData />
      extensionElements>
      <signalEventDefinition signalRef="startSigon" />
    startEvent>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_SignalStartEventProcess">
    <bpmndi:BPMNPlane id="BPMNPlane_SignalStartEventProcess" bpmnElement="SignalStartEventProcess">
      <bpmndi:BPMNEdge id="BPMNEdge_Flow_0cxkubc" bpmnElement="Flow_0cxkubc">
        <omgdi:waypoint x="180" y="40" />
        <omgdi:waypoint x="232" y="40" />
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_a6349aaa3b8f048a98e538ff391611425" bpmnElement="a6349aaa3b8f048a98e538ff391611425">
        <omgdi:waypoint x="36" y="40" />
        <omgdi:waypoint x="80" y="40" />
      bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_a3cf384f403f14a2b9fa881aba4f3224a" bpmnElement="a3cf384f403f14a2b9fa881aba4f3224a">
        <omgdc:Bounds x="80" y="0" width="100" height="80" />
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_Event_0pvi979" bpmnElement="Event_0pvi979">
        <omgdc:Bounds x="232" y="22" width="36" height="36" />
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_aa749c58988794b87acb6770233ebe9ab" bpmnElement="aa749c58988794b87acb6770233ebe9ab">
        <omgdc:Bounds x="0" y="25" width="36" height="36" />
      bpmndi:BPMNShape>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

2.2 信号开始事件测试用例

      ProcessDefinition processDefinition = this.deployByModelKey("SignalStartEventProcess");
        runtimeService.signalEventReceived("开始信号");

        List<Task> list = taskService.createTaskQuery().processDefinitionId(processDefinition.getId()).list();
        if (CollectionUtils.isNotEmpty(list)) {
            list.forEach(task -> log.info("任务名称为:{}", task.getName()));
        }

总结

信号启动事件,我们可以信号的形式启动流程。

注意:信号是有作用域的,默认是全局,当然我们也可以设置在当前流程实例有效 flowable:scope=“processInstance”

你可能感兴趣的:(Flowable组件库,flowable,bpmnjs)