try
{
if ( Boolean.valueOf( process( rule.condition() ) ) )
{
for ( RuleAction action : rule.actions() )
{
//Check if action is assigning value to calculated variable
if ( isAssignToCalculatedValue( action ) )
{
try {
RuleActionAssign ruleActionAssign = (RuleActionAssign) action;
updateValueMap(ruleActionAssign.content(), RuleVariableValue.create(process(ruleActionAssign.data()), RuleValueType.TEXT));
} catch (Exception e) {
e.printStackTrace();
log.error( "Exception while assigning value for PR in " + rule.name() + ": " + e.getMessage() );
}
}
else
{
try {
ruleEffects.add(create(action));
} catch (Exception e) {
e.printStackTrace();
log.error( "Exception while applying action for PR in " + rule.name() + ": " + e.getMessage() );
}
}
}
}
}
catch ( Exception e )
{
e.printStackTrace();
log.error( "Exception in " + rule.name() + ": " + e.getMessage() );
}
In the code:
dhis2-rule-engine/src/main/java/org/hisp/dhis/rules/RuleEngineExecution.java
Line 127 in ddab487
Could be better to have something like: