[rules-users] if statement in MVEL consequence
mark.mcnally at comcast.net
mark.mcnally at comcast.net
Tue Aug 14 13:19:34 EDT 2007
Hello,
I would like to conditionally attempt logging in the consequence of each rule but it does not like the 'if' statement.
Without the 'if', it works fine. It appears to work fine for the java dialect as well - only complains for MVEL dialect.
It does not appear to be related to the logger instance because even "if (true)" causes similar Exception.
I also tried with and without the curly braces.
global org.apache.commons.logging.Log logger
rule Language
dialect "mvel"
salience 800
when
$pd : ParticipantDetails( $ptLanguage : participant.languagePreferenceCD )
$nd : NurseDetails( languages not contains $ptLanguage )
then
if (logger.isDebugEnabled())
logger.debug("LanguageMismatch - ptId: " + $pd.participant.id + ", Lang: " + $ptLanguage + ", staffId: " + $nd.staffId );
[...]
end
* (1,28) unable to resolve method using strict-mode: java.lang.Object.if(...)
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'primaryNurseAssignmentService' defined in class path resource
[...]
nested exception is org.drools.rule.InvalidRulePackage: Unable to build expression for 'consequence' '
if (logger.isDebugEnabled())
logger.debug("LanguageMismatch - ptId: " + $pd.participant.id + ", Lang: " + $ptLanguage + ", staffId: " + $nd.staffId );
Should what I am attempting work?
Thanks,
Mark
More information about the rules-users
mailing list