[rules-users] modify and update is not working in the rule file

Rana ven12344 at yahoo.com
Thu Aug 16 13:11:16 EDT 2012


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-rule-file-tp4019158p4019208.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list