Search in sources :

Example 1 with ProgramNotificationRecipient

use of org.hisp.dhis.program.notification.ProgramNotificationRecipient in project dhis2-core by dhis2.

the class ProgramNotificationTemplateObjectBundleHook method postProcess.

private void postProcess(ProgramNotificationTemplate template) {
    ProgramNotificationRecipient pnr = template.getNotificationRecipient();
    ValueType valueType = null;
    if (RECIPIENT_TO_VALUETYPE_RESOLVER.containsKey(pnr)) {
        Function<ProgramNotificationTemplate, ValueType> resolver = RECIPIENT_TO_VALUETYPE_RESOLVER.get(pnr);
        valueType = resolver.apply(template);
    }
    template.setDeliveryChannels(CHANNEL_MAPPER.getOrDefault(valueType, Sets.newHashSet()));
}
Also used : ValueType(org.hisp.dhis.common.ValueType) ProgramNotificationTemplate(org.hisp.dhis.program.notification.ProgramNotificationTemplate) ProgramNotificationRecipient(org.hisp.dhis.program.notification.ProgramNotificationRecipient)

Aggregations

ValueType (org.hisp.dhis.common.ValueType)1 ProgramNotificationRecipient (org.hisp.dhis.program.notification.ProgramNotificationRecipient)1 ProgramNotificationTemplate (org.hisp.dhis.program.notification.ProgramNotificationTemplate)1