如何在jbpm-WorkBench的BPMN流程中设置要在WorkItem中访问的参数 [英] How to set Parameter in WorkItem to be reached within BPMN Process in jbpm-WorkBench

查看:229
本文介绍了如何在jbpm-WorkBench的BPMN流程中设置要在WorkItem中访问的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有一些参数的自定义WorkItem,这些参数已在WorkDefinitions.wid文件中注册.然后,在业务流程中,我还为整个流程创建变量定义,并将自定义WorkItem的WD.wid中的定义定义为在BP中创建的定义.

I have created a custom WorkItem with some parameters, which I have registered in WorkDefinitions.wid file. Then in Business Process I also create Variable Definitions for the entire Process and reference those from WD.wid of my custom WorkItem to those created in BP.

WorkItem执行代码,该代码在启动过程后从表单中获取这些参数.为此,我使用getParameter()-方法; 它看起来如下:

WorkItem execute the code, which takes those parameters from the form after starting the process. For this purpose I use getParameter()- method; It looks as follows:

public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

String payload = workItem.getParameter("id") + ... ;
...
manager.completeWorkItem(workItem.getId(), null);
}

一切正常,一切正常,原因是WorkItem将成功执行,并且得到结果(在BP中执行workItem之后在服务器端); 但是现在我需要使用输入的参数执行POST方法后获得Response.在代码中,我创建了一个新变量,该变量从响应主体获取参数,当我执行纯代码(没有BPMN-进程)时,我可以在IDE的控制台中看到结果,但是我还需要在WorkItem中注册此变量才能使用对于我的BProcess中的下一个任务,它会更进一步.

Everything looks and works ok, cause WorkItem will be successfully executed and I get the result (on the server side after executing workItem in BP); But now I need to get Response after executing POST method with entered parameters. In the code I've created a new variable, which gets parameter from response body and I can see result in the IDE's console, when I execute pure code (without BPMN - process), but I need also register this variable within WorkItem to use it further for the next Task in my BProcess.

SO我的问题是:是否有类似于getParameter()的方法-但有setParameter()的东西?我如何在WorkItem中注册它,以及如何在jbpm的BProcess中获取/访问那些参数/变量(我相信是全局变量).

SO My Question is: is there something similar to getParameter() - method, but something as setParameter()? How could I register it within WorkItem and how could I get/reach those parameter/variable within BProcess in jbpm (something as global variable I believe).

非常感谢!

推荐答案

查看

Look at the Javadoc of WorkItemManager and see the parameters of completeWorkItem method. You can pass your results in a map. You will then get those values as output parameters of the task that is being executed and can map them to some process variables so the next task can use them.

这篇关于如何在jbpm-WorkBench的BPMN流程中设置要在WorkItem中访问的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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