Bonita - 如何跳过任务执行
Bonita - How to skip tasks execution
我正在 Bonita Enterprise 实例中开发 运行 的 bonita 流程。我需要在每个任务上使用自定义参与者过滤器,以选择可能的批准者。
- 每个演员都映射到一个角色
- 每个用户至少有一个具有角色和组的成员资格
- 一些用户至少有两个具有相同角色和两个不同组的成员资格
我的演员过滤器基于配置,可以匹配属于一个或两个组的用户以及与演员关联的角色。
到这里为止一切都很好,但是...
我可能没有可用的任务批准人,所以我需要跳过它。一切似乎又好了,但我的问题来了:
当我尝试跳过任务时,执行失败,因为任务没有输入:
2020-03-10 17:52:24.233 +0000 SEVERE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=89 | HOSTNAME=xxx | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]"
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]
at org.bonitasoft.engine.expression.DataExpressionExecutorStrategy.evaluate(DataExpressionExecutorStrategy.java:112)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:154)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
at org.bonitasoft.engine.execution.transition.TransitionConditionEvaluator.evaluateCondition(TransitionConditionEvaluator.java:44)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransition(ImplicitGatewayTransitionEvaluator.java:73)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluatedTransitions(ImplicitGatewayTransitionEvaluator.java:66)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransitions(ImplicitGatewayTransitionEvaluator.java:42)
at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitionsForActivity(TransitionEvaluator.java:80)
at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitions(TransitionEvaluator.java:66)
at org.bonitasoft.engine.execution.TransitionEvaluator.buildTransitionsWrapper(TransitionEvaluator.java:126)
at org.bonitasoft.engine.execution.ProcessExecutorImpl.executeValidOutgoingTransitionsAndUpdateTokens(ProcessExecutorImpl.java:698)
at org.bonitasoft.engine.execution.ProcessExecutorImpl.childFinished(ProcessExecutorImpl.java:588)
at org.bonitasoft.engine.execution.ContainerRegistry.nodeReachedState(ContainerRegistry.java:58)
at org.bonitasoft.engine.execution.work.NotifyChildFinishedWork.work(NotifyChildFinishedWork.java:69)
at org.bonitasoft.engine.execution.work.TxBonitaWork.lambda$work[=10=](TxBonitaWork.java:42)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:42)
at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:63)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:59)
at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit(BonitaThreadPoolExecutor.java:132)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
所有任务都有一个合同输入,文本变量 inputAction
的值为 "approved" 或 "rejected"。
我试过了
- return 一个空的用户 ID 列表,但实例化失败,因为演员过滤器 return 没有用户;
- return 一个空的用户 ID 列表并跳过带有附加到任务的 "Catch error" 的任务,但任务不会被跳过(上述异常);
- 抛出 UserFilterException,但未跳过任务(上述异常);
- 使用默认操作,但不会跳过任务(上述异常)。
有没有办法做到这一点?
该问题是由于使用了局部变量 ti 处理审批者操作。这些变量在失败时尚未创建,因此不可能跳过任务(错误?)。转移到池变量解决了我的问题。
我正在 Bonita Enterprise 实例中开发 运行 的 bonita 流程。我需要在每个任务上使用自定义参与者过滤器,以选择可能的批准者。
- 每个演员都映射到一个角色
- 每个用户至少有一个具有角色和组的成员资格
- 一些用户至少有两个具有相同角色和两个不同组的成员资格
我的演员过滤器基于配置,可以匹配属于一个或两个组的用户以及与演员关联的角色。
到这里为止一切都很好,但是...
我可能没有可用的任务批准人,所以我需要跳过它。一切似乎又好了,但我的问题来了:
当我尝试跳过任务时,执行失败,因为任务没有输入:
2020-03-10 17:52:24.233 +0000 SEVERE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=89 | HOSTNAME=xxx | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]"
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]
at org.bonitasoft.engine.expression.DataExpressionExecutorStrategy.evaluate(DataExpressionExecutorStrategy.java:112)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:154)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
at org.bonitasoft.engine.execution.transition.TransitionConditionEvaluator.evaluateCondition(TransitionConditionEvaluator.java:44)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransition(ImplicitGatewayTransitionEvaluator.java:73)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluatedTransitions(ImplicitGatewayTransitionEvaluator.java:66)
at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransitions(ImplicitGatewayTransitionEvaluator.java:42)
at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitionsForActivity(TransitionEvaluator.java:80)
at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitions(TransitionEvaluator.java:66)
at org.bonitasoft.engine.execution.TransitionEvaluator.buildTransitionsWrapper(TransitionEvaluator.java:126)
at org.bonitasoft.engine.execution.ProcessExecutorImpl.executeValidOutgoingTransitionsAndUpdateTokens(ProcessExecutorImpl.java:698)
at org.bonitasoft.engine.execution.ProcessExecutorImpl.childFinished(ProcessExecutorImpl.java:588)
at org.bonitasoft.engine.execution.ContainerRegistry.nodeReachedState(ContainerRegistry.java:58)
at org.bonitasoft.engine.execution.work.NotifyChildFinishedWork.work(NotifyChildFinishedWork.java:69)
at org.bonitasoft.engine.execution.work.TxBonitaWork.lambda$work[=10=](TxBonitaWork.java:42)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:42)
at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:63)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:59)
at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit(BonitaThreadPoolExecutor.java:132)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
所有任务都有一个合同输入,文本变量 inputAction
的值为 "approved" 或 "rejected"。
我试过了
- return 一个空的用户 ID 列表,但实例化失败,因为演员过滤器 return 没有用户;
- return 一个空的用户 ID 列表并跳过带有附加到任务的 "Catch error" 的任务,但任务不会被跳过(上述异常);
- 抛出 UserFilterException,但未跳过任务(上述异常);
- 使用默认操作,但不会跳过任务(上述异常)。
有没有办法做到这一点?
该问题是由于使用了局部变量 ti 处理审批者操作。这些变量在失败时尚未创建,因此不可能跳过任务(错误?)。转移到池变量解决了我的问题。