[rules-dev] Clarification regarding .drl file

Sarath Kumar Daruru sarathd at blueally.com
Fri Dec 19 03:45:14 EST 2008


Hi,
I'm new to Drools engine. I'm developing small application related to Insurance domain. I've defined my own rules to process the policy.
I have defined 5 rules in my application. I have small question here regarding rules file. Below is my drl file
rule "1 Policy Validation"
      salience 1
      when
            Claims($claimPolicyID :  policyID != "abc1234" && message == "A",$claimPolicyID1 : policyID );
            $c : Claims (message == "A");
      then
            modify( $c ) {
             setMessage("Entered wrong Ploicy Number "+$claimPolicyID1+" \n")
            }
end

rule "2 Claims Validation"
      salience 2
      when
            Claims($claimAmt :  amount >=10000 && message =="B");
            $c : Claims (message =="B");
      then
            modify( $c ) {
            setMessage( "You are entered more than policy allocated amount. Plese enter correct amount \n" )
            }
end

rule "3 Hospital Days Validation"
      salience 3
      when
            Claims($claimHospitalDays :  claimsHospitalStayeddays > 10 && message == "C");
            $c : Claims (message =="C");
      then
            modify( $c ) {
            setMessage( "You entered more nithgs than the maximum permitted  "+ $claimHospitalDays +" days, this is more nights than the maximum permitted by the policy \n")
            }
End

Problem: All rules are firing once I will give workingMemory.fireAllRules();
Here my doubt is how can I exit from rule file once my rule1 fire or rule 2 fire. I don't want to file all rules in .drl file. Once the rule is satisfy then I need to exit from .drl file.
Can you please give me the solution?

Ahead Together,
Sarath Kumar Daruru

Associate Technical Lead - (TEG) | BlueAlly (A Megasoft Division)
Megasoft Limited| 6-3-1192/2/1| Kundanbagh| Begumpet| Hyderabad-16|
Phone: +91 40 4033 0000 Extension 8175
Mobile: +91 994 999 3152
Email: sarathd at blueally.com<mailto:sarathd at blueally.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20081219/5dde8eb1/attachment.html 


More information about the rules-dev mailing list