atg.userprofiling.email
Class TemplateEmailInfo

java.lang.Object
  extended by atg.userprofiling.email.TemplateEmailInfo
Direct Known Subclasses:
TemplateEmailInfoImpl

public abstract class TemplateEmailInfo
extends java.lang.Object

An abstract class representing an object which contains all the information pertaining to a particular piece of email to be sent out, and uses that information to create and fill in the corresponding javax.mail.Message objects. The email content is based on a jhtml template, specified via the templateURL property, which can be instantiated for different user profiles.

Template email can be used to produce email messages which are personalized for different profiles. For example, the jhtml template might read:

 Dear <valueof bean="/atg/userprofiling/Profile.firstName">Customer</valueof>, 
 you've been spammed by us because...
 
When instantiated, the template will yield different message text depending on the attributes of the recipient's profile. In addition, the contents of the message can be personalized as well: if the template page contains a targeting droplet, the droplet behaves just as it would in a regular jhtml page, displaying content targeted to the current profile.

The actual rendering of the jhtml template is performed by the TemplateEmailSender service.

Note: if your template jhtml page contains links to other URLs on your site, you must specify them as absolute URLs in order for the email recipients to be able to access the linked pages. Please use the full http://server:port/... form of the URL, e.g. <img src="http://myserver:80/images/logo.gif> rather than <img src="images/logo.gif> and <a href="http://myserver:80/help/index.html>help</a> rather than <a href="help/index.html>help</a>.

See Also:
TemplateEmailInfoImpl, TemplateEmailSender, Message

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
TemplateEmailInfo()
           
 
Method Summary
 void addParameterProcessor(atg.userprofiling.email.ParameterProcessor pProcessor)
           
protected  void appendProperties(java.lang.StringBuffer pBuffer)
          Append any properties for debugging.
abstract  TemplateEmailInfo copy()
          Returns a copy of this TemplateEmailInfo.
 void copyPropertiesTo(TemplateEmailInfo pCopy)
          Copy known properties to pCopy.
 javax.mail.Message createMessage(java.lang.String pRecipient, java.lang.String[] pContents, java.lang.String[] pContentTypes)
          Creates and returns a Message object with the given email recipient and content.
abstract  javax.mail.Message createMessage(java.lang.String pRecipient, java.lang.String pContent, java.lang.String pContentType)
          Creates and returns a Message object with the given email recipient and content.
 java.lang.String getAltTemplateURL()
          Get the alternative text template URL
 java.lang.String getBatchExecutionId()
          Get the batch execution ID.
 int getBatchSize()
          Get the size of each batch...
 boolean getFillFromTemplate()
          Returns true if we should try to extract email information from the <meta> tags in the template.
 boolean getIgnoreContactFatigue()
          Whether when sending this mailing we should ignore contact fatigue
 java.util.Properties getLocaleMappedAltTemplateURLs()
          Gets a Dictionary of URLs of a jhtml files which should serve as templates for generating the alternative message text.
 java.util.Properties getLocaleMappedTemplateURLs()
          Returns a Dictionary of URLs of a jhtml files which should serve as templates for generating the message text.
 java.lang.String getMailingId()
          Returns the id for this mailing.
 java.io.File[] getMessageAttachments()
          Returns any files that should be attached to the email.
 atg.userprofiling.email.ParameterProcessor[] getParameterProcessors()
           
 java.lang.String getSiteId()
           
 java.util.Map getTemplateParameters()
          Returns the Map of parameter names and values to set when rendering the jhtml template.
 java.lang.String getTemplateURL()
          Returns the URL of a jhtml file which should serve as a template for generating the message text.
 boolean isBatched()
          Returns true if this email is batched/distributed.
 boolean isIncludeEmailInErrors()
          Returns true if includeEmailInErrors is true.
 void setAltTemplateURL(java.lang.String pAltTemplateURL)
          Set the alternative text template URL.
 void setBatched(boolean pBatched)
          Sets the flag indicating whether this email should be batched/distributed across multiple Dynamo instances.
 void setBatchExecutionId(java.lang.String pBatchExecutionId)
          Set the batch execution ID.
 void setBatchSize(int pBatchSize)
          Set the size of each batch...
 void setFillFromTemplate(boolean pFillFromTemplate)
          Sets the flag indicating whether we should try to extract email information from the <meta> tags in the template.
 void setIgnoreContactFatigue(boolean pIgnoreContactFatigue)
          Whether when sending this mailing we should ignore contact fatigue
 void setIncludeEmailInErrors(boolean pIncludeEmailInErrors)
          Set the includeEmailInErrors property .
 void setLocaleMappedAltTemplateURLs(java.util.Properties pLocaleMappedAltTemplateURLs)
          Sets a Dictionary of URLs of a jhtml files which should serve as templates for generating the alternative message text.
 void setLocaleMappedTemplateURLs(java.util.Properties pTemplateURLs)
          Sets a Dictionary of URLs of a jhtml files which should serve as templates for generating the message text.
 void setMailingId(java.lang.String pMailingId)
          Sets the id for this mailing.
 void setMessageAttachments(java.io.File[] pMessageAttachments)
          Sets any files that should be attached to the email.
 void setParameterProcessors(atg.userprofiling.email.ParameterProcessor[] pProcessors)
           
 void setSiteId(java.lang.String pSiteId)
           
 void setTemplateParameters(java.util.Map pTemplateParameters)
          Sets the Map of parameter names and values to set when rendering the jhtml template.
 void setTemplateURL(java.lang.String pTemplateURL)
          Sets the URL of a jhtml file which should serve as the template for generating the message text.
 boolean supportsMultipleContents()
          Whether or not we support creating a message with multiple contents passed in.
 java.lang.String toString()
          Override the toString() method for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

TemplateEmailInfo

public TemplateEmailInfo()
Method Detail

getTemplateURL

public java.lang.String getTemplateURL()
Returns the URL of a jhtml file which should serve as a template for generating the message text.


setTemplateURL

public void setTemplateURL(java.lang.String pTemplateURL)
Sets the URL of a jhtml file which should serve as the template for generating the message text.


setAltTemplateURL

public void setAltTemplateURL(java.lang.String pAltTemplateURL)
Set the alternative text template URL.


getAltTemplateURL

public java.lang.String getAltTemplateURL()
Get the alternative text template URL


setIncludeEmailInErrors

public void setIncludeEmailInErrors(boolean pIncludeEmailInErrors)
Set the includeEmailInErrors property .


isIncludeEmailInErrors

public boolean isIncludeEmailInErrors()
Returns true if includeEmailInErrors is true.


setBatchExecutionId

public void setBatchExecutionId(java.lang.String pBatchExecutionId)
Set the batch execution ID.


getBatchExecutionId

public java.lang.String getBatchExecutionId()
Get the batch execution ID.


getLocaleMappedTemplateURLs

public java.util.Properties getLocaleMappedTemplateURLs()
Returns a Dictionary of URLs of a jhtml files which should serve as templates for generating the message text. The Dictionary is keyed off of locale strings of the form _, e.g. en_US.


setLocaleMappedTemplateURLs

public void setLocaleMappedTemplateURLs(java.util.Properties pTemplateURLs)
Sets a Dictionary of URLs of a jhtml files which should serve as templates for generating the message text. The Dictionary is keyed off of locale strings of the form _, e.g. en_US.


setLocaleMappedAltTemplateURLs

public void setLocaleMappedAltTemplateURLs(java.util.Properties pLocaleMappedAltTemplateURLs)
Sets a Dictionary of URLs of a jhtml files which should serve as templates for generating the alternative message text. The Dictionary is keyed off of locale strings of the form _, e.g. en_US.


getLocaleMappedAltTemplateURLs

public java.util.Properties getLocaleMappedAltTemplateURLs()
Gets a Dictionary of URLs of a jhtml files which should serve as templates for generating the alternative message text. The Dictionary is keyed off of locale strings of the form _, e.g. en_US.


getTemplateParameters

public java.util.Map getTemplateParameters()
Returns the Map of parameter names and values to set when rendering the jhtml template.


setTemplateParameters

public void setTemplateParameters(java.util.Map pTemplateParameters)
Sets the Map of parameter names and values to set when rendering the jhtml template.


getFillFromTemplate

public boolean getFillFromTemplate()
Returns true if we should try to extract email information from the <meta> tags in the template.


setFillFromTemplate

public void setFillFromTemplate(boolean pFillFromTemplate)
Sets the flag indicating whether we should try to extract email information from the <meta> tags in the template. For example, the email subject or reply-to fields may be specified in the template, rather than being set explicitly in the TemplateEmailInfo object. If this flag is true, any information found in the template will override the information set in the TemplateEmailInfo.


isBatched

public boolean isBatched()
Returns true if this email is batched/distributed.


setBatched

public void setBatched(boolean pBatched)
Sets the flag indicating whether this email should be batched/distributed across multiple Dynamo instances.


setBatchSize

public void setBatchSize(int pBatchSize)
Set the size of each batch... only relevant if isBatched is true.


getBatchSize

public int getBatchSize()
Get the size of each batch... only relevant if isBatched is true.


getMailingId

public java.lang.String getMailingId()
Returns the id for this mailing.


setMailingId

public void setMailingId(java.lang.String pMailingId)
Sets the id for this mailing.


getSiteId

public java.lang.String getSiteId()
Returns:
the mSiteId

setSiteId

public void setSiteId(java.lang.String pSiteId)
Parameters:
mSiteId - the mSiteId to set

getMessageAttachments

public java.io.File[] getMessageAttachments()
Returns any files that should be attached to the email.


setMessageAttachments

public void setMessageAttachments(java.io.File[] pMessageAttachments)
Sets any files that should be attached to the email.


setIgnoreContactFatigue

public void setIgnoreContactFatigue(boolean pIgnoreContactFatigue)
Whether when sending this mailing we should ignore contact fatigue


getIgnoreContactFatigue

public boolean getIgnoreContactFatigue()
Whether when sending this mailing we should ignore contact fatigue


createMessage

public abstract javax.mail.Message createMessage(java.lang.String pRecipient,
                                                 java.lang.String pContent,
                                                 java.lang.String pContentType)
                                          throws atg.userprofiling.email.InvalidSenderAddressException,
                                                 InvalidRecipientAddressException,
                                                 TemplateEmailException
Creates and returns a Message object with the given email recipient and content.

Parameters:
pRecipient - the email address of the main recipient, corresponding to a particular profile
pContent - the message text obtained by instantiating the template for a particular profile
pContentType - the content type of the message text obtained by instantiating the template for a particular profile
Throws:
InvalidRecipientAddressException - if the recipient email address is malformed or invalid
TemplateEmailException - if any other problem is encountered while composing the Message
atg.userprofiling.email.InvalidSenderAddressException

createMessage

public javax.mail.Message createMessage(java.lang.String pRecipient,
                                        java.lang.String[] pContents,
                                        java.lang.String[] pContentTypes)
                                 throws atg.userprofiling.email.InvalidSenderAddressException,
                                        InvalidRecipientAddressException,
                                        TemplateEmailException
Creates and returns a Message object with the given email recipient and content.

Parameters:
pRecipient - the email address of the main recipient, corresponding to a particular profile
pContent - the message text obtained by instantiating the template for a particular profile
pContentType - the content type of the message text obtained by instantiating the template for a particular profile
Throws:
InvalidRecipientAddressException - if the recipient email address is malformed or invalid
TemplateEmailException - if any other problem is encountered while composing the Message
atg.userprofiling.email.InvalidSenderAddressException

supportsMultipleContents

public boolean supportsMultipleContents()
Whether or not we support creating a message with multiple contents passed in.


copy

public abstract TemplateEmailInfo copy()
Returns a copy of this TemplateEmailInfo.


copyPropertiesTo

public void copyPropertiesTo(TemplateEmailInfo pCopy)
Copy known properties to pCopy.

Parameters:
pCopy - the info to which to copy properties.

getParameterProcessors

public atg.userprofiling.email.ParameterProcessor[] getParameterProcessors()

setParameterProcessors

public void setParameterProcessors(atg.userprofiling.email.ParameterProcessor[] pProcessors)

addParameterProcessor

public void addParameterProcessor(atg.userprofiling.email.ParameterProcessor pProcessor)

appendProperties

protected void appendProperties(java.lang.StringBuffer pBuffer)
Append any properties for debugging.


toString

public java.lang.String toString()
Override the toString() method for debugging.

Overrides:
toString in class java.lang.Object