Ok folks, the issue was resolved, thanks everyone for their valuable
inputs.
Here is what I have found out:
1. The manual for 4.0.2 is incorrectly stating that
RuleNameEndsWithAgendaFilter("Test") filters OUT the rules. It actually
filters IN..
The interface AgendaFilter contains method :
public boolean accept(final Activation activation);
so when it returns true - the Activation IS accepted.
The implementations class RuleNameEndsWithAgendaFilter("Test") of that
interface has method, which returns true when
activation.getRule().getName().endsWith( "Test" )
So activations of rules that end on "Test" ARE accepted.
Documentation manual needs to be corrected and it would probably be
beneficial to add section to it describing AgendaFilter interface.
2. When using rule flow file like in my example:
START -> Initialization -> Validation -> END
And using RuleNameEndsWithAgendaFilter("My Rule Name") which had
"Validation" ruleflow group - never fired because NONE of the
activations were permitted on Initialization part, it choked execution
of the Activations on the Validation part.
The resolution was when I created a custom agenda filter :
new AgendaFilter () {
public boolean accept(Activation activation) {
if (activation.getRule().getName().equals("My Rule
Name")
||
!activation.getRule().getRuleFlowGroup().equals(
"Validation")) {
return true;
} else {
return false;
}
}
}
It allowed to fire all rules in ruleflow group other then Validation and
then proceeded to Validation and fired that particular validation rule I
was looking for. (thanks to Kris for the advice)
-Sergey
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Matt Geis
Sent: Thursday, October 18, 2007 1:02 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] RE: firing specific rule
I ran into this unexpected behavior as well. I took a look at the
Drools source and found that the rule filters filter out rules that MEET
the criteria (unlike the java Filename Filter, which filters out those
that do NOT meet the criteria.
So, if you want to run a VERY specific rule, you could create something
like RuleNameNotEqualsFilter, and that would ensure that all rules
except the one you want to fire have no chance of firing.
Then, of course, you would want to make sure that the facts you assert
meet the conditions you've set up in the LHS of the rule.
Matt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users