BrightSide Workbench Full Report + Source Code
org.turro.mail.provider.MailProvider Class Reference
Inheritance diagram for org.turro.mail.provider.MailProvider:
Collaboration diagram for org.turro.mail.provider.MailProvider:

Public Member Functions

String getId ()
 
void setId (String id)
 
String getHostname ()
 
void setHostname (String hostname)
 
Integer getPort ()
 
void setPort (Integer port)
 
boolean isTls ()
 
void setTls (boolean tls)
 
boolean isSsl ()
 
void setSsl (boolean ssl)
 
String getUser ()
 
void setUser (String user)
 
String getPassword ()
 
void setPassword (String password)
 
MailRecipient getFrom ()
 
void setFrom (MailRecipient from)
 
Set< MailRecipientgetReplies ()
 
void setReplies (Set< MailRecipient > replies)
 
Set< MailRecipientgetCcs ()
 
void setCcs (Set< MailRecipient > ccs)
 
Set< MailRecipientgetBccs ()
 
void setBccs (Set< MailRecipient > bccs)
 
void setupMail (HtmlEmail email) throws NamingException, EmailException
 
int compareTo (MailProvider o)
 
boolean isEmpty ()
 
void clearEmpties ()
 
int hashCode ()
 
boolean equals (Object obj)
 

Detailed Description

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

Definition at line 34 of file MailProvider.java.

Member Function Documentation

◆ clearEmpties()

void org.turro.mail.provider.MailProvider.clearEmpties ( )

Definition at line 178 of file MailProvider.java.

178  {
179  id = Strings.nullIfBlank(id);
180  hostname = Strings.nullIfBlank(hostname);
181  user = Strings.nullIfBlank(user);
182  password = Strings.nullIfBlank(password);
183  from = from.isEmpty() ? null : from;
184  if(replies != null) replies.removeIf(r -> r.isEmpty());
185  if(ccs != null) ccs.removeIf(c -> c.isEmpty());
186  if(bccs != null) bccs.removeIf(b -> b.isEmpty());
187  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareTo()

int org.turro.mail.provider.MailProvider.compareTo ( MailProvider  o)

Definition at line 168 of file MailProvider.java.

168  {
169  return Comparison.ascendant().compare(id, o.id).get();
170  }

◆ equals()

boolean org.turro.mail.provider.MailProvider.equals ( Object  obj)

Definition at line 197 of file MailProvider.java.

197  {
198  if (this == obj) {
199  return true;
200  }
201  if (obj == null) {
202  return false;
203  }
204  if (getClass() != obj.getClass()) {
205  return false;
206  }
207  final MailProvider other = (MailProvider) obj;
208  return Objects.equals(this.id, other.id);
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBccs()

Set<MailRecipient> org.turro.mail.provider.MailProvider.getBccs ( )

Definition at line 126 of file MailProvider.java.

126  {
127  return bccs;
128  }

◆ getCcs()

Set<MailRecipient> org.turro.mail.provider.MailProvider.getCcs ( )

Definition at line 118 of file MailProvider.java.

118  {
119  return ccs;
120  }

◆ getFrom()

MailRecipient org.turro.mail.provider.MailProvider.getFrom ( )

Definition at line 102 of file MailProvider.java.

102  {
103  return from;
104  }
Here is the caller graph for this function:

◆ getHostname()

String org.turro.mail.provider.MailProvider.getHostname ( )

Definition at line 54 of file MailProvider.java.

54  {
55  return hostname;
56  }

◆ getId()

String org.turro.mail.provider.MailProvider.getId ( )

Definition at line 46 of file MailProvider.java.

46  {
47  return id;
48  }
Here is the caller graph for this function:

◆ getPassword()

String org.turro.mail.provider.MailProvider.getPassword ( )

Definition at line 94 of file MailProvider.java.

94  {
95  return password;
96  }
Here is the caller graph for this function:

◆ getPort()

Integer org.turro.mail.provider.MailProvider.getPort ( )

Definition at line 62 of file MailProvider.java.

62  {
63  return port;
64  }

◆ getReplies()

Set<MailRecipient> org.turro.mail.provider.MailProvider.getReplies ( )

Definition at line 110 of file MailProvider.java.

110  {
111  return replies;
112  }

◆ getUser()

String org.turro.mail.provider.MailProvider.getUser ( )

Definition at line 86 of file MailProvider.java.

86  {
87  return user;
88  }

◆ hashCode()

int org.turro.mail.provider.MailProvider.hashCode ( )

Definition at line 190 of file MailProvider.java.

190  {
191  int hash = 7;
192  hash = 67 * hash + Objects.hashCode(this.id);
193  return hash;
194  }

◆ isEmpty()

boolean org.turro.mail.provider.MailProvider.isEmpty ( )

Definition at line 174 of file MailProvider.java.

174  {
175  return Strings.isBlank(id) || Strings.isBlank(hostname) || from.isEmpty();
176  }
Here is the call graph for this function:

◆ isSsl()

boolean org.turro.mail.provider.MailProvider.isSsl ( )

Definition at line 78 of file MailProvider.java.

78  {
79  return ssl;
80  }

◆ isTls()

boolean org.turro.mail.provider.MailProvider.isTls ( )

Definition at line 70 of file MailProvider.java.

70  {
71  return tls;
72  }

◆ setBccs()

void org.turro.mail.provider.MailProvider.setBccs ( Set< MailRecipient bccs)

Definition at line 130 of file MailProvider.java.

130  {
131  this.bccs = bccs;
132  }

◆ setCcs()

void org.turro.mail.provider.MailProvider.setCcs ( Set< MailRecipient ccs)

Definition at line 122 of file MailProvider.java.

122  {
123  this.ccs = ccs;
124  }

◆ setFrom()

void org.turro.mail.provider.MailProvider.setFrom ( MailRecipient  from)

Definition at line 106 of file MailProvider.java.

106  {
107  this.from = from;
108  }
Here is the caller graph for this function:

◆ setHostname()

void org.turro.mail.provider.MailProvider.setHostname ( String  hostname)

Definition at line 58 of file MailProvider.java.

58  {
59  this.hostname = hostname;
60  }
Here is the caller graph for this function:

◆ setId()

void org.turro.mail.provider.MailProvider.setId ( String  id)

Definition at line 50 of file MailProvider.java.

50  {
51  this.id = id;
52  }
Here is the caller graph for this function:

◆ setPassword()

void org.turro.mail.provider.MailProvider.setPassword ( String  password)

Definition at line 98 of file MailProvider.java.

98  {
99  this.password = password;
100  }
Here is the caller graph for this function:

◆ setPort()

void org.turro.mail.provider.MailProvider.setPort ( Integer  port)

Definition at line 66 of file MailProvider.java.

66  {
67  this.port = port;
68  }
Here is the caller graph for this function:

◆ setReplies()

void org.turro.mail.provider.MailProvider.setReplies ( Set< MailRecipient replies)

Definition at line 114 of file MailProvider.java.

114  {
115  this.replies = replies;
116  }

◆ setSsl()

void org.turro.mail.provider.MailProvider.setSsl ( boolean  ssl)

Definition at line 82 of file MailProvider.java.

82  {
83  this.ssl = ssl;
84  }
Here is the caller graph for this function:

◆ setTls()

void org.turro.mail.provider.MailProvider.setTls ( boolean  tls)

Definition at line 74 of file MailProvider.java.

74  {
75  this.tls = tls;
76  }
Here is the caller graph for this function:

◆ setupMail()

void org.turro.mail.provider.MailProvider.setupMail ( HtmlEmail  email) throws NamingException, EmailException

Definition at line 136 of file MailProvider.java.

136  {
137  if (hostname.startsWith("java:")) {
138  email.setMailSessionFromJNDI(hostname);
139  } else {
140  email.setHostName(hostname);
141  }
142  if(port != null) email.setSmtpPort(port);
143  if(ssl) {
144  email.setSSLOnConnect(true);
145  if(port != null) email.setSslSmtpPort(String.valueOf(port));
146  }
147  if(tls) email.setStartTLSEnabled(true);
148  if(!Strings.isBlank(user) && !Strings.isBlank(password)) {
149  email.setAuthentication(user, ElephantContext.decrypt(password));
150  }
151  if(email.getFromAddress() == null) {
152  email.setFrom(from.getMail(), from.getName(), ElephantContext.getEncoding());
153  }
154  if(replies != null) for(MailRecipient reply : replies) {
155  email.addReplyTo(reply.getMail(), reply.getName(), ElephantContext.getEncoding());
156  }
157  if(ccs != null) for(MailRecipient cc : ccs) {
158  email.addCc(cc.getMail(), cc.getName(), ElephantContext.getEncoding());
159  }
160  if(bccs != null) for(MailRecipient bcc : bccs) {
161  email.addCc(bcc.getMail(), bcc.getName(), ElephantContext.getEncoding());
162  }
163  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUser()

void org.turro.mail.provider.MailProvider.setUser ( String  user)

Definition at line 90 of file MailProvider.java.

90  {
91  this.user = user;
92  }
Here is the caller graph for this function:

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