19 package org.turro.mail.sender;
22 import java.util.Collection;
23 import java.util.HashMap;
24 import java.util.HashSet;
27 import java.util.function.Consumer;
28 import java.util.function.Supplier;
29 import java.util.logging.Level;
30 import java.util.logging.Logger;
31 import org.apache.commons.mail.EmailException;
32 import org.turro.action.Contacts;
33 import org.turro.action.IMailSender;
34 import org.turro.action.MailAttachment;
35 import org.turro.action.queue.NotificationCategory;
36 import org.turro.action.queue.Notifications;
37 import org.turro.assistant.Assistant;
38 import org.turro.assistant.AssistantSet;
39 import org.turro.assistant.Assistants;
40 import org.turro.elephant.context.ElephantContext;
41 import org.turro.entities.Entities;
42 import org.turro.mail.message.MailUtils;
43 import org.turro.mail.queue.GenericElephantNotification;
44 import org.turro.plugin.contacts.IContact;
45 import org.turro.security.SecurityGroup;
59 protected Consumer
onStart, onCancel, onBuild, onFinish;
162 this.assistants.add(assistant);
169 this.assistants.add(assistant);
237 private final Map attributes =
new HashMap();
241 if(condition.get())
put(key, value.get());
247 if(key !=
null && value !=
null) attributes.
put(key, value);
253 this.attributes.
putAll(attributes);
264 public void send(String subject, String message) {
266 send(category, subject, message);
271 doSend(category, subject, message);
279 public void sendTemplate(String
template, String subject)
throws EmailException {
285 public void sendTemplate(Object entity, String
template, String subject)
throws EmailException {
299 }
catch (EmailException ex) {
308 }
catch (EmailException ex) {
317 }
catch (EmailException ex) {
323 String subject)
throws EmailException;
static NotificationCategory getCategory(String id)
void addUser(String name, String email, Object relationEntity)
void addContacts(Collection< IContact > contacts)
void addContact(IContact contact, Object relationEntity)
static void addAssistants(String role, AssistantSet list, Object data)
static String logMsg(String msg)
static IElephantEntity getController(String path)
static String processMacros(IContact contact, String message)
static String processMacrosForWeb(IContact contact, String message)
void silentSendTemplate(NotificationCategory category, Object entity, String template, String subject)
IMailSender onBuild(Consumer command)
IMailSender addByEntity(String path, boolean deep, Object data)
void send(NotificationCategory category, String subject, String message)
IMailSender addByRole(String role)
IMailSender addAdministrators()
abstract void doSend(NotificationCategory category, String subject, String message)
IMailSender onCancel(Consumer command)
abstract void doSendTemplate(NotificationCategory category, Object entity, String template, String subject)
IMailSender setCategory(String idCategory)
IMailSender put(Object key, Object value)
IMailSender setPool(String pool)
IMailSender addAssistants(AssistantSet assistants)
IMailSender addAttachment(File file)
IMailSender onStart(Consumer command)
void silentSendTemplate(String template, String subject)
String processMacros(IContact contact, String text, boolean web)
IMailSender addByEntity(Object entity, boolean deep, Object data)
IMailSender setFrom(IContact from)
void silentSendTemplate(Object entity, String template, String subject)
void send(String subject, String message)
IMailSender putIf(Object key, Supplier< Boolean > condition, Supplier value)
IMailSender addContacts(Collection< IContact > contacts)
final AssistantSet assistants
void sendTemplate(NotificationCategory category, Object entity, String template, String subject)
IMailSender addAssistant(Assistant assistant)
IMailSender addMailAttachments(Collection< MailAttachment > mas)
IMailSender setRoot(String root)
IMailSender addByEntity(Object entity, Object data)
IMailSender addUser(String name, String email)
IMailSender addBySyndication(String syndication)
void sendTemplate(String template, String subject)
IMailSender setReason(String reason)
IMailSender addByEntity(String path, Object data)
AssistantSet getAssistants()
IMailSender putAll(Map attributes)
Set< MailAttachment > mailAttachments
IMailSender addContact(IContact contact)
IMailSender onFinish(Consumer command)
IMailSender addAttachments(Collection< File > files)
void sendTemplate(Object entity, String template, String subject)
IMailSender put(Object key, Object value)
IMailSender putAll(Map attributes)