So my final (JBPM 3) solution for this requirement is as follows.

An actionhandler in the subprocess which propagates the event to the 
superprocess.

public void execute(ExecutionContext executionContext) throws Exception {
  | 
  |     if (eventType == null) {
  |       eventType = executionContext.getEvent().getEventType();
  |     }
  |     Token superToken = executionContext.getProcessInstance()
  |         .getSuperProcessToken();
  |     ExecutionContext superContext = new ExecutionContext(superToken);
  |     
superToken.getProcessInstance().getProcessDefinition().fireEvent(eventType, 
superContext);
  | }

and another action handler to handle the propogated event in the superprocess:

 
  | 
  | String nodeName=null;
  | String transitionName=null;
  | 
  | public void execute(ExecutionContext executionContext) throws Exception {
  | 
  |   List tokenList = executionContext.getProcessInstance().findAllTokens();
  |   for (Iterator it = tokenList.iterator(); it.hasNext();) {
  |       Token token = (Token) it.next();
  |       if (token.getNode().getName().equals(nodeName)) {
  |         token.signal(transitionName);
  |      }
  |   }
  | }

The propagated event can then be sent to a state that transitions to a join to 
control the main flow of the superprocess. I'm sure there are some other ways 
of getting the same effect but this seems to work quite well. I have also 
refined it further to consolidate events of the same type from multiple 
instances of the same subprocess.

Now need to see how this is achieved in JBPM4.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260947#4260947

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260947
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to