if (!Strings.hasText(recipient)) {
throw new IllegalArgumentException("Cannot send email: Recipient is null!");
}
BpmNotification notification = new BpmNotification();
notification.setSender(sender);
notification.setRecipient(recipient);
notification.setSubject(subject);
notification.setBody(body);
notification.setSendAsHtml(sendAsHtml);
notification.setProfileName(profileName);
StringBuilder attachmentsString = new StringBuilder();
int attachmentsSize = attachments.size();
for(String attachment: attachments)
{
attachmentsString.append(attachment);
attachmentsSize--;
if(attachmentsSize > 0)
attachmentsString.append(",");
}
notification.setAttachments(attachmentsString.toString());
NotificationsFacade.addNotificationToBeSent(notification);
history.notificationEnqueued(notification);
}