-
1. Re: jbpm+decision Node
saviola Apr 27, 2006 9:17 AM (in response to medjbpm)Hi, medjbpm!
Here is an example:<decision name="Payment Decision" expression="#{contextInstance.variables['Payment Decision']}"> <transition name="To Cash Paid" to="Cash Paid"/> <transition name="To Bank Paid" to="Bank Paid"/> <transition to="Cash Paid"/> </decision>
Or you can use this one:<decision name="Payment Decision" > <transition name="To Cash Paid" to="Cash Paid"/> <transition name="To Bank Paid" to="Bank Paid"/> <transition to="Cash Paid"> <condition expression="#contextInstance.variables['Payment Decision'] ge 5"/> </transition> </decision>
Or this one:<decision name="Payment Decision" > <handler class="bla.bli.MyDecisionHandler"/> <transition name="To Cash Paid" to="Cash Paid"/> <transition name="To Bank Paid" to="Bank Paid"/> <transition to="Cash Paid"/> </decision>
-
2. Re: jbpm+decision Node
medjbpm May 2, 2006 3:39 AM (in response to medjbpm)thank you for replay
in this example :
<condition expression="#contextInstance.variables['Payment Decision'] ge 5"/>
what did you mean with
"['Payment Decision'] ge 5"
if you mean Payment Decision=5
how can i use other operation (<,>) -
3. Re: jbpm+decision Node
senhce May 2, 2006 5:23 AM (in response to medjbpm)If you wanna add more manipulation and quering database use the handler. All you have to do is write a handler class which implements DecisionHandler of JBPM and configure the same in xml as shown below.
DecisionHandler will have a method decide the return type will determine which way to go. Hope this helps.
Thanks,
Senthil -
4. Re: jbpm+decision Node
hornsbyr May 3, 2006 4:39 AM (in response to medjbpm)Hi,
I want to use a decision which takes a particular transition based on a process variable, and takes a default transition if the variable has not been set. The decision I am using is
<condition expression="#contextInstance.variables['tran'] eq null"/>
<condition expression="#contextInstance.variables['tran'] eq 'optionalState1'"/>
<condition expression="#contextInstance.variables['tran'] eq 'optionalState2'"/>
However I get an exception
org.jbpm.graph.def.DelegationException
...
Caused by: java.lang.NullPointerException
at org.jbpm.graph.node.Decision.execute(Decision.java:70)
Even though I set
contextInstance.setVariable("tran", "optionalState1");
Any ideas what could be causing this?
Also how can I check if an instance variable has not been set?
Is "#contextInstance.variables['tran'] eq null" the correct way?
Thanks -
5. Re: jbpm+decision Node
hornsbyr May 3, 2006 4:47 AM (in response to medjbpm)Note: repost for readability, sorry, please ignore previous
Hi,
I want to use a decision which takes a particular transition based on a process variable, and takes a default transition if the variable has not been set. The decision I am using is<decision name="intelligentState"> <transition to="workFlowStart"> <condition expression="#contextInstance.variables['tran'] eq null"/> </transition> <transition to="optionalState1"> <condition expression="#contextInstance.variables['tran'] eq 'optionalState1'"/> </transition> <transition to="optionalState2"> <condition expression="#contextInstance.variables['tran'] eq 'optionalState2'"/> </transition> </decision>
However I get an exception
org.jbpm.graph.def.DelegationException
...
Caused by: java.lang.NullPointerException
at org.jbpm.graph.node.Decision.execute(Decision.java:70)
Even though I set
contextInstance.setVariable("tran", "optionalState1");
Any ideas what could be causing this?
Also how can I check if an instance variable has not been set?
Is "#contextInstance.variables['tran'] eq null" the correct way?
Thanks -
6. Re: jbpm+decision Node
saviola May 3, 2006 2:46 PM (in response to medjbpm)Hi, hornsbyr!
Maybe the problem is that the variable you are using is not mapped.
You can map it like this.<node name="The node before the decision node"> . . . <variable name="Var" mapped-name="Mapped Name" /> . . . </node>
Remember that AFAIK you must use the mapped name in the transition condition.
I hope this could be helpfull.
Saviola -
7. Re: jbpm+decision Node
jeffgordon May 10, 2006 2:33 PM (in response to medjbpm)You can try brackets around your expression:
<condition expression="#{contextInstance.variables['tran'] eq 'optionalState1'}"/>
[unless the forum software stripped them] -
8. Re: jbpm+decision Node
jeffgordon May 10, 2006 2:48 PM (in response to medjbpm)You may also want to try wrapping your expression in a CDATA section and not using the expression attribute:
<condition><![CDATA[#contextInstance.variables['tran'] eq 'optionalState1'}]]></condition>
-
9. Re: jbpm+decision Node
fassihi May 11, 2006 8:37 AM (in response to medjbpm)I have the same problem and have tested all these solutions but none have worked so far.
The error that I get is :
"Can't evaluate bean shell script!"