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

查看:565
本文介绍了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更新job元素的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:

我用两个变量开始该过程。边界计时器的评估结果为 快点。并使用 false 初始化 extendDeadline 。如果计时器触发并且过程前进到互斥网关,则将评估 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天全站免登陆