use of org.hisp.dhis.rules.models.RuleActionAssign in project dhis2-core by dhis2.
the class RuleActionAssignValueImplementer method assignValue.
private void assignValue(RuleEffect ruleEffect, ProgramInstance programInstance) {
if (programInstance == null) {
log.info("No value assigned by AssignValue action");
return;
}
String value = ruleEffect.data();
RuleActionAssign assign = (RuleActionAssign) ruleEffect.ruleAction();
String variable = assign.field();
Matcher matcher = PATTERN.matcher(variable);
while (matcher.find()) {
variable = matcher.group(0).trim();
}
log.info("Assigning: " + variable + " with value: " + value);
if (!variableMap.containsKey(programInstance.getUid())) {
variableMap.put(programInstance.getUid(), new HashMap<>());
}
variableMap.get(programInstance.getUid()).put(variable, value);
}
Aggregations