[rules-users] Any suggestions to implement exclusions and avoid update

Wishing Carebear wishing.carebear at gmail.com
Tue Jul 12 01:56:54 EDT 2011


Hi,
Below are 2 rules, rule1 has higher precedence than rule2. Rule2 should not
execute if Rule 1 executes.
1) One way to get this working is to check the null value.
2) If the update is not called, the Rule2 gets executed using the previous
null value of potentialTheftRating.

Is there any other way to implement this requirement.



rule  "Rule 1 PotentialTheft0"
    ruleflow-group "TheftRating0"
    salience 10
    no-loop
    lock-on-active
    when
        $client : Client()
        $policy : Service(productType == "Vehicle Insurance") from
$client.service
        $car : Vehicle(potentialTheftRating == null, vehicleType ==
vehicleTypeType.CAR, convertible == Boolean.TRUE) from $policy.vehicle
    then
        modify ($car) {
            setPotentialTheftRating(  potentialTheftRatingType.HIGH )
        }
        update($client);
end

rule  "Rule2 PotentialTheft0"
    ruleflow-group "TheftRating0"
    no-loop
    lock-on-active
    when
        $client : Client()
        $policy : Service(productType == "Vehicle Insurance") from
$client.service
        $car : Vehicle(potentialTheftRating == null,vehicleType ==
vehicleTypeType.CAR, price >= 20000, price <= 45000, highTheftProbabilty ==
Boolean.FALSE ) from $policy.vehicle
    then
        modify ($car) {
            setPotentialTheftRating( potentialTheftRatingType.MODERATE )
        }
        update($client);
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110711/cacf3341/attachment.html 


More information about the rules-users mailing list