This content has been marked as final.
Show 11 replies
-
1. Re: Problem with multiple end-states
kukeltje Jul 10, 2007 10:33 AM (in response to fewagewasd)multiple end states are not supported afaik....
-
2. Re: Problem with multiple end-states
fewagewasd Jul 10, 2007 10:54 AM (in response to fewagewasd)hm if that's the case, i think it shouldn't be allowed by the xml schema to create more than one end state...
-
3. Re: Problem with multiple end-states
estaub Jul 10, 2007 11:26 AM (in response to fewagewasd)"kukeltje" wrote:
multiple end states are not supported afaik....
Ronald,
Are you sure? Why?
fewagewasd,<event type="before-signal"> <action name="check foo bar" class="TestActionHandler"></action> </event>
You shouldn't call signal or leave-node from an event-handler - do it from an execute action-handler instead. I'm not sure this is the cause of your problem, but it well might be.
-Ed Staub -
4. Re: Problem with multiple end-states
fewagewasd Jul 10, 2007 11:47 AM (in response to fewagewasd)I've tried the following:
<node name="node1"> <action class="TestActionHandler.class"/> <transition name="foo" to="EndFoo"></transition> <transition name="bar" to="EndBar"></transition> </node>
but i get a DelegationException... -
5. Re: Problem with multiple end-states
kukeltje Jul 10, 2007 5:44 PM (in response to fewagewasd)yes because in Java you never use the .class extension anywhere
-
6. Re: Problem with multiple end-states
koen.aers Jul 11, 2007 3:43 AM (in response to fewagewasd)Multiple end-states should work fine. Is there any proof of the contrary?
Regards,
Koen -
7. Re: Problem with multiple end-states
fewagewasd Jul 11, 2007 3:57 AM (in response to fewagewasd)Is there any way to tell jbpm to wait in the state and execute the action when I call signal()?
-
8. Re: Problem with multiple end-states
kukeltje Jul 11, 2007 4:34 AM (in response to fewagewasd)"estaub" wrote:
"kukeltje" wrote:
multiple end states are not supported afaik....
Ronald,
Are you sure? Why?
I thought I remembered someone doing this before and not getting it to work, but since Koen says it should work, it might (my AFAIK was added because I was not completely sure) -
9. Re: Problem with multiple end-states
efip10 Jul 12, 2007 4:29 AM (in response to fewagewasd)I use multiple end-states, and it works.
As outlined in "Node responsibilities" in userguide, only the node action can decide on which transition to take. In event action, you cannot take this decision.<node name="check-suspend-or-abort"> <action class="com.qq.DecideIfSuspendedOrAbortedAction" /> <transition to="continue" /> <transition to="error" name="error"/> <transition to="suspended" name="suspended"/> <transition to="aborted" name="aborted"/> </node> <end-state name="aborted"> </end-state> <end-state name="suspended"> </end-state> <end-state name="error"> </end-state>
Here's the action:public void execute(ExecutionContext ctx) throws Exception { Map params = ctx.getContextInstance().getVariables(); // check if aborted - invoke my function if (isAbortedFlagForWorkflow()) { // do something ctx.getToken().signal("aborted"); } else // check if suspended if (isSuspendedFlagForWorkflow()) { // do something ctx.getToken().signal("suspended"); } else { // everything is OK, we may start the workflow // leave over default transition ctx.getToken().signal(); } }
Hope it helps. -
10. Re: Problem with multiple end-states
efip10 Jul 12, 2007 5:42 AM (in response to fewagewasd)"fewagewasd" wrote:
Is there any way to tell jbpm to wait in the state and execute the action when I call signal()?
If the action on your node (the main node action, not the event action) does not call token.signal(), then the execution will not propagate. The instance will "wait in the state" until you call signal() again. When you call signal() again, you have to notify which transition to take, e.g. signal("error").
If you'd rather have your code make the decision, introduce another node in the flow - after your wait-state node - and make the decision in its main action. This way, when you call signal(), you always take the only transition to a new node, and there its action will decide where to go. -
11. Re: Problem with multiple end-states
kukeltje Jul 13, 2007 10:52 AM (in response to fewagewasd)Depending on what the action is or should do, you could use an action on an event of type 'node-leave'