[jboss-user] [jBPM] New message: "Re: How to get sub process instance id"

Santanu Saraswati do-not-reply at jboss.com
Thu Jan 14 01:51:43 EST 2010


User development,

A new message was posted in the thread "How to get sub process instance id":

http://community.jboss.org/message/519951#519951

Author  : Santanu Saraswati
Profile : http://community.jboss.org/people/saraswati.santanu

Message:
--------------------------------------------------------------
Two questions here:
Question 1:
How to get sub process instance id:
       Here is a possible solution
 
*+//Assuming processINstance to be your main process instance+*
+*        Collection<? extends Execution> executions = processInstance.getExecutions();
        for (Execution execution:executions) {
            //cast it to open execution..we will need it
            OpenExecution openExecution = (OpenExecution)execution;
            //check if this is a sub-process or just a fork
            if (openExecution.getSubProcessInstance() != null) {
                OpenExecution subProcessInstance = openExecution.getSubProcessInstance();*+
+*                //you should be able to do whatever you want to*++*
             }
        }*+
 
Question 2:
Can we signal without the sub process id:
     Yes. Here is a code snippet which is achieving that:
 
*+     //again..process instance is the main process instance+*
*+     //stateName is the name of the state node you want to signal
+*
*+     Execution execution = processInstance.findActiveExecutionIn(stateName);
+*
*+     //signal name is the transition you need to take on signalling
+*
*+     executionService.signalExecutionById(execution.getId(), signalName);+*
 
     You need to be cautious here that you do not have two states active at the same time with the same name. Then you might get either of them and may get unexpected result.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519951#519951




More information about the jboss-user mailing list