cancel
Showing results for 
Search instead for 
Did you mean: 

Global variables for process

nixikanius
Champ in-the-making
Champ in-the-making
I need to implement in my process some global variables (config variables) which should be visible everywhere but only in my process definition scope.

For example in this variables I need to store URLs and credentials to external systems (billing, OMS and etc) and I do not want to keep this data in process variables to prevent easy access of them in Activiti Explorer.

Is there any way to solve my need without using process variables instantiated in script tasks at the start of process? May be there is the way to do this similar as in Mule (http://www.mulesoft.org/documentation-3.2/display/32X/Using+Parameters+in+Your+Configuration+Files)?
7 REPLIES 7

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

If you use spring, you can use spring beans to keep config values.
http://activiti.org/userguide/index.html#_using_spring_beans_from_a_process

Regards
Martin

nixikanius
Champ in-the-making
Champ in-the-making
This means that I need to set config variables in engine configuration and all of them will be visible in all processes of engine? If it is right this way I do not like because I need to fully isolate processes.

Is there any way to implement global variables only for one process in process definition without using process variables and script tasks?

vasile_dirla
Star Contributor
Star Contributor
Hi,
I was also thinking about using a spring bean as Martin already told you but it seems it's not what you need.

So you need to have some variables (defined on the process definition level) but invisible for the process execution. (in order to be inaccessible to the users who can write scripts or just access process variables)

and these variables are supposed to be set by who and where ?
Could you provide a use case where you'll need these variables ?




nixikanius
Champ in-the-making
Champ in-the-making
Use case is easy. In my BP I have in script tasks and event listeners calls to external system (OMS). Each call need at least 3 parameters: OMS URL, user and password. For one process this parameters could be one, and another for another process. I do not want to keep them in global engine config via spring and do not want to keep them in process variables because of easy access of values in activiti explorer.

Is there any way to do some similar as in Mule (http://www.mulesoft.org/documentation-3.2/display/32X/Using+Parameters+in+Your+Configuration+Files)?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Mule link you provided uses spring placeholders too. I would use the approach proposed here: http://forums.activiti.org/comment/31063#comment-31063

Regards
Martin

nixikanius
Champ in-the-making
Champ in-the-making
Yes, but as I said here: http://forums.activiti.org/comment/31077#comment-31077 - this method does not allow to have variables isolated in process definition scope. All variables will be visible for all process in engine scope, am I right?

trademak
Star Contributor
Star Contributor
That's correct, it's available for every process in the Engine. Another approach could be to use extension elements in the BPMN XML. This would allow you to access the process definition specific values by getting the BpmnModel Java POJO representation of the BPMN XML.

Best regards,