From: Roland Häder Date: Fri, 7 Jul 2017 22:12:51 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=549550522c5ce224b6629be517837c3ae1e2b4f2;p=jmailer-ee.git Continued a bit: - removed @Local as this is no local EJB interface - renamed field recipient to recipientAddress - added new constructor with all required fields Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java index c9283f8..88571f3 100644 --- a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java +++ b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java @@ -146,7 +146,7 @@ public abstract class BaseMailer implements DeliverableEmail { } 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) { @@ -180,7 +180,7 @@ public abstract class BaseMailer implements DeliverableEmail { // 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 @@ -245,7 +245,7 @@ public abstract class BaseMailer implements DeliverableEmail { } 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) { diff --git a/src/org/mxchange/jmailee/model/delivery/wrapper/EmailDeliveryWrapper.java b/src/org/mxchange/jmailee/model/delivery/wrapper/EmailDeliveryWrapper.java index 28dca18..47df932 100644 --- a/src/org/mxchange/jmailee/model/delivery/wrapper/EmailDeliveryWrapper.java +++ b/src/org/mxchange/jmailee/model/delivery/wrapper/EmailDeliveryWrapper.java @@ -40,7 +40,7 @@ public class EmailDeliveryWrapper implements WrapableEmailDelivery { /** * Recipient email address */ - private Address recipient; + private Address recipientAddress; /** * Subject line @@ -57,6 +57,24 @@ public class EmailDeliveryWrapper implements WrapableEmailDelivery { */ private Properties templateVariables; + /** + * Constructor with all required fields + *

+ * @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; @@ -68,13 +86,13 @@ public class EmailDeliveryWrapper implements WrapableEmailDelivery { } @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 diff --git a/src/org/mxchange/jmailee/model/delivery/wrapper/WrapableEmailDelivery.java b/src/org/mxchange/jmailee/model/delivery/wrapper/WrapableEmailDelivery.java index 12077f1..ef1e6c0 100644 --- a/src/org/mxchange/jmailee/model/delivery/wrapper/WrapableEmailDelivery.java +++ b/src/org/mxchange/jmailee/model/delivery/wrapper/WrapableEmailDelivery.java @@ -19,7 +19,6 @@ package org.mxchange.jmailee.model.delivery.wrapper; import java.io.Serializable; import java.util.Locale; import java.util.Properties; -import javax.ejb.Local; import javax.mail.Address; /** @@ -27,7 +26,6 @@ import javax.mail.Address; *

* @author Roland Häder */ -@Local public interface WrapableEmailDelivery extends Serializable { /** @@ -49,14 +47,14 @@ public interface WrapableEmailDelivery extends Serializable { *

* @return Email address recipient */ - Address getRecipient (); + Address getRecipientAddress (); /** * Setter for recipient email address *

* @param recipient Email address recipient */ - void setRecipient (final Address recipient); + void setRecipientAddress (final Address recipient); /** * Getter for optional properties