use of org.hisp.dhis.program.notification.event.ProgramRuleEnrollmentEvent in project dhis2-core by dhis2.
the class RuleActionSendMessageImplementer method implement.
@Override
public void implement(RuleEffect ruleEffect, ProgramInstance programInstance) {
NotificationValidationResult result = validate(ruleEffect, programInstance);
if (!result.isValid()) {
return;
}
ProgramNotificationTemplate template = result.getTemplate();
String key = generateKey(template, programInstance);
publisher.publishEvent(new ProgramRuleEnrollmentEvent(this, template.getId(), programInstance));
if (result.getLogEntry() != null) {
return;
}
ExternalNotificationLogEntry entry = createLogEntry(key, template.getUid());
entry.setNotificationTriggeredBy(NotificationTriggerEvent.PROGRAM);
entry.setAllowMultiple(template.isSendRepeatable());
notificationLoggingService.save(entry);
}
Aggregations