[rules-users] calling a function from the facts model

Esteban Aliverti esteban.aliverti at gmail.com
Sun Oct 3 09:02:57 EDT 2010


If you need to call a method that does not follow the java bean method
convention, then you need to use an eval(). Please read the documentation
about eval() to see how it is used and the inconvenience that ot has.

Best,

El oct 3, 2010 6:44 a.m., "Nadav Hashimshony" <nadavh at gmail.com> escribió:

Hi.

After importing the fact model to guvnor i open try to create a new rule.

in the left side i see the fact model, i click the "+" and get all the
members of the fact class (all my members are public).

my question is, why cant i see the methods of the facts class?

i want to use a method that receives a parameter and returns an answer, then
check that answer in the rule and do something accordingly.

example:
currently my rule look like

rule "Rule-04"
salience 100
activation-group "mygrp"
    no-loop true
    when
        d : myFacts( isOne == "false", isTwo == "true", hasThree == "true")


    then
        System.out.println("Rule 04 activated");
        d.someMethodDone();


i want it to be something like:

    when
        d : myFacts( isOne == "false", isTwo == "true", hasNumber("three")
== "true")

    then
        System.out.println("Rule 04 activated");
        d.someMethodDone();

i want hasNumber to be a function i give a parameter too and check it return

how can this be done?

Thanks.
Nadav.

_______________________________________________
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/20101003/66a0673e/attachment.html 


More information about the rules-users mailing list