-
1. Re: ProcessInstance ending changed
kukeltje Jan 9, 2009 4:29 AM (in response to olivier_debels)I just checked the code and token.end(boolean verifyParentTermiation) is still there.... So either I miss something or there is something wrong in your unittest ;-)
-
2. Re: ProcessInstance ending changed
olivier_debels Jan 9, 2009 4:46 AM (in response to olivier_debels)You missed something ;-)
I was talking about ProcessInstance#end(boolean reactivateSuper) which is no longer there...
Token#end(boolean verifyParentTermination) used this method before... -
3. Re: ProcessInstance ending changed
kukeltje Jan 9, 2009 5:03 AM (in response to olivier_debels)Hmmmmm ProcessInstance#end(boolean reactivateSuper) sounds a bit weird to me... So I can imagine it was removed. Can you describe the usecase for this? Does it have something to do with subprocesses which you want to end but not have it signal the parent process?
What if you woud do changeprocessInstance.end(false)
toprocessInstance.getRootToken().end(false)
-
4. Re: ProcessInstance ending changed
olivier_debels Jan 9, 2009 5:14 AM (in response to olivier_debels)Indeed it has to do with the subprocess which signals the parent process in the current implementation, and did not do that in the previous implementation.
In our case we have a process with a root token and some child tokens. The child tokens have a sub process.
When ending a child token, it should stop directly.
Now when we call childToken#end(false), subProcessInstance#end() will be called. This will reactivate the super token which we don't want.
Before childToken#end(false), called subProcessInstance#end(false) which did not reactivate the super token... -
5. Re: ProcessInstance ending changed
kukeltje Jan 10, 2009 9:41 AM (in response to olivier_debels)ahh... ok it is signalling 'downwards' not upwards which you want not to happen if I interpret this correctly.
But what do you mean then byWhen ending a child token, it should stop directly.
Should I read this as
"If we cancel a childtoken on the main process, it (the childtoken) should stop but te subprocess should continue.
Sounds a bit weird to me then, cancelling a childtoken but leaving the subprocess running -
6. Re: ProcessInstance ending changed
olivier_debels Jan 12, 2009 4:27 AM (in response to olivier_debels)ahh... ok it is signalling 'downwards' not upwards which you want not to happen if I interpret this correctly.
No, it's the upwards signalling I want to prevent. Sub process instances when canceled, signal their "superProcessToken""If we cancel a childtoken on the main process, it (the childtoken) should stop but te subprocess should continue
No, the sub process should stop immediately. And not trigger the continuation of its parent token as is happening right now. -
7. Re: ProcessInstance ending changed
kukeltje Jan 12, 2009 9:10 AM (in response to olivier_debels)hmm..... do you have a small unit test because I think the 'workaround' I mentioned should work
-
8. Re: ProcessInstance ending changed
olivier_debels Jan 13, 2009 7:23 AM (in response to olivier_debels)Here is a unit test.
When aborting a child token, the child token is triggered to go to the next node (task node).
So we create an additional task instance. Something we certainly don't want when aborting the token.public class AbortTokenTest { public static final String MAIN_PROCESS = "<process-definition name='MainProcess'>" + " <start-state>" + " <transition to='fork' />" + " </start-state>" + " <fork name='fork'>" + " <transition name='transition1' to='subProcess1' />" + " <transition name='transition2' to='subProcess2' />" + " </fork>" + " <process-state name='subProcess1'>" + " <sub-process name='SubProcess'/>" + " <transition to='taskNode1' />" + " </process-state>" + " <task-node name='taskNode1'>" + " <task name='generic' />" + " <transition to='join' />" + " </task-node>" + " <process-state name='subProcess2'>" + " <sub-process name='SubProcess'/>" + " <transition to='taskNode2' />" + " <task-node name='taskNode2'>" + " <task name='generic' />" + " <transition to='join' />" + " </task-node>" + " </process-state>" + " <join name='join' lock='UPGRADE'>" + " <transition to='end' />" + " </join>" + " <end-state name='end' />" + "</process-definition>"; /** * Process definition with single root token and task node. */ public static final String SUB_PROCESS = "<process-definition name='SubProcess'>" + " <start-state>" + " <transition to='taskNode' />" + " </start-state>" + " <task-node name='taskNode'>" + " <task name='generic' />" + " <transition to='end' />" + " </task-node>" + " <end-state name='end' />" + "</process-definition>"; private JbpmContext jbpmContext; @Before public void initialize() { jbpmContext = JbpmConfiguration.getInstance().createJbpmContext(); // Deploy sub process and main process jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(SUB_PROCESS)); jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(MAIN_PROCESS)); } @After public void uninitialize() { jbpmContext.close(); } @Test public void cancelToken() { ProcessInstance processInstance = jbpmContext.newProcessInstance("MainProcess"); processInstance.signal(); assertNull(processInstance.getTaskMgmtInstance().getTaskInstances()); // Abort one of the child token's processInstance.getRootToken().getChild("transition1").end(false); // Unit test fails -> a task instance is created in the main process // This because the child token is signalled and is in taskNode1 now... assertNull(processInstance.getTaskMgmtInstance().getTaskInstances()); } }
-
9. Re: ProcessInstance ending changed
kukeltje Jan 13, 2009 6:44 PM (in response to olivier_debels)I tried this and was able to run it inspite of a small error in your processdefinition (task2 is in the processstate ;-) )
You signal the 'child-token' which is in the proces-state node, not in the subprocess itself. So to me ending that does not signal any parent node. It does transition this specific token to the next one. I think that should maybe not happen but still...
If you want the subprocess to end and not signal the parent token, then end the rootToken of the subprocess with end(false) likeprocessInstance.getRootToken().getChild("transition1").getSubProcessInstance().getRootToken().end(false);
If I adapt the unittest this does exactely what you wantProcessInstance processInstance = jbpmContext.newProcessInstance("MainProcess"); processInstance.signal(); assertNull(processInstance.getTaskMgmtInstance().getTaskInstances()); assertEquals("subProcess1", processInstance.getRootToken().getChild("transition1").getNode().getName()); // Abort one of the subprocesses processInstance.getRootToken().getChild("transition1").getSubProcessInstance().getRootToken().end(false); assertNull(processInstance.getTaskMgmtInstance().getTaskInstances()); assertTrue(processInstance.getRootToken().getChild("transition1").getSubProcessInstance().getRootToken().hasEnded()); assertFalse(processInstance.getRootToken().getChild("transition1").hasEnded()); assertEquals("subProcess1", processInstance.getRootToken().getChild("transition1").getNode().getName());
-
10. Re: ProcessInstance ending changed
olivier_debels Jan 14, 2009 4:11 AM (in response to olivier_debels)Indeed,
But this keeps the 'child-token' alive. Since we 'play' we child-tokens (like dynamically adding and removing them ;-)), this is something we don't want.
However a valid solution for my issue is probably
- first end the sub process
- afterwards end the 'child-token'
So calling an end myself from bottom (sub process in this case) to top (child token in this case).
This is some extra work but will due.
Thx,
Olivier.