The cancellation of an activation and the ensuing call to
activationCancelled() is NOT sufficient as an indication of the rule
not matching your fact data.
Scenario 1:
- fact(s) inserted
- activation created from rule R1
- fireAllRules
- activation of rule R1 fired
Scenario 2:
- fact(s) inserted
- activation created from rule R1
- fireAllRules
- fact(s) inserted/created/updated (due to another rule firing before R1)
- activation from rule R1 cancelled
Scenario 3:
- fact(s) inserted
- fireAllRules
- nothing happens
-W
On 16/08/2012, Rana <ven12344(a)yahoo.com> wrote:
I have written a function
function boolean logging(String actualValue, String ruleValue) {
progRuleValidationLog.setActualValue(actualValue); //this is a pojo which
will give me what are the failed rules.
progRuleValidationLog.setRuleValue(ruleValue);
return true;
}
rule "Brand Name"
no-loop true
activation-group "AndroGel"
when
drug : Drug()
eval( logging(drug.getBrandName, "AndroGel") )
Drug( brandName == "AndroGel" )
then
log.info("Brand Name is AndroGel");
end
These are my listeners.
@Override
public void activationCreated(ActivationCreatedEvent arg0) {
// TODO Auto-generated method stub
super.activationCreated(arg0);
String actualValue = progRuleValidationLog.getActualValue();
String ruleValue = progRuleValidationLog.getRuleValue();
progRuleService.saveOrUpdate(progRuleValidationLog);
log.info("Activation Created Event =
"+arg0.getActivation().getRule().getName()+" because Rule passed.");
log.info("Reason for Rule passed is that the condition matched because
the Actual value = "+actualValue+" did match with the Rule Value =
"+ruleValue);
}
@Override
public void activationCancelled(ActivationCancelledEvent arg0) {
// TODO Auto-generated method stub
super.activationCancelled(arg0);
String actualValue = progRuleValidationLog.getActualValue();
String ruleValue = progRuleValidationLog.getRuleValue();
progRuleService.saveOrUpdate(progRuleValidationLog);
log.info("Activation Cancelled Event =
"+arg0.getActivation().getRule().getName()+" because Rule failed.");
log.info("Reason for Rule failed is that the condition did not match
because the Actual value = "+actualValue+" did not match with the Rule
Value
= "+ruleValue);
}
Thanks.
--
View this message in context:
http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the...
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