use of eu.bcvsolutions.idm.core.notification.api.dto.FlashMessage in project CzechIdMng by bcvsolutions.
the class DefaultWebsocketNotificationSender method send.
@Override
@Transactional
public IdmWebsocketLogDto send(IdmNotificationDto notification) {
Assert.notNull(notification, "Notification is required!");
//
LOG.info("Adding websocket notification to queue [{}]", notification);
IdmWebsocketLogDto log = createLog(notification);
// send flashmessage
FlashMessage message = toFlashMessage(log);
for (IdmNotificationRecipientDto recipient : log.getRecipients()) {
if (Strings.isNullOrEmpty(recipient.getRealRecipient())) {
LOG.warn("Real recipient is empty for notification [{}]", notification);
} else {
websocket.convertAndSendToUser(recipient.getRealRecipient(), // TODO: configurable
"/queue/messages", message);
}
}
return log;
}
use of eu.bcvsolutions.idm.core.notification.api.dto.FlashMessage in project CzechIdMng by bcvsolutions.
the class DefaultWebsocketNotificationSender method toFlashMessage.
private FlashMessage toFlashMessage(IdmWebsocketLogDto log) {
IdmMessageDto message = this.getMessage(log, true);
//
FlashMessage flashMessage = new FlashMessage();
flashMessage.setId(log.getId());
flashMessage.setKey(log.getTopic());
flashMessage.setTitle(message.getSubject());
// default message
flashMessage.setMessage(message.getTextMessage());
flashMessage.setDate(log.getCreated());
flashMessage.setLevel(message.getLevel() == null ? null : message.getLevel().toString().toLowerCase());
flashMessage.setModel(message.getModel());
// TODO: other params
flashMessage.setPosition("tr");
return flashMessage;
}
Aggregations