use of org.hisp.dhis.external.conf.ConfigurationKey.SYSTEM_PROGRAM_RULE_SERVER_EXECUTION in project dhis2-core by dhis2.
the class DefaultProgramRuleEngineService method evaluateEnrollmentAndRunEffects.
@Override
@Transactional
public List<RuleEffect> evaluateEnrollmentAndRunEffects(long enrollment) {
if (config.isDisabled(SYSTEM_PROGRAM_RULE_SERVER_EXECUTION)) {
return Lists.newArrayList();
}
ProgramInstance programInstance = programInstanceService.getProgramInstance(enrollment);
if (programInstance == null) {
return Lists.newArrayList();
}
List<RuleEffect> ruleEffects = programRuleEngine.evaluate(programInstance, programInstance.getProgramStageInstances());
for (RuleEffect effect : ruleEffects) {
ruleActionImplementers.stream().filter(i -> i.accept(effect.ruleAction())).forEach(i -> {
log.debug(String.format("Invoking action implementer: %s", i.getClass().getSimpleName()));
i.implement(effect, programInstance);
});
}
return ruleEffects;
}
Aggregations