Please ignore my previous email as I did not include subject.
I have 4 drl files in my app. Loading all the 4 during application startup.
If any rule is satisfied in File 1,I don't want File 2 be called.Should
execute File 3 and 4.
Similarly If rules in File 1 is not satisfied,want to call File 2 then File
3 and 4.
At present I am doing this way.Please let me know if this is ok or if there
is any better solution.
Set an attribute when a rule is satisfied. (attribute is not dummy,I need it
in my app)
Attribute is checked in each and every if it is null.
Example File1.drl contains 2 rules.If first rule is satisfied, don't want to
execute second rule.So setting rule with a valid number.
File1.drl
rule "1.Age Factor and Junior"
when
d : CustomerDetail( rule == "" && sale == 'Junior'
&& age in
("16","17"))
then
System.out.println("Junior and Age Satisfied ");
d.setRule("1");
end
rule "2.Junior only Age Factor"
when
m : CustomerDetail( rule == "" && age in
("16","17"))
then
System.out.println("Only junior Age satisfied.");
m.setRule("2");
end
File2.drl
rule "3.Age Factor and Senior"
when
d : CustomerDetail( rule == "" && sale == 'Senior'
&& age in
("70","75"))
then
System.out.println("Senior and Age Satisfied ");
d.setRule("10");
end
rule "4.Senior only Age Factor "
when
m : CustomerDetail( rule == "" && age in
("70","75"))
then
System.out.println("Only senior Age satisfied.");
m.setRule("11");
end
This one works but I see these disadvantages:
1)If the rule 1 is satisfied, rule2 is still executed.Similary all the rules
in File2.drl.
2)Might impact performance all the 4 rules are called all time.
Any suggestions?
Show replies by date