com.ibm.commerce.emarketing.engine

Class PersonalizedURLEmailContent

  • java.lang.Object
    • com.ibm.commerce.emarketing.engine.PersonalizedURLEmailContent
  • All Implemented Interfaces:
    EmailContent, PersonalizedEmailContent


    public class PersonalizedURLEmailContent
    extends java.lang.Object
    implements PersonalizedEmailContent
    An implementation of PersonalizedEmailContent which uses a struts view or a URL request to fetch the personalized e-mail message content. This class is intended for use when a JSP or other dynamic URL resource is to be the source of e-mail content. Attention should be paid to the getSubject() method and the requirements it places on URLs used for this purpose. This class uses the JSPPATH data of the e-mail template from the EMLMSG database table. The following logic is performed:
    1. Assume the data in the JSPPATH column is the name of a struts view, and that the results of the view is the e-mail to send. If the call to the view is successful, then that is the e-mail content.
    2. If the call to the view is not successful, then assume the data in the JSPPATH column is a fully qualified URL. Use a URLConnection to get the content of the e-mail.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      Copyright.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getContent()
      Gets the content of the e-mail message by making a URLConnection to the given url and using the result as the message body content.
      Recipient getRecipient()
      Gets the recipient for whom the e-mail will be personalized.
      boolean getSendEmail()
      This method gets the setting whether the e-mail should be sent to the customer.
      java.lang.Integer getStoreId()
      Returns the store ID, used by the tag engine implementation for parsing the content of e-mail message.
      java.lang.String getSubject()
      Gets the subject line from the content url.
      java.lang.String getUrl()
      Gets the view or url used to read e-mail content.
      void setContentReusable(boolean reusable)
      Sets the content of the e-mail message to be reused by subsequent calls to getContent() and getSubject().
      void setQueryStringPair(java.lang.String queryStringName, java.lang.String queryStringValue)
      Sets a name/value pair which will be added to the query string of this URLEmailContent.
      void setRecipient(Recipient recipient)
      Sets the recipient for whom the e-mail will be personalized.
      void setSendEmail(boolean newSendEmail)
      This method sets whether the e-mail should be sent to the customer.
      void setStoreId(java.lang.Integer newStoreId)
      Sets the store ID, which will be used by the TagEngine while parsing the e-mail content.
      void setUrl(java.lang.String url)
      Sets the view or url that will be used to locate the content of the email.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • PersonalizedURLEmailContent

        public PersonalizedURLEmailContent(Recipient recipient)
        Constructor that initializes this instance with a Recipient. Use this when multiple emails are to be sent to the same person.
        Parameters:
        recipient -
      • PersonalizedURLEmailContent

        public PersonalizedURLEmailContent(Recipient recipient,
                                           java.lang.String url)
        Constructor that initializes this instance with a Recipient and a view or url.
        Parameters:
        recipient - the Recipient for whom the content will be personalized.
        url - the view or url to use for retrieving content of the email.
      • PersonalizedURLEmailContent

        public PersonalizedURLEmailContent(java.lang.String url)
        Constructor that initializes this instance with a content view or url. Use this to construct a PersonalizedEmailContent implementation which can be iteratively passed recipients to which the data from the same view or url (with the recipientId query string addition) is to be sent.
        Parameters:
        url - the view or url to use when fetching e-mail content for the given recipient.
    • Method Detail

      • getContent

        public java.lang.String getContent()
        Gets the content of the e-mail message by making a URLConnection to the given url and using the result as the message body content.
        Specified by:
        getContent in interface EmailContent
        Returns:
        the content of the e-mail message
      • getSendEmail

        public boolean getSendEmail()
        This method gets the setting whether the e-mail should be sent to the customer. The e-mail should not be sent if a tag cannot generate the necessary content to put in the e-mail.
        Specified by:
        getSendEmail in interface PersonalizedEmailContent
        Returns:
        This method returns if the e-mail should be sent. The default setting for the class is true.
      • getStoreId

        public java.lang.Integer getStoreId()
        Returns the store ID, used by the tag engine implementation for parsing the content of e-mail message.
        Returns:
        The ID of the store.
      • getSubject

        public java.lang.String getSubject()
        Gets the subject line from the content url. This url request will place the name/value pair "returnSubject=true" on the query string and use the result as the subject line of the e-mail message.
        Specified by:
        getSubject in interface EmailContent
        Returns:
        The subject line.
      • getUrl

        public java.lang.String getUrl()
        Gets the view or url used to read e-mail content.
        Returns:
        the view or url.
      • setContentReusable

        public void setContentReusable(boolean reusable)
        Sets the content of the e-mail message to be reused by subsequent calls to getContent() and getSubject(). Provides performance gains when content is generic across users.
        Parameters:
        reusable - set to true, if the is reusable, false otherwise.
      • setQueryStringPair

        public void setQueryStringPair(java.lang.String queryStringName,
                                       java.lang.String queryStringValue)
        Sets a name/value pair which will be added to the query string of this URLEmailContent.
        Parameters:
        queryStringName - the name of the name/value pair to add to the query string.
        queryStringValue - the value of the name/value pair to add to the query string.
      • setRecipient

        public void setRecipient(Recipient recipient)
        Sets the recipient for whom the e-mail will be personalized.
        Specified by:
        setRecipient in interface PersonalizedEmailContent
        Parameters:
        recipient - the Recipient.
      • setSendEmail

        public void setSendEmail(boolean newSendEmail)
        This method sets whether the e-mail should be sent to the customer. The e-mail should not be sent if the entire e-mail content could not be generated. If you do not want to send the partial e-mail to the customer, then call this method with a value of false. This method should be called by the getSubject or getContent methods.
        Parameters:
        newSendEmail - Set to false if the e-mail should not be sent.
      • setStoreId

        public void setStoreId(java.lang.Integer newStoreId)
        Sets the store ID, which will be used by the TagEngine while parsing the e-mail content.
        Parameters:
        newStoreId - The ID of the store
      • setUrl

        public void setUrl(java.lang.String url)
        Sets the view or url that will be used to locate the content of the email.
        Parameters:
        url - the e-mail content view or url to use.