use of de.symeda.sormas.api.messaging.MessageType in project SORMAS-Project by hzi-braunschweig.
the class MessagingService method sendManualMessage.
public void sendManualMessage(Person recipient, String subject, String messageContent, MessageType... messageTypes) throws NotificationDeliveryFailedException {
final String emailAddress = recipient.getEmailAddress();
final String phoneNumber = recipient.getPhone();
final String recipientUuid = recipient.getUuid();
final String recipientType = "person";
for (MessageType messageType : messageTypes) {
if (messageType == MessageType.EMAIL) {
sendEmail(subject, messageContent, emailAddress, recipientUuid, recipientType);
} else if (messageType == MessageType.SMS) {
sendSms(subject, messageContent, phoneNumber, recipientUuid, recipientType);
}
final ManualMessageLog manualMessageLog = new ManualMessageLog();
manualMessageLog.setMessageType(messageType);
manualMessageLog.setRecipientPerson(recipient);
manualMessageLog.setSendingUser(userService.getCurrentUser());
manualMessageLog.setSentDate(new Date());
manualMessageLogService.ensurePersisted(manualMessageLog);
}
}
Aggregations