[rules-users] how to find the rule name

Steven Williams stevearoonie at gmail.com
Wed Jul 2 18:53:41 EDT 2008


try
String ruleName = ...

On Thu, Jul 3, 2008 at 7:09 AM, Marina <ppine7 at yahoo.com> wrote:

> Hello,
>
> I need to know the rule name of the rule that fired in the consequence part
> of the rule. I tried something like the following, just trying to see if I
> can get it this way:
>
> package mode.simple;
> import java.lang.String;
> import java.util.List;
> import com.emptoris.ecm.domain.ContractRulesData;
>
> global java.util.Set approverList;
>
> rule "testOR_1"
>    dialect "java"
>    when
>        $data : ContractRulesData (sum > 500 || name matches ".*important")
>    then
>        approverList.add("approver3, approver4, Level5");
>        ruleName = drools.getRule().getName();
>        System.out.println(ruleName + " is TRUE");
>
> end
>
> When I'm trying to compile the rule, I'm getting the following error:
> Builder errors:
> Rule Compilation error : [Rule name=testOR_1, agendaGroup=MAIN, salience=0,
> no-loop=false]
>    mode/simple/Rule_testOR_1_0.java (8:391) : ruleName cannot be resolved
>    mode/simple/Rule_testOR_1_0.java (9:452) : ruleName cannot be resolved
> java.lang.RuntimeException: Unable to compile rules file: testOR_1.drl
>
> I must be doing something wrong here... ?
>
> thanks!
> Marina
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.williams at objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080703/2518f4fd/attachment.html 


More information about the rules-users mailing list