子进程中的边界计时器事件

时间:2015-11-26 12:19:42

标签: subprocess activiti

我创建了一个包含带边界计时器的子流程的工作流程。这是我的代码:

 <process id="processsub" isExecutable="true">
    <startEvent id="start" name="start" activiti:initiator="initiator"></startEvent>
    <userTask id="usertask1" name="usertask1" activiti:assignee="${initiator}">
      <documentation>this is user task</documentation>
      <extensionElements>
        <activiti:formProperty id="consult" name="Do u want to consult??" type="enum">
          <activiti:value id="true" name="true"></activiti:value>
          <activiti:value id="false" name="false"></activiti:value>
        </activiti:formProperty>
      </extensionElements>
    </userTask>
    <subProcess id="subpro" name="subpro">
      <startEvent id="substart" name="substart"></startEvent>
      <userTask id="usertask2" name="usertask2" activiti:candidateGroups="doctor">
        <documentation>This is a user task for consultation..</documentation>
      </userTask>
      <userTask id="usertask3" name="usertask3" activiti:candidateGroups="doctor">
        <documentation>This is a user task for prescription</documentation>
      </userTask>
      <endEvent id="subend" name="subend"></endEvent>
      <parallelGateway id="par1" name="par1"></parallelGateway>
      <parallelGateway id="par2" name="par2"></parallelGateway>
      <sequenceFlow id="flow3" name="flow3" sourceRef="substart" targetRef="par1"></sequenceFlow>
      <sequenceFlow id="flow4" name="flow4" sourceRef="par1" targetRef="usertask2"></sequenceFlow>
      <sequenceFlow id="flow5" name="flow5" sourceRef="par1" targetRef="usertask3"></sequenceFlow>
      <sequenceFlow id="flow6" name="flow6" sourceRef="usertask2" targetRef="par2"></sequenceFlow>
      <sequenceFlow id="flow7" name="flow7" sourceRef="usertask3" targetRef="par2"></sequenceFlow>
      <sequenceFlow id="flow8" name="flow8" sourceRef="par2" targetRef="subend"></sequenceFlow>
    </subProcess>
    <endEvent id="end" name="end"></endEvent>
    <sequenceFlow id="flow1" name="flow1" sourceRef="start" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="flow2" sourceRef="usertask1" targetRef="subpro"></sequenceFlow>
    <sequenceFlow id="flow9" name="flow9" sourceRef="subpro" targetRef="end"></sequenceFlow>
    <boundaryEvent id="sid-FFAB6E5A-5E94-4001-9845-4D481E157F03" attachedToRef="subpro" cancelActivity="true">
      <timerEventDefinition>
        <timeDuration>PT2M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <userTask id="usertask4" name="usertask4" activiti:candidateGroups="reviewer"></userTask>
    <endEvent id="finalend" name="finalend"></endEvent>
    <sequenceFlow id="flow10" name="flow10" sourceRef="sid-FFAB6E5A-5E94-4001-9845-4D481E157F03" targetRef="usertask4"></sequenceFlow>
    <sequenceFlow id="flow11" name="flow11" sourceRef="usertask4" targetRef="finalend"></sequenceFlow>
  </process>

计时器在2分钟后起火,子程序是否完成或部分完成,即1个usertask完成,第二个未完成。我希望如果子进程启动它是完成还是部分完成,计时器将不会触发。 我怎么能这样做?请帮帮我。

1 个答案:

答案 0 :(得分:1)

你想做的是取消&#34;取消&#34;用户任务完成时的计时器边界事件。遗憾的是,除非您通过API对其进行编码,否则无法实现 最好的方法是:

  • 将您的计时器边界事件转换为计时器中间捕获事件

  • 当用户任务完成后,发送&#34;取消&#34;发信号到计时器中间捕获事件

  • 要实现取消信号,您必须创建一个事件网关,然后等待&#34;取消&#34;信号或计时器事件

您的流程将如下所示:http://i.stack.imgur.com/yl9GC.png