JBoss Community

Re: why to use drools rules and not Java code?

created by HUI LIU in jBPM - View the full discussion

In fact, in the source code of krisv-jbpm, I find the test code about Java constraint and MVEL(rule) constraint in jbpm-flow-build/src/test/java/org/jbpm/integrationtests/processSplitTest.java, in this file, there is no difference between MVEL constraint and java constraint, see

public void testSplitWithMVELContextConstraint() and

public void testSplitWithJavaContextConstraint()

the two kinds of constraints are the same:

in the first function:

<constraint toNodeId="6" toType="DROOLS_DEFAULT" priority="1" type="code" dialect="mvel" >return context.getVariable("name") != null &amp;&amp; ((String) context.getVariable("name")).length() > 0;</constraint>

in the second function:

<constraint toNodeId="6" toType="DROOLS_DEFAULT" priority="1" type="code" dialect="java" >return context.getVariable("name") != null &amp;&amp; ((String) context.getVariable("name")).length() > 0;</constraint>

 

I don't know why?

 

By the way, in this test case file, there is also the comparison between context and kcontext, I don't know their difference and in the testcase file, their only difference is their name. Can you explain it?

 

Thanks.

Hui

Reply to this message by going to Community

Start a new discussion in jBPM at Community