触发Activiti工作流程以使任务处于ReceiveTask循环中

编程入门 行业动态 更新时间:2024-10-12 03:28:06
本文介绍了触发Activiti工作流程以使任务处于ReceiveTask循环中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Activiti工作流程,其中包含一个ReceiveTask,用于对任务进行分组。我有一个侦听器,该侦听器在ReceiveTask的事件开始时触发,在该事件中,我检查新添加的任务的属性,以查看ReceiveTask中是否有其他具有相同属性的任务。如果是,那么我想触发它​​们全部移至下一步。

I have an Activiti workflow that contains a ReceiveTask where I'm grouping tasks. I have a Listener that triggers on the event start of the ReceiveTask where I check the property of the newly added task to see if others with the same properties are in the ReceiveTask. If yes, then I want to trigger them all to move to the next step.

<receiveTask id="IssuePost" name="Issue Post"> <extensionElements> <activiti:executionListener event="start" delegateExpression="${IssuePost}"></activiti:executionListener> </extensionElements> </receiveTask>

当任务移到ReceiveTask时,我的Java侦听器类IssuePost被调用。我可以获取该ReceiveTask中其他任务的列表。我在触发任务转到工作流程的下一步时遇到问题。在任务上调用信号时,我陷入了一个循环。在Alfresco / Activiti放弃并引发异常之前,IssuePost侦听器会不断被无限循环触发。

My Java Listener class IssuePost gets called when the task moves to the ReceiveTask just fine. I can get the list of other tasks sitting in that ReceiveTask. I'm having a problem triggering the tasks to move to the next step in the workflow. I get caught in a loop when calling "signal" on the tasks. The IssuePost listener keeps on getting triggered in an infinite loop until Alfresco/Activiti gives up and throws an exception.

List<NodeRef> siblingNodes = searchService.selectNodes( parent, xpath, null, namespacePrefixResolver, false ); if( siblingNodes.size() == batchCount ) { for( int i=0; i < siblingNodes.size(); i++ ) { List<WorkflowInstance> workflows = workflowService.getWorkflowsForContent( siblingNodes.get( i ), true ); // this line causes the loop. workflowService.signal( workflows.get(0).getId(), null );

我如何在ReceiveTask中发信号通知任务,使其移至工作流程的下一步而不触发我听众?从ReceiveTask到下一步骤只有一个流程。

How can I signal the tasks in the ReceiveTask to move to the next step in the workflow without triggering my listener? There's only one flow out of the ReceiveTask to the next step in the workflow.

推荐答案

查看 InvitationServiceImpl 我看到以下有用的代码段:

Looking at the InvitationServiceImpl I see the following useful snippet:

List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(startTask.getPath().getId()); if(tasks.size()==1) { WorkflowTask task = tasks.get(0); if(taskTypeMatches(task, taskTypes)) { if(properties != null) { workflowService.updateTask(task.getId(), properties, null, null); } workflowService.endTask(task.getId(), transition); return; } }

因此,您需要让任务本身进行更新或结束甚至开始。

So you need to have the task itself to update or end or even start.

或者在您的情况下,查找在开始之后的下一个转换,并用信号代替空值。

Or maybe in your case, lookup the next transition which is after start and signal that one instead of null.

更多推荐

触发Activiti工作流程以使任务处于ReceiveTask循环中

本文发布于:2023-11-28 12:10:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642342.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作流程   Activiti   ReceiveTask

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!