]> git.mxchange.org Git - jmailer-ee.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Fri, 7 Jul 2017 22:12:51 +0000 (00:12 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 7 Jul 2017 22:12:51 +0000 (00:12 +0200)
- 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 <roland@mxchange.org>
src/org/mxchange/jmailee/model/delivery/BaseMailer.java
src/org/mxchange/jmailee/model/delivery/wrapper/EmailDeliveryWrapper.java
src/org/mxchange/jmailee/model/delivery/wrapper/WrapableEmailDelivery.java

index c9283f8911388f0cb5e34e418215fc8a22d5fb32..88571f335ae30b626897aa633cae7d2d14136897 100644 (file)
@@ -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) {
index 28dca18193d47c88fd7d542306a759a101cdf54d..47df932bf73e0de72a227e2df446f3bc815c77da 100644 (file)
@@ -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
+        * <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;
@@ -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
index 12077f11326f3f8c28f0e860be89edbf431ae51a..ef1e6c0107fb901efadc3b3bdacca43f1c493af3 100644 (file)
@@ -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;
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@Local
 public interface WrapableEmailDelivery extends Serializable {
 
        /**
@@ -49,14 +47,14 @@ 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