-
Bug
-
Resolution: Done
-
Major
-
6.4.0.Final
-
None
-
-
NEW
-
NEW
While trying to use conditionalbranch api for handling multiple if-then blocks, the DRL dumper is not printing the content we have used for conditionalbranch. Please find the sample code below and the restuls
Code
PackageDescr pkg = DescrFactory.newPackage()
.name( "org.drools.compiler" )
.newRule().name( "test" )
.lhs()
.pattern("Cheese").constraint( "type == \"stilton\"" ).end()
.conditionalBranch()
.condition().constraint("price < 10").end()
.consequence().name("c1").end()
.end()
.pattern("Cheese").constraint( "type == \"cheddar\"" ).end()
.conditionalBranch()
.condition().constraint("price > 10").end()
.consequence().name("c2").end()
.end()
.end()
.rhs( "// do something" )
.namedRhs( "c1", "// do something else\n" )
.end()
.getDescr();
return new DrlDumper().dump( pkg );
Output
package org.drools.compiler
rule "test"
when
Cheese( type == "stilton" )
Cheese( type == "cheddar" )
then
// do something
then[c1]
// do something else
end
In the above example the content "price < 10" and "price > 10" which we have used for conditionalBranch is not getting printed. On further investigation we found the drl.mvel template does not have the import org.drools.compiler.lang.descr.ConditionalBranchDescr.