use of eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto in project CzechIdMng by bcvsolutions.
the class DefaultEmailNotificationSender method send.
@Override
@Transactional
public IdmEmailLogDto send(IdmMessageDto message, String[] emails, List<IdmAttachmentDto> attachments) {
Assert.notNull(message, "Message is required.");
Assert.notNull(emails, "Emails are required.");
//
IdmEmailLogDto emailLog = new IdmEmailLogDto();
// there is no parent
// build message, without password
emailLog.setMessage(notificationTemplateService.buildMessage(message, false));
//
for (String email : emails) {
// fill email to recipientDto
emailLog.getRecipients().add(new IdmNotificationRecipientDto(email));
}
emailLog = this.emailLogService.save(emailLog);
// save notification attachments
emailLog.setAttachments(saveNotificationAttachments(emailLog, attachments));
//
producerTemplate.sendBody("direct:emails", emailLog);
//
return emailLog;
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmEmailLogService method setEmailSent.
/**
* Persists sent date to given emailLogId
*
* @param emailLogId
* @param sent
*/
@Override
@Transactional
public void setEmailSent(UUID emailLogId, ZonedDateTime sent) {
IdmEmailLogDto emailLog = get(emailLogId);
Assert.notNull(emailLog, MessageFormat.format("Email log [id:{0}] does not exist", emailLogId));
//
LOG.debug("Persist sent date [{}] to emailLogId [{}]", sent, emailLogId);
emailLog.setSent(sent);
save(emailLog);
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmEmailLogService method setEmailSentLog.
/**
* Persists sent log to given emailLog
*
* @param emailLogId
* @param sentLog
*/
@Override
@Transactional
public void setEmailSentLog(UUID emailLogId, String sentLog) {
IdmEmailLogDto emailLog = get(emailLogId);
Assert.notNull(emailLog, MessageFormat.format("Email log [id:{0}] does not exist", emailLogId));
//
LOG.debug("Persist sent log [{}] to emailLogId [{}]", sentLog, emailLogId);
emailLog.setSentLog(sentLog);
save(emailLog);
}
Aggregations