Along the same lines, have a boolean attribute called "markedForDeletion" on the
fact. Set it to true and match rules off of that, with a low priority rule that retracts
it when all others are done.
And if you can't modify the original fact class, like Wolfie says below, insert a
control fact that points back to the original, and have rules match off of that:
class RetractionHandler {
public OriginalFactClass theDoomedFact;
}
________________________________
From: Wolfgang Laun <wolfgang.laun(a)gmail.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Wednesday, October 17, 2012 12:09 PM
Subject: Re: [rules-users] How to execute a rule only when a fact is retracted
Insert a fact that says "retracted" and write a rule matching that.
Or, even simpler, execute whatever is required together with the retraction
of that fact.
-W
On 17/10/2012, dme1 <mehtad(a)hotmail.com> wrote:
Hi,
How can I ensure that a rule is executed only when a fact is retracted. If
I
implement the rule using a "not" condition it will execute even when the
object was never inserted into the working memory. Is there a way to
implement the rule such that it will not execute when a fact is never
inserted into the working memory, but executes only when the fact is
retracted from the working memory.
Thanks,
dme
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-execute-a-rule-only-when-a-fact-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users