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

Nadav Hashimshony nadavh at gmail.com
Sun Oct 3 05:43:28 EDT 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101003/ecdd186c/attachment.html 


More information about the rules-users mailing list