Hi! I'm new here and a have a doubt about rules and functions in Drools.<br><br>I have this rule:<br><br>rule "ProductDescription validation"<br> when<br> $listing : Listing( $description:productDescription != null )<br>
eval( $description.getTitle() != null )<br> eval( hasForbiddenWordsSet( wordsSet, $description.getTitle() ) )<br> then<br> System.out.println("ERROR!");<br>end<br><br>And this function:<br>
<br>function boolean hasForbiddenWordsSet(Set wordsSet, String value) {<br>#do something useful here<br>}<br clear="all"><br><br>And everything works fine. But now I want that function "hasForbiddenWordsSet" return a String. For example to print at "then".<br>
I tried something like this:<br><br>rule "ProductDescription validation"<br>
when<br>
$listing : Listing( $description:productDescription != null )<br>
eval( $description.getTitle() != null )<br>
$word : hasForbiddenWordsSet( wordsSet, $description.getTitle() )<br>
then<br>
System.out.println("ERROR: " + word);<br>
end<br>
<br>function String hasForbiddenWordsSet(Set wordsSet, String value) {<br>
#do something useful here<br>
}<br><br>But it doesn't work, tried some other things and still no success.<br><br>Could someone help me?<br clear="all"><br>Thanks in advance.<br><br>-- <br>Leandro Carvalho<br>