BrightSide Workbench Full Report + Source Code
org.turro.mail.sender.AbstractMailSender Class Referenceabstract
Inheritance diagram for org.turro.mail.sender.AbstractMailSender:
Collaboration diagram for org.turro.mail.sender.AbstractMailSender:

Public Member Functions

IMailSender setCategory (String idCategory)
 
IMailSender setReason (String reason)
 
IMailSender setPool (String pool)
 
IMailSender setFrom (IContact from)
 
IMailSender setRoot (String root)
 
IMailSender addAdministrators ()
 
IMailSender addBySyndication (String syndication)
 
IMailSender addByRole (String role)
 
IMailSender addByEntity (Object entity, Object data)
 
IMailSender addByEntity (Object entity, boolean deep, Object data)
 
IMailSender addByEntity (String path, Object data)
 
IMailSender addByEntity (String path, boolean deep, Object data)
 
IMailSender addContact (IContact contact)
 
IMailSender addContacts (Collection< IContact > contacts)
 
IMailSender addAssistant (Assistant assistant)
 
IMailSender addAssistants (AssistantSet assistants)
 
IMailSender addUser (String name, String email)
 
IMailSender addAttachment (File file)
 
IMailSender addAttachments (Collection< File > files)
 
IMailSender addMailAttachments (Collection< MailAttachment > mas)
 
IMailSender onStart (Consumer command)
 
IMailSender onCancel (Consumer command)
 
IMailSender onBuild (Consumer command)
 
IMailSender onFinish (Consumer command)
 
AssistantSet getAssistants ()
 
void removeAttachments ()
 
IMailSender putIf (Object key, Supplier< Boolean > condition, Supplier value)
 
IMailSender put (Object key, Object value)
 
IMailSender putAll (Map attributes)
 
void send (String subject, String message)
 
void send (NotificationCategory category, String subject, String message)
 
void sendTemplate (String template, String subject) throws EmailException
 
void sendTemplate (Object entity, String template, String subject) throws EmailException
 
void sendTemplate (NotificationCategory category, Object entity, String template, String subject) throws EmailException
 
void silentSendTemplate (String template, String subject)
 
void silentSendTemplate (Object entity, String template, String subject)
 
void silentSendTemplate (NotificationCategory category, Object entity, String template, String subject)
 
String processMacros (IContact contact, String text, boolean web)
 
- Public Member Functions inherited from org.turro.action.IContactSender< IMailSender >
addAdministrators ()
 
addByEntity (Object entity, Object data)
 
addByEntity (Object entity, boolean deep, Object data)
 
addByEntity (String path, Object data)
 
addByEntity (String path, boolean deep, Object data)
 
addByRole (String role)
 
addBySyndication (String syndication)
 
addContact (IContact contact)
 
addContacts (Collection< IContact > contacts)
 
addAssistant (Assistant assistant)
 
addAssistants (AssistantSet assistants)
 
addUser (String name, String email)
 
AssistantSet getAssistants ()
 
default void copyFrom (IContactSender sender)
 

Public Attributes

final AssistantSet assistants = new AssistantSet()
 

Protected Member Functions

boolean isFromValid ()
 
String getFromString ()
 
Map getAttributes ()
 
abstract void doSend (NotificationCategory category, String subject, String message)
 
abstract void doSendTemplate (NotificationCategory category, Object entity, String template, String subject) throws EmailException
 

Protected Attributes

String defaultCategory = GenericElephantNotification.SYSTEM_NOTIFICATION
 
String reason
 
Set< File > attachments = new HashSet<>()
 
Set< MailAttachmentmailAttachments = new HashSet<>()
 
Consumer onStart
 
IContact from
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 51 of file AbstractMailSender.java.

Member Function Documentation

◆ addAdministrators()

IMailSender org.turro.mail.sender.AbstractMailSender.addAdministrators ( )

Definition at line 107 of file AbstractMailSender.java.

107  {
108  addBySyndication(SecurityGroup.BRIGHTSIDE_ADMIN);
109  return this;
110  }
IMailSender addBySyndication(String syndication)
Here is the call graph for this function:

◆ addAssistant()

IMailSender org.turro.mail.sender.AbstractMailSender.addAssistant ( Assistant  assistant)

Definition at line 161 of file AbstractMailSender.java.

161  {
162  this.assistants.add(assistant);
163  return this;
164  }

◆ addAssistants()

IMailSender org.turro.mail.sender.AbstractMailSender.addAssistants ( AssistantSet  assistants)

Definition at line 167 of file AbstractMailSender.java.

167  {
168  for(Assistant assistant : assistants) {
169  this.assistants.add(assistant);
170  }
171  return this;
172  }

◆ addAttachment()

IMailSender org.turro.mail.sender.AbstractMailSender.addAttachment ( File  file)

Implements org.turro.action.IMailSender.

Definition at line 182 of file AbstractMailSender.java.

182  {
183  attachments.add(file);
184  return this;
185  }

◆ addAttachments()

IMailSender org.turro.mail.sender.AbstractMailSender.addAttachments ( Collection< File >  files)

Implements org.turro.action.IMailSender.

Definition at line 188 of file AbstractMailSender.java.

188  {
189  attachments.addAll(files);
190  return this;
191  }

◆ addByEntity() [1/4]

IMailSender org.turro.mail.sender.AbstractMailSender.addByEntity ( Object  entity,
boolean  deep,
Object  data 
)

Definition at line 131 of file AbstractMailSender.java.

131  {
132  addByEntity(Entities.getController(entity).getPath(), deep, data);
133  return this;
134  }
IMailSender addByEntity(Object entity, Object data)
Here is the call graph for this function:

◆ addByEntity() [2/4]

IMailSender org.turro.mail.sender.AbstractMailSender.addByEntity ( Object  entity,
Object  data 
)

Definition at line 125 of file AbstractMailSender.java.

125  {
126  addByEntity(entity, true, data);
127  return this;
128  }
Here is the caller graph for this function:

◆ addByEntity() [3/4]

IMailSender org.turro.mail.sender.AbstractMailSender.addByEntity ( String  path,
boolean  deep,
Object  data 
)

Definition at line 143 of file AbstractMailSender.java.

143  {
144  Assistants.addAssistants(path, true, assistants, data);
145  return this;
146  }
Here is the call graph for this function:

◆ addByEntity() [4/4]

IMailSender org.turro.mail.sender.AbstractMailSender.addByEntity ( String  path,
Object  data 
)

Definition at line 137 of file AbstractMailSender.java.

137  {
138  addByEntity(path, true, data);
139  return this;
140  }
Here is the call graph for this function:

◆ addByRole()

IMailSender org.turro.mail.sender.AbstractMailSender.addByRole ( String  role)

Definition at line 119 of file AbstractMailSender.java.

119  {
120  assistants.addContacts(Contacts.getByRole(role));
121  return this;
122  }
void addContacts(Collection< IContact > contacts)
Here is the call graph for this function:

◆ addBySyndication()

IMailSender org.turro.mail.sender.AbstractMailSender.addBySyndication ( String  syndication)

Definition at line 113 of file AbstractMailSender.java.

113  {
114  assistants.addContacts(Contacts.getBySyndication(syndication));
115  return this;
116  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addContact()

IMailSender org.turro.mail.sender.AbstractMailSender.addContact ( IContact  contact)

Definition at line 149 of file AbstractMailSender.java.

149  {
150  assistants.addContact(contact, null);
151  return this;
152  }
void addContact(IContact contact, Object relationEntity)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addContacts()

IMailSender org.turro.mail.sender.AbstractMailSender.addContacts ( Collection< IContact contacts)

Definition at line 155 of file AbstractMailSender.java.

155  {
156  assistants.addContacts(contacts);
157  return this;
158  }
Here is the call graph for this function:

◆ addMailAttachments()

IMailSender org.turro.mail.sender.AbstractMailSender.addMailAttachments ( Collection< MailAttachment mas)

Implements org.turro.action.IMailSender.

Definition at line 194 of file AbstractMailSender.java.

194  {
195  mailAttachments.addAll(mas);
196  return this;
197  }

◆ addUser()

IMailSender org.turro.mail.sender.AbstractMailSender.addUser ( String  name,
String  email 
)

Definition at line 175 of file AbstractMailSender.java.

175  {
176  assistants.addUser(name, email, null);
177  return this;
178  }
void addUser(String name, String email, Object relationEntity)
Here is the call graph for this function:

◆ doSend()

abstract void org.turro.mail.sender.AbstractMailSender.doSend ( NotificationCategory  category,
String  subject,
String  message 
)
abstractprotected

◆ doSendTemplate()

abstract void org.turro.mail.sender.AbstractMailSender.doSendTemplate ( NotificationCategory  category,
Object  entity,
String  template,
String  subject 
) throws EmailException
abstractprotected

◆ getAssistants()

AssistantSet org.turro.mail.sender.AbstractMailSender.getAssistants ( )

Definition at line 224 of file AbstractMailSender.java.

224  {
225  return assistants;
226  }

◆ getAttributes()

Map org.turro.mail.sender.AbstractMailSender.getAttributes ( )
protected

Definition at line 257 of file AbstractMailSender.java.

257  {
258  return attributes;
259  }

◆ getFromString()

String org.turro.mail.sender.AbstractMailSender.getFromString ( )
protected

Definition at line 90 of file AbstractMailSender.java.

Here is the call graph for this function:

◆ isFromValid()

boolean org.turro.mail.sender.AbstractMailSender.isFromValid ( )
protected

Definition at line 86 of file AbstractMailSender.java.

86  {
87  return from != null && from.isWebUser();
88  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onBuild()

IMailSender org.turro.mail.sender.AbstractMailSender.onBuild ( Consumer  command)

Implements org.turro.action.IMailSender.

Definition at line 212 of file AbstractMailSender.java.

212  {
213  onBuild = command;
214  return this;
215  }

◆ onCancel()

IMailSender org.turro.mail.sender.AbstractMailSender.onCancel ( Consumer  command)

Implements org.turro.action.IMailSender.

Definition at line 206 of file AbstractMailSender.java.

206  {
207  onCancel = command;
208  return this;
209  }

◆ onFinish()

IMailSender org.turro.mail.sender.AbstractMailSender.onFinish ( Consumer  command)

Implements org.turro.action.IMailSender.

Definition at line 218 of file AbstractMailSender.java.

218  {
219  onFinish = command;
220  return this;
221  }

◆ onStart()

IMailSender org.turro.mail.sender.AbstractMailSender.onStart ( Consumer  command)

Implements org.turro.action.IMailSender.

Definition at line 200 of file AbstractMailSender.java.

200  {
201  onStart = command;
202  return this;
203  }

◆ processMacros()

String org.turro.mail.sender.AbstractMailSender.processMacros ( IContact  contact,
String  text,
boolean  web 
)

Implements org.turro.action.IMailSender.

Definition at line 328 of file AbstractMailSender.java.

328  {
329  return web ? MailUtils.processMacrosForWeb(contact, text) :
330  MailUtils.processMacros(contact, text);
331  }
Here is the call graph for this function:

◆ put()

IMailSender org.turro.mail.sender.AbstractMailSender.put ( Object  key,
Object  value 
)

Implements org.turro.action.IMailSender.

Definition at line 246 of file AbstractMailSender.java.

246  {
247  if(key != null && value != null) attributes.put(key, value);
248  return this;
249  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ putAll()

IMailSender org.turro.mail.sender.AbstractMailSender.putAll ( Map  attributes)

Implements org.turro.action.IMailSender.

Definition at line 252 of file AbstractMailSender.java.

252  {
253  this.attributes.putAll(attributes);
254  return this;
255  }
Here is the call graph for this function:

◆ putIf()

IMailSender org.turro.mail.sender.AbstractMailSender.putIf ( Object  key,
Supplier< Boolean >  condition,
Supplier  value 
)

Implements org.turro.action.IMailSender.

Definition at line 240 of file AbstractMailSender.java.

240  {
241  if(condition.get()) put(key, value.get());
242  return this;
243  }
IMailSender put(Object key, Object value)
Here is the call graph for this function:

◆ removeAttachments()

void org.turro.mail.sender.AbstractMailSender.removeAttachments ( )

Implements org.turro.action.IMailSender.

Definition at line 229 of file AbstractMailSender.java.

229  {
230  attachments.forEach(file -> {
231  file.delete();
232  });
233  }

◆ send() [1/2]

void org.turro.mail.sender.AbstractMailSender.send ( NotificationCategory  category,
String  subject,
String  message 
)

Implements org.turro.action.IMailSender.

Definition at line 270 of file AbstractMailSender.java.

270  {
271  doSend(category, subject, message);
272  }
abstract void doSend(NotificationCategory category, String subject, String message)

◆ send() [2/2]

void org.turro.mail.sender.AbstractMailSender.send ( String  subject,
String  message 
)

Implements org.turro.action.IMailSender.

Definition at line 264 of file AbstractMailSender.java.

264  {
265  NotificationCategory category = Notifications.getCategory(defaultCategory);
266  send(category, subject, message);
267  }
void send(String subject, String message)

◆ sendTemplate() [1/3]

void org.turro.mail.sender.AbstractMailSender.sendTemplate ( NotificationCategory  category,
Object  entity,
String  template,
String  subject 
) throws EmailException

Implements org.turro.action.IMailSender.

Definition at line 291 of file AbstractMailSender.java.

291  {
292  doSendTemplate(category, entity, template, subject);
293  }
abstract void doSendTemplate(NotificationCategory category, Object entity, String template, String subject)

◆ sendTemplate() [2/3]

void org.turro.mail.sender.AbstractMailSender.sendTemplate ( Object  entity,
String  template,
String  subject 
) throws EmailException

Implements org.turro.action.IMailSender.

Definition at line 285 of file AbstractMailSender.java.

285  {
286  NotificationCategory category = Notifications.getCategory(defaultCategory);
287  sendTemplate(category, entity, template, subject);
288  }
void sendTemplate(String template, String subject)

◆ sendTemplate() [3/3]

void org.turro.mail.sender.AbstractMailSender.sendTemplate ( String  template,
String  subject 
) throws EmailException

Implements org.turro.action.IMailSender.

Definition at line 279 of file AbstractMailSender.java.

279  {
280  NotificationCategory category = Notifications.getCategory(defaultCategory);
281  sendTemplate(category, null, template, subject);
282  }

◆ setCategory()

IMailSender org.turro.mail.sender.AbstractMailSender.setCategory ( String  idCategory)

Implements org.turro.action.IMailSender.

Definition at line 63 of file AbstractMailSender.java.

63  {
64  defaultCategory = idCategory;
65  return this;
66  }

◆ setFrom()

IMailSender org.turro.mail.sender.AbstractMailSender.setFrom ( IContact  from)

Implements org.turro.action.IMailSender.

Definition at line 81 of file AbstractMailSender.java.

81  {
82  this.from = from;
83  return this;
84  }

◆ setPool()

IMailSender org.turro.mail.sender.AbstractMailSender.setPool ( String  pool)

Implements org.turro.action.IMailSender.

Definition at line 75 of file AbstractMailSender.java.

75  {
76  this.pool = pool;
77  return this;
78  }

◆ setReason()

IMailSender org.turro.mail.sender.AbstractMailSender.setReason ( String  reason)

Implements org.turro.action.IMailSender.

Definition at line 69 of file AbstractMailSender.java.

69  {
70  this.reason = reason;
71  return this;
72  }

◆ setRoot()

IMailSender org.turro.mail.sender.AbstractMailSender.setRoot ( String  root)
Parameters
rootTemplates' root on templates-mail/content. Defaults to / and must be prepended with a slash.
Returns

Implements org.turro.action.IMailSender.

Definition at line 101 of file AbstractMailSender.java.

101  {
102  this.root = root;
103  return this;
104  }
Here is the caller graph for this function:

◆ silentSendTemplate() [1/3]

void org.turro.mail.sender.AbstractMailSender.silentSendTemplate ( NotificationCategory  category,
Object  entity,
String  template,
String  subject 
)

Implements org.turro.action.IMailSender.

Definition at line 314 of file AbstractMailSender.java.

314  {
315  try {
316  sendTemplate(category, entity, template, subject);
317  } catch (EmailException ex) {
318  Logger.getLogger(AbstractMailSender.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
319  }
320  }

◆ silentSendTemplate() [2/3]

void org.turro.mail.sender.AbstractMailSender.silentSendTemplate ( Object  entity,
String  template,
String  subject 
)

Implements org.turro.action.IMailSender.

Definition at line 305 of file AbstractMailSender.java.

305  {
306  try {
307  sendTemplate(entity, template, subject);
308  } catch (EmailException ex) {
309  Logger.getLogger(AbstractMailSender.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
310  }
311  }

◆ silentSendTemplate() [3/3]

void org.turro.mail.sender.AbstractMailSender.silentSendTemplate ( String  template,
String  subject 
)

Implements org.turro.action.IMailSender.

Definition at line 296 of file AbstractMailSender.java.

296  {
297  try {
298  sendTemplate(template, subject);
299  } catch (EmailException ex) {
300  Logger.getLogger(AbstractMailSender.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
301  }
302  }

Member Data Documentation

◆ assistants

final AssistantSet org.turro.mail.sender.AbstractMailSender.assistants = new AssistantSet()

Definition at line 53 of file AbstractMailSender.java.

◆ attachments

Set<File> org.turro.mail.sender.AbstractMailSender.attachments = new HashSet<>()
protected

Definition at line 57 of file AbstractMailSender.java.

◆ defaultCategory

String org.turro.mail.sender.AbstractMailSender.defaultCategory = GenericElephantNotification.SYSTEM_NOTIFICATION
protected

Definition at line 55 of file AbstractMailSender.java.

◆ from

IContact org.turro.mail.sender.AbstractMailSender.from
protected

Definition at line 60 of file AbstractMailSender.java.

◆ mailAttachments

Set<MailAttachment> org.turro.mail.sender.AbstractMailSender.mailAttachments = new HashSet<>()
protected

Definition at line 58 of file AbstractMailSender.java.

◆ onStart

Consumer org.turro.mail.sender.AbstractMailSender.onStart
protected

Definition at line 59 of file AbstractMailSender.java.

◆ reason

String org.turro.mail.sender.AbstractMailSender.reason
protected

Definition at line 56 of file AbstractMailSender.java.


The documentation for this class was generated from the following file: