Hello,
I have a set of rules that determine a target date for a business object
based on which rule criteria the object matches. When the business
object is asserted, the target date field may or may not be null. My
problem is if the business object does not match any of the rules I
would like the target date set to null and since there are multiple rule
possibly affecting the same object I would rather not create an
"anti-rule" for each rule which sets the target date to null.
I've tried creating a rule with a higher salience value which sets the
target date to null, if it is not already, and modifies the object but
when the object matches another rule and modifies the object again it
goes into an infinite loop. I could probably set the target date to
null before asserting it into the rule engine but I was hoping to keep
it self contained.
Here's an example of what I'm talking about:
rule "Pre"
salience 10
no-loop true
when
$bo : MyObject( targetDate != null )
then
Date tmp = null;
$bo.setTargetDate(tmp);
modify($bo);
end
rule "Post a"
no-loop true
when
$bo : MyObject( targetDate == null, criteriaMatches == "A")
$someDate : ThisDateObject();
then
$bo.setTargetDate($someDate);
modify($bo);
end
rule "Post b"
no-loop true
when
$bo : MyObject( targetDate == null, criteriaMatches == "B" )
$someDate : ThatDateObject();
then
$bo.setTargetDate($someDate);
modify($bo);
end
etc...
I'm pretty sure there is a simple answer but it just won't come to me.
Thanks for any help.
Myles
--
eBusiness Solutions Engineer
CGI ISMC - DynaDocs
DynaDocs Global Solutions
160 Elgin St., 17th Floor
Ottawa,ON
K2C 2P4
Office: (613) 781-4338
Fax: (613) 781-3821
CONFIDENTIALITY NOTICE: Proprietary/Confidential Information belonging to CGI Group Inc.
and its affiliates may be contained in this message. If you are not a recipient indicated
or intended in this message (or responsible for delivery of this message to such person),
or you think for any reason that this message may have been addressed to you in error, you
may not use or copy or deliver this message to anyone else. In such case, you should
destroy this message and are asked to notify the sender by reply email.