use of eu.bcvsolutions.idm.core.notification.api.dto.IdmConsoleLogDto in project CzechIdMng by bcvsolutions.
the class DefaultConsoleNotificationSender method send.
@Override
@Transactional
public IdmConsoleLogDto send(IdmNotificationDto notification) {
Assert.notNull(notification, "Notification is required!");
//
LOG.info("Sending notification to console [{}]", notification);
IdmConsoleLogDto log = createLog(notification);
final String message = MessageFormat.format("Sending notification [{0}]", createLogForSend(notification, true));
LOG.info(message);
notification.setType(IdmConsoleLog.NOTIFICATION_TYPE);
return log;
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmConsoleLogDto in project CzechIdMng by bcvsolutions.
the class DefaultConsoleNotificationSender method createLogForSend.
/**
* Create email log for send, this record is not persist.
*
* @param notification
* @param showGuardedString
* @return
*/
private IdmConsoleLogDto createLogForSend(IdmNotificationDto notification, boolean showGuardedString) {
Assert.notNull(notification);
Assert.notNull(notification.getMessage());
//
IdmConsoleLogDto notificationLog = new IdmConsoleLogDto();
notificationLog.setSent(new DateTime());
notificationLog.setParent(notification.getId());
// clone message
notificationLog.setMessage(getMessage(notification, showGuardedString));
// clone recipients - real recipient is console
notification.getRecipients().forEach(recipient -> {
notificationLog.getRecipients().add(new IdmNotificationRecipientDto(notificationLog.getId(), recipient.getIdentityRecipient(), IdmConsoleLog.NOTIFICATION_TYPE));
});
// clone from - resolve real email
notificationLog.setIdentitySender(notification.getIdentitySender());
return notificationLog;
}
Aggregations