Discussion:
[jboss-user] [jBPM] - can subprocess get its father process's parameter?
trash wang
2013-08-08 01:42:04 UTC
Permalink
trash wang [https://community.jboss.org/people/wangtrash] created the discussion

"can subprocess get its father process's parameter?"

To view the discussion, visit: https://community.jboss.org/message/831852#831852

--------------------------------------------------------------
Hi, everyone
    I have customize a subproess, and another subprocess  is in it. in running, I want the subprocess get some father process' parameters. how could I do? 
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/831852#831852]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Demian Calcaprina
2013-08-08 02:09:07 UTC
Permalink
Demian Calcaprina [https://community.jboss.org/people/calca] created the discussion

"Re: can subprocess get its father process's parameter?"

To view the discussion, visit: https://community.jboss.org/message/831855#831855

--------------------------------------------------------------
You have to:
- Create the variables in the subprocess.
- Use the parameters mapping to pass copy variables/expressions from parent process to subprocess.

http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e1827 http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e1827
* +Parameter in/out mapping+: A sub-process node can also define in- and out-mappings for variables. The variables given in the "in" mapping will be used as parameters (with the associated parameter name) when starting the process. The variables of the child process that are defined for the "out" mappings will be copied to the variables of this process when the child process has been completed. Note that you can use "out" mappings only when "Wait for completion" is set to true.

Hope this helps,

Demian
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/831855#831855]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
trash wang
2013-08-09 08:48:35 UTC
Permalink
trash wang [https://community.jboss.org/people/wangtrash] created the discussion

"Re: can subprocess get its father process's parameter?"

To view the discussion, visit: https://community.jboss.org/message/832086#832086

--------------------------------------------------------------
thank for your answer. but actually, I want to know how I can get the relationship between the processes in running. for example, in one workerItem handler, I can get current processID. how can I get this process's father's processID, or his father's father process ID?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832086#832086]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Demian Calcaprina
2013-08-09 20:14:44 UTC
Permalink
Demian Calcaprina [https://community.jboss.org/people/calca] created the discussion

"Re: can subprocess get its father process's parameter?"

To view the discussion, visit: https://community.jboss.org/message/832172#832172

--------------------------------------------------------------
You can also do it.

Starting from jbpm 5.4, you have the parent process id in audit tables:

https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-bam/src/main/java/org/jbpm/process/audit/ProcessInstanceLog.java#L53 https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-bam/src/main/java/org/jbpm/process/audit/ProcessInstanceLog.java#L53

At runtime, the processInstanceImpl class has the parent it in the metadata too, which is put when starting the subprocess
https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SubProcessNodeInstance.java#L141 https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SubProcessNodeInstance.java#L141

I think you should use the first option, but it depends on what you are trying to achieve.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832172#832172]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...