in ddm-bpm-extension/src/main/java/com/epam/digital/data/platform/bpms/extension/delegate/notification/SendUserNotificationDelegate.java [59:96]
protected void executeInternal(DelegateExecution execution) throws Exception {
var notificationRecipient = notificationRecipientVariable.from(execution).get();
var notificationRecipientRealmFromTemplate = notificationRecipientRealmVariable.from(execution)
.get();
var notificationRecipientRealm =
RecipientRealm.OFFICER.getName().equalsIgnoreCase(notificationRecipientRealmFromTemplate)
? RecipientRealm.OFFICER
: RecipientRealm.CITIZEN;
var notificationSubject = notificationSubjectVariable.from(execution).get();
var notificationTemplate = notificationTemplateVariable.from(execution).get();
var notificationTemplateModel = (Map<String, Object>) Objects.requireNonNull(
notificationTemplateModelVariable.from(execution).get()).mapTo(Map.class);
var notificationMessage = UserNotificationMessageDto.builder()
.recipients(List.of(Recipient.builder()
.parameters(notificationTemplateModel)
.id(notificationRecipient)
.realm(notificationRecipientRealm)
.build()))
.context(NotificationContextDto.builder()
.system("Low-code Platform")
.application(springAppName)
.businessActivity(execution.getCurrentActivityId())
.businessActivityInstanceId(execution.getActivityInstanceId())
.businessProcessInstanceId(execution.getProcessInstanceId())
.businessProcess(((ExecutionEntity) execution).getProcessDefinition().getKey())
.businessProcessDefinitionId(execution.getProcessDefinitionId())
.build())
.notification(UserNotificationDto.builder()
.ignoreChannelPreferences(false)
.templateName(notificationTemplate)
.title(notificationSubject)
.build())
.build();
notificationFacade.sendNotification(notificationMessage);
}