Brian,

    I'm not aware of any problem with AgendaFilters, so if you think it is indeed a problem, may I ask you please to open a JIRA?

    Having said that, I personally think that AgendaFilters should be used only for test purposes. To implement phased rule firing like the ones you are doing, I strongly recommend you use agenda-groups. You can control the rules that will fire simply by calling setFocus() method on working memory. You can still let rule names to have the prefixes you are using just for documentation purposes, but I discourage you to use them as a control mechanism.
    Ruleflow can also be used, but for your use case, I think agenda-groups will be enough.

    []s
    Edson

2007/8/22, Brian Enderle < brianke@gmail.com>:
I have many rules in which I have named the various rules by the level at
which the rules are to be fired, for instance:

rule "LevelOne: Name cannot be null"
   when
      Person(firstNm == null)
   then
      <log an error>
end

rule "LevelTwo: Street cannot be null"
   when
      Person(street== null)
   then
      <log an error>
end

Within my Java code I first insert all objects into a statefulSession, then
add all my globals.  I then use a switch statement to call different methods
to perform the various levels of validation (ie: performLevelOneValidation(),
performLevelTwoValidation(), etc.).  Each of these methods calls a common
method, performValidation(String validationLevel) which I want to use to fire
the rules of just the validation level supplied.  I am doing this with:

statefulSession.fireAllRules(new RuleNameStartsWithAgendaFilter
(validationLevel));

In some cases I need to perform multiple levels of validation (if anything
over Level One validation is called, all preceding levels also need to be
validated) and need to perform them in order for reporting purposes.  My code
correctly calls my performaValidation() method with the correct
validationLevel but the only rules that fire are those with "LevelOne" in the
rule name.

I know the data, the rules, the globals, etc are all present for firing rules
in a level other than level one and that I should get some mathces to my rules
but I am not getting anything to match outside of Level One.

I can only assume that the rules other than Level One are not firing and that
I am missing something within my code that fires the rules for other levels.
Am I misunderstanding how the AgendaFilter works?  Should I be using something
else like agenda-group to accomplish this segregation of rules?

Also, my rules and data objects do not change as the rules are run.  I simply
display a list of errors found.  Would it benefit me to use sequential mode
and would this help me in trying to segerate the rules into various levels?

Thanks in advance,
Brian Enderle

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com