简体   繁体   English

如何在jBPM 6中使用全局定义的变量?

[英]How to use a globally defined variable in jBPM 6?

What are the differences in usage between the local and global variables in jBPM 6? jBPM 6中局部变量和全局变量在用法上有什么区别?

I have a variable named id that needs to persist in a single process instance. 我有一个名为id的变量,需要保留在单个流程实例中。 Currently I'm using I/O Parameters to pass this id variable from one task to another task for all the tasks in the workflow. 目前,我正在使用I/O Parameters将该id变量从一个任务传递给工作流中所有任务的另一任务。 Is there a way that I set this id variable at the start of the process just once and able to access this id variable in all of my custom work item handlers? 有没有一种方法,我设置这个id在该过程的开始变了一次,并且能够访问这个id在我所有的定制工作项处理的变量? Is using global variable a suitable way to do this? 使用全局变量是执行此操作的合适方法吗? If so, how I can access the global variables in a custom work item handler? 如果是这样,我如何在自定义工作项处理程序中访问全局变量?

Thanks! 谢谢!

I would recommend you to do the mappings for all the tasks. 我建议您为所有任务进行映射。 You don't want to pass all the process variables to all the work items or human tasks, that's why the I/O mapping exists. 您不想将所有过程变量都传递给所有工作项或人工任务,这就是存在I / O映射的原因。 I do recognise that by default you should be able to have access to all the variables, but that restriction is defined in the BPMN spec. 我确实认识到默认情况下应该可以访问所有变量,但是该限制在BPMN规范中定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM