[rules-users] Help with LHS part of the Rule
new2drools
rkbeach at gmail.com
Sat Jun 20 16:13:45 EDT 2009
I am using Drools 5.
In the LHS part of a rule, is it possible to call a method, in a class
instance (that has been inserted into the working memory) which expects two
parameters, and returns a boolean?
For example, how can I invoke the following method in LHS (in a DRL file)
part of the rule?
public class BusinessService {
public boolean isValidSomething(String param1, String param2) {
return true;
}
}
The only way I could do this was:
$bService : BusinessService()
$retValue : Boolean() from $bService.isValidSomething("param1", "param2")
The problem I am running into is, by using the above syntax, I am forced to
use 'eval', when I have to use some conditional logic. My understanding is
that using 'eval' will result in sub-optimal performance.
Another question I have is related to conditional logic in the rule
language. When I capture the return values (as shown above) in variables, I
am not able to use the following syntax...
$date1 : Date() from Object1.getBeginDate()
$date2 : Date() from Object2.getCancelDate()
(Object1 and Object2 are different object's)
(($retValue == Boolean.FALSE) && ($date1 > $date2))
I have to do the following:
eval (($retValue == Bollean.FALSE) && ($date1.getTime() > $date2.getTime()))
I am not sure if I am using the rule language correctly. So, please bear
with me, if I making some obvious mistakes.
Any help, would be highly appreciated.
Thanks!
--
View this message in context: http://www.nabble.com/Help-with-LHS-part-of-the-Rule-tp24128872p24128872.html
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list