[rules-dev] Fire specific rules

Wolfgang Laun wolfgang.laun at gmail.com
Sun Dec 19 13:14:53 EST 2010


Apparently there has been some confusion between the two interfaces called
AgendaFilter. But these classes are so simple that you can write your own.

import org.drools.runtime.rule.Activation;
import org.drools.runtime.rule.AgendaFilter;

public class EndAgendaFilter  implements AgendaFilter {
    private final String  suffix;

    private final boolean accept;

    public EndAgendaFilter(final String suffix) {
        this( suffix,
                true );
    }

    public EndAgendaFilter(final String suffix,
            final boolean accept) {
        this.suffix = suffix;
        this.accept = accept;
    }

    public boolean accept(final Activation activation) {
        if ( activation.getRule().getName().endsWith( this.suffix ) ) {
            return this.accept;
        } else {
            return !this.accept;
        }
    }
}





On 19 December 2010 18:47, Benson Fung <benson.redhat at gmail.com> wrote:

> Hi,
>
> I would like to file specific rules in Drools 5.1.  However, the
> RuleNameEndsWithAgendaFilter no longer works in FireAllRules of Drools 5.1.
>
>
>
> Please help
>
> Thanks
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20101219/c38418b4/attachment.html 


More information about the rules-dev mailing list