[jboss-user] [JBoss jBPM] - Transient variables disappear when signal into end-state

aleekl do-not-reply at jboss.com
Thu Oct 5 06:06:08 EDT 2006


here's the background to my problem:

I have the following process definition

START----->TASK-NODE----->NODE(with custom action)------>END

here's the code to the custom action class:


  | public void execute(ExecutionContext executionContext) throws Exception {
  |         //check if TEST mode is one
  |         ContextInstance contextInstance = executionContext.getContextInstance();
  |         String testMode = (String)contextInstance.getTransientVariable(JbpmConstants.TEST_KEY);
  | 
  |         //TEST MODE OFF 
  |         if(null == testMode) {
  |             executionContext.leaveNode(JbpmConstants.TRANSITION_GO_NEXT);
  |         }
  |         //TEST MODE ON
  |         else {
  | 
  |             //set node name in as both key and value
  |             contextInstance.setTransientVariable(JbpmConstants.NODE_UPDATE, JbpmConstants.NODE_UPDATE);
  |             String exceptionFlag = (String)contextInstance.getTransientVariable(JbpmConstants.TEST_UPDATE_EXCEPTION);
  |             if(null == exceptionFlag) {
  |                 //no exception
  |                 executionContext.leaveNode(JbpmConstants.TRANSITION_GO_NEXT);
  |             }
  |             else {
  |                 throw new Exception(JbpmConstants.TEST_UPDATE_EXCEPTION); //test for exception
  |             }
  |         }
  |     }
  | }
  | 

and here is the code for my junit test:

  | .
  | .
  | .
  | _token.signal();
  | _activatedNode = (String)_token.getProcessInstance().getContextInstance().getTransientVariable(JbpmConstants.NODE_UPDATE);
  | assertNotNull(_activatedNode);
  | assertEquals(_activatedNode, JbpmConstants.NODE_UPDATE);
  | 

The idea is I want to test to make sure my custom-node is activated after signalling from the TASK-NODE, and I'm using transient variables to test this result. So far this has work with other workflows where a signal of a task node leads to another task node (i.e. not end state). However once I signal from a task-node into an eventual end-state, I find that all my transient variables are gone.

I've also tried to print out all variables (transient and non-transient) after the signal() call, but both maps are null. 

Does anyone know why this is so?

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976263



More information about the jboss-user mailing list