} else if (emailWrapper.getLocale() == null) {
// Throw it again
throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
- } else if (emailWrapper.getRecipient() == null) {
+ } else if (emailWrapper.getRecipientAddress() == null) {
// Throw it again
throw new NullPointerException("emailWrapper.recipient is null"); //NOI18N
} else if (emailWrapper.getTemplateName() == null) {
// Set subject, recipients and body
message.setSubject(emailWrapper.getSubjectLine());
- message.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(emailWrapper.getRecipient().toString(), true));
+ message.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(emailWrapper.getRecipientAddress().toString(), true));
message.setSentDate(new Date());
message.setText(writer.toString());
message.setHeader("MIME-Version", "1.0"); //NOI18N
} else if (emailWrapper.getLocale() == null) {
// Throw it again
throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
- } else if (emailWrapper.getRecipient() == null) {
+ } else if (emailWrapper.getRecipientAddress() == null) {
// Throw it again
throw new NullPointerException("emailWrapper.recipient is null"); //NOI18N
} else if (emailWrapper.getTemplateName() == null) {
/**
* Recipient email address
*/
- private Address recipient;
+ private Address recipientAddress;
/**
* Subject line
*/
private Properties templateVariables;
+ /**
+ * Constructor with all required fields
+ * <p>
+ * @param recipientAddress Recipient's email address
+ * @param subjectLine Subject line (internationalized)
+ * @param templateName Template name
+ * @param templateVariables Any template variables, at least one
+ * @param locale Recipient's locale
+ */
+ public EmailDeliveryWrapper (final Address recipientAddress, final String subjectLine, final String templateName, final Properties templateVariables, final Locale locale) {
+ // Set all fields
+ this.recipientAddress = recipientAddress;
+ this.subjectLine = subjectLine;
+ this.templateName = templateName;
+ this.templateVariables = templateVariables;
+ this.locale = locale;
+ }
+
@Override
public Locale getLocale () {
return this.locale;
}
@Override
- public Address getRecipient () {
- return this.recipient;
+ public Address getRecipientAddress () {
+ return this.recipientAddress;
}
@Override
- public void setRecipient (final Address recipient) {
- this.recipient = recipient;
+ public void setRecipientAddress (final Address recipientAddress) {
+ this.recipientAddress = recipientAddress;
}
@Override
import java.io.Serializable;
import java.util.Locale;
import java.util.Properties;
-import javax.ejb.Local;
import javax.mail.Address;
/**
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@Local
public interface WrapableEmailDelivery extends Serializable {
/**
* <p>
* @return Email address recipient
*/
- Address getRecipient ();
+ Address getRecipientAddress ();
/**
* Setter for recipient email address
* <p>
* @param recipient Email address recipient
*/
- void setRecipient (final Address recipient);
+ void setRecipientAddress (final Address recipient);
/**
* Getter for optional properties