Activiti/Camunda 使用变量更改边界计时器 [英] Activiti / Camunda change boundary timer with variable

查看:46
本文介绍了Activiti/Camunda 使用变量更改边界计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 Activiti/Camunda 中用户任务的计时器边界事件的特殊问题:

I got a special question regarding timer boundary events on a user task in Activiti/Camunda:

启动流程时,我使用流程变量设置计时器持续时间,并使用边界定义中的表达式来解析变量.边界事件是在用户任务上定义的.

When starting the process I set the timer duration with a process variable and use expressions in the boundary definition to resolve the variable. The boundary event is defined on a user task.

<bpmn2:timerEventDefinition id="_TimerEventDefinition_11">
        <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${hurry}</bpmn2:timeDuration>
      </bpmn2:timerEventDefinition>

在某些情况下,当计时器已经在运行时,可能会出现截止日期 (dueDate),因为受让人请求了更多时间.为此,我想更改定义截止日期的流程变量的值.

In some cases, when the timer is already running it can occur, that the deadline (dueDate) should be extended because the asignee has requested more time. For this purpose i want to change the value of the process variable defining the deadline.

碰巧的是,变量已经在流程开始时解析并设置为边界事件.

As it happens, the variable is already resolved at the process-start and set to the boundary event.

变量的任何进一步更改都不会影响边界计时器的dueDate,因为它存储在数据库中,并且不会在变量值更改时更新.

Any further changes of the variable do not affect the dueDate of the boundary timer because it is stored in the database and is not updated when the value of the variable changes.

我知道如何通过 Java API 更新作业元素的 DueDate,但我想提供一种通用方法,例如通过更改变量的值来设置它.

I know how to update the dueDate of the job element via the Java API, but i want to provide a generic approach like setting it with changing the value of the variable.

延长最后期限的最常见用例是边界计时器已经在运行时.

The most common use case for extending the deadline will be when the boundary timer is already running.

有什么想法可以解决这个问题吗?

Any ideas how to cope with this problem?

任何提示都非常受欢迎.干杯克里斯

Any tips are very apprechiated. Cheers Chris

推荐答案

经过一段时间的思考,我想出了这样的解决方法:

After some time of thinking I came up with a workaround like that:

我用两个变量开始这个过程.hurry"用于边界计时器.并且extendDeadline"被初始化为false.如果定时器触发并且进程前进到独占网关,则评估extendDeadline"的值.

I start the process with two variables. "hurry" is evaluated for the boundary timer. And "extendDeadline" is initialized with false. If the timer triggers and the process advances to the exclusive gateway, the value of "extendDeadline" is evaluated.

如果用户在计时器运行期间将extendDeadline"的值更改为true,则进程将再次返回到设置边界计时器的用户任务到快点"的价值.

If a user has changed the value of "extendDeadline" to true during the the timer was running the process returns to the user task again where the boundary timer is set to the value of "hurry".

如果extendDeadline"仍设置为false,则流程可以继续.

If the "extendDeadline" is still set to false, the process can proceed.

这篇关于Activiti/Camunda 使用变量更改边界计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆