[rules-users] Calling function in the rule

Mohamed Riyaz riyazenayath at gmail.com
Tue Sep 16 01:02:26 EDT 2008


Hi,

Yes.

1.
Define a static method in java and import the specific function in rule
file.

DroolsFunction.java
-----------------------------
public static boolean isValidForBrand() {...}


2. import the java function in rule file
invokeRule.drl

import function DroolsFunction.isValidForBrand;


when

 exists (

Boolean(booleanValue==true) from
isValidForBrand($croNumberDetailsRequest.getBrand())

)

Then

ResultList.add($resdirectPhoneNumber);

Try this, It should work.

Regards,
Riyaz

On 9/11/08, Rout, Sushanta (ThoughtMill) <Sushanta.Rout at ihg.com> wrote:
>
>  Is there any way to call java functions in the rule? One option is *eval
> *but eval is quite expensive. Hence trying to see if there is any other
> option?
>
> when
>
>
> Eval($resdirectPhoneNumber.isValidForBrand($croNumberDetailsRequest.getBrand()))
>
> Then
>
> ResultList.add($resdirectPhoneNumber);
>
>
>
> Thanks
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080916/7f247134/attachment.html 


More information about the rules-users mailing list