I know how to create DRL files inside KIE workbench by using all the methods. But what my problem is without using the KIE workbench, can we create the .drl fil
Even i have used the same implementation that @apandey846 suggested. I would just like to add one more thing: If you want to import the required classes, you can do it as follows:
PackageDescr pkg = DescrFactory.newPackage()
.newImport("classname").target().end()
.name("org.drools.example")
.newRule().name("Xyz")
.attribute("ruleflow-grou","bla")
.lhs()
.and()
.pattern("Foo").id( "$foo", false ).constraint("bar==baz").constraint("x>y").end()
.not().pattern("Bar").constraint("a+b==c").end().end()
.end()
.end()
.rhs( "System.out.println();" ).end()
.getDescr();
To add multiple conditions in the LHS, you can do:
pattern("eval").constraint("condition1").end().
pattern("eval").constraint("condition2").end().
pattern("eval").constraint("condition3").end().
Hope it helps.. :)