atg.projects.store.email
Class StoreEmailTools

java.lang.Object
  extended by atg.projects.store.email.StoreEmailTools
Direct Known Subclasses:
TesterEmailTools

public class StoreEmailTools
extends java.lang.Object

This utility class defines various utility methods that are used by Store for processing email.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String EMAIL_SUBJECT
          Resource key for e-mail subject.
static java.lang.String MSG_EMPTY_MESSAGE
          Empty message body message key.
static java.lang.String MSG_EMPTY_SUBJECT
          Subject is empty message key.
static java.lang.String MSG_ERR_BAD_EMAIL
          Invalid e-mail address constant.
static java.lang.String MSG_ERR_CREATING_EMAIL_RECIPIENT
          Error creating e-mail recipient message key.
static java.lang.String MSG_INVALID_RECIPIENT_EMAIL
          Invalid recipient address message key.
static java.lang.String MSG_INVALID_RECIPIENT_EMAIL_FORMAT
          Resource key for invalid recipient e-mail format.
static java.lang.String MSG_INVALID_SENDER_EMAIL
          Invalid sender message key.
static java.lang.String MSG_INVALID_SENDER_EMAIL_FORMAT
          Resource key for invalid sender e-mail format.
static java.lang.String MSG_NO_EMAIL_HOST_NAME
          Host name is missing message key.
static java.lang.String MSG_NO_RECIPIENT_EMAIL
          Missing recipient address message key.
static java.lang.String MSG_NO_SENDER_EMAIL
          No sender address message key.
static java.lang.String MSG_NO_SENDER_FIRST_NAME
          Sender first name is missing message key.
static java.lang.String MSG_NO_SENDER_LAST_NAME
          Sender last name is missing message key.
protected  atg.projects.store.multisite.StoreSitePropertiesManager mStoreSitePropertiesManager
           
static int STATUS_ERROR_REDIRECT
          Constant used to indicate that the form has errors, and that the form should perform a redirect.
static int STATUS_ERROR_STAY
          Constant used to indicate that the form has errors, and that the form should not perform a redirect.
static int STATUS_SUCCESS
          Constant used to indicate that the form has no errors.
 
Constructor Summary
StoreEmailTools()
           
 
Method Summary
protected  java.util.List addRecipients(atg.userprofiling.Profile pProfile, atg.userprofiling.email.TemplateEmailInfoImpl emailInfo)
          Returns list of recipients
 java.lang.String createQualifiedString(java.lang.String pName, java.lang.String pEmail)
          Create string of view: pName<pEmail>
 java.lang.String createSender(java.lang.String pFirstName, java.lang.String pLastName, java.lang.String pEmail)
          Compose the sender tag as: pFirstName pLastName
 atg.repository.MutableRepository getCatalogRepository()
          Gets the value of the catalogRepository field.
 atg.userprofiling.email.TemplateEmailInfo getDefaultEmailInfo()
          Gets the default email information.
 java.lang.String getDefaultLocaleString()
           
 java.lang.String getDisplayNamePropertyName()
          Gets the name of the Display Name property.
 java.util.ResourceBundle getEmailAFriendResourceBundle()
           
 java.lang.String getEmailAFriendResourceBundleName()
           
 atg.userprofiling.email.TemplateEmailSender getEmailSender()
          Gets the email send component.
 java.lang.String getLocaleParamName()
           
 java.lang.String getMessageParamName()
          Gets the name of the parameter used for the Message: field.
 java.lang.String getProductIdParamName()
          Gets the name of the parameter used for the ProductId: field.
 java.lang.String getProductItemName()
          Gets the name of the product item.
 java.lang.String getProfileParamName()
          Gets the name of the parameter used to send the current user profile to the template.
 StoreProfileTools getProfileTools()
           
 java.util.ArrayList<java.lang.String> getPromoTemplateUrls()
           
 StorePropertyManager getPropertyManager()
           
 java.lang.String getRecipientEmailParamName()
          Gets the name of the Email value used for the To: field.
 java.lang.String getRecipientNameParamName()
          Gets the name of the Name value used for the To: field.
 java.lang.String getSenderEmailParamName()
          Gets the name of the Email value used for the From: field.
 java.lang.String getSenderNameParamName()
          Gets the name of the Name value used for the From: field.
 java.lang.String getSiteIdParamName()
           
 StoreConfiguration getStoreConfiguration()
           
 java.lang.String getStoreNameResource()
           
 atg.projects.store.multisite.StoreSitePropertiesManager getStoreSitePropertiesManager()
           
protected  java.lang.String getSubject(java.lang.String pProductId)
          Compute the subject for the email message with Product Name as part of subject.
 java.lang.String getSubjectParamName()
          Gets the name of the parameter used for the Subject: field.
 java.lang.String getTemplateUrl()
          Gets the URL for the email template used to send the email.
 java.lang.String getTemplateUrlName()
           
 javax.transaction.TransactionManager getTransactionManager()
          Transaction Manager
 boolean isPersistEmails()
           
 boolean isSendEmailInSeparateThread()
           
 atg.userprofiling.email.TemplateEmailInfoImpl prepareEmailInfo(java.util.Map pEmailParams)
          Prepare email info template.
 java.util.Map prepareEmailInfoParams(atg.userprofiling.Profile pProfile, atg.userprofiling.email.TemplateEmailInfoImpl pEmailInfo, java.util.Map pEmailParams)
          Prepare email parameters before sending
 void sendEmail(atg.userprofiling.Profile pProfile, java.util.Map pEmailParams)
          Prepare email and send it.
 void setCatalogRepository(atg.repository.MutableRepository pCatalogRepository)
          Sets the value of the catalogRepository: field.
 void setDefaultEmailInfo(atg.userprofiling.email.TemplateEmailInfo pDefaultEmailInfo)
          Sets the default email information.
 void setDefaultLocale(java.lang.String pDefaultLocale)
           
 void setDisplayNamePropertyName(java.lang.String pDisplayNamePropertyName)
          Sets the name of the Display Name property.
 void setEmailAFriendResourceBundleName(java.lang.String pEmailAFriendResourceBundleName)
           
 void setEmailSender(atg.userprofiling.email.TemplateEmailSender pEmailSender)
          Sets the email send component.
 void setLocaleParamName(java.lang.String pLocaleParamName)
           
 void setMessageParamName(java.lang.String pMessageParamName)
          Sets the name of the parameter used for the Message: field.
 void setPersistEmails(boolean pPersistEmails)
          Sets boolean indicating whether the email is persisted before it is sent.
 void setProductIdParamName(java.lang.String pProductIdParamName)
          Sets the name of the parameter used for the ProductId: field.
 void setProductItemName(java.lang.String pProductItemName)
          Sets the name of the product item.
 void setProfileParamName(java.lang.String pProfileParamName)
          Sets the name of the parameter used to send the current user profile to the template.
 void setProfileTools(StoreProfileTools pProfileTools)
           
 void setPromoTemplateUrls(java.util.ArrayList<java.lang.String> pPromoTemplateUrls)
           
 void setPropertyManager(StorePropertyManager pPropertyManager)
           
 void setRecipientEmailParamName(java.lang.String pRecipientEmailParamName)
          Sets the name of the Email value used for the To: field.
 void setRecipientNameParamName(java.lang.String pRecipientNameParamName)
          Sets the name of the Name value used for the To: field.
 void setSendEmailInSeparateThread(boolean pSendEmailInSeparateThread)
          Sets boolean indicating whether the email is sent in a separate thread.
 void setSenderEmailParamName(java.lang.String pSenderEmailParamName)
          Sets the name of the Email value used for the From: field.
 void setSenderNameParamName(java.lang.String pSenderNameParamName)
          Sets the name of the Name value used for the From: field.
 void setSiteIdParamName(java.lang.String pSiteIdParamName)
          The siteId parameter name - it represents the Site ID from which the email is dispatched parameter to be used in Email template
 void setStoreConfiguration(StoreConfiguration pStoreConfiguration)
           
 void setStoreNameResource(java.lang.String pStoreNameResource)
           
 void setStoreSitePropertiesManager(atg.projects.store.multisite.StoreSitePropertiesManager pStoreSitePropertiesManager)
           
 void setSubjectParamName(java.lang.String pSubjectParamName)
          Sets the name of the parameter used for the Subject: field.
 void setTemplateUrl(java.lang.String pTemplateUrl)
          Sets the URL for the email template used to send the email.
 void setTemplateUrlName(java.lang.String pTemplateUrlName)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets the Transaction Manager.
 boolean validateEmailAddress(java.lang.String pEmailAddress)
          Check to see if Email format is correct.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


STATUS_SUCCESS

public static final int STATUS_SUCCESS
Constant used to indicate that the form has no errors. *

See Also:
Constant Field Values

STATUS_ERROR_STAY

public static final int STATUS_ERROR_STAY
Constant used to indicate that the form has errors, and that the form should not perform a redirect.

See Also:
Constant Field Values

STATUS_ERROR_REDIRECT

public static final int STATUS_ERROR_REDIRECT
Constant used to indicate that the form has errors, and that the form should perform a redirect.

See Also:
Constant Field Values

MSG_INVALID_RECIPIENT_EMAIL_FORMAT

public static final java.lang.String MSG_INVALID_RECIPIENT_EMAIL_FORMAT
Resource key for invalid recipient e-mail format.

See Also:
Constant Field Values

MSG_INVALID_SENDER_EMAIL_FORMAT

public static final java.lang.String MSG_INVALID_SENDER_EMAIL_FORMAT
Resource key for invalid sender e-mail format.

See Also:
Constant Field Values

EMAIL_SUBJECT

public static final java.lang.String EMAIL_SUBJECT
Resource key for e-mail subject.

See Also:
Constant Field Values

MSG_ERR_BAD_EMAIL

public static final java.lang.String MSG_ERR_BAD_EMAIL
Invalid e-mail address constant.

See Also:
Constant Field Values

MSG_ERR_CREATING_EMAIL_RECIPIENT

public static final java.lang.String MSG_ERR_CREATING_EMAIL_RECIPIENT
Error creating e-mail recipient message key.

See Also:
Constant Field Values

MSG_NO_SENDER_EMAIL

public static final java.lang.String MSG_NO_SENDER_EMAIL
No sender address message key.

See Also:
Constant Field Values

MSG_INVALID_SENDER_EMAIL

public static final java.lang.String MSG_INVALID_SENDER_EMAIL
Invalid sender message key.

See Also:
Constant Field Values

MSG_NO_RECIPIENT_EMAIL

public static final java.lang.String MSG_NO_RECIPIENT_EMAIL
Missing recipient address message key.

See Also:
Constant Field Values

MSG_INVALID_RECIPIENT_EMAIL

public static final java.lang.String MSG_INVALID_RECIPIENT_EMAIL
Invalid recipient address message key.

See Also:
Constant Field Values

MSG_EMPTY_MESSAGE

public static final java.lang.String MSG_EMPTY_MESSAGE
Empty message body message key.

See Also:
Constant Field Values

MSG_NO_EMAIL_HOST_NAME

public static final java.lang.String MSG_NO_EMAIL_HOST_NAME
Host name is missing message key.

See Also:
Constant Field Values

MSG_NO_SENDER_FIRST_NAME

public static final java.lang.String MSG_NO_SENDER_FIRST_NAME
Sender first name is missing message key.

See Also:
Constant Field Values

MSG_NO_SENDER_LAST_NAME

public static final java.lang.String MSG_NO_SENDER_LAST_NAME
Sender last name is missing message key.

See Also:
Constant Field Values

MSG_EMPTY_SUBJECT

public static final java.lang.String MSG_EMPTY_SUBJECT
Subject is empty message key.

See Also:
Constant Field Values

mStoreSitePropertiesManager

protected atg.projects.store.multisite.StoreSitePropertiesManager mStoreSitePropertiesManager
Constructor Detail

StoreEmailTools

public StoreEmailTools()
Method Detail

getProfileTools

public StoreProfileTools getProfileTools()
Returns:
profile tools.

setProfileTools

public void setProfileTools(StoreProfileTools pProfileTools)
Parameters:
pProfileTools - - profile tools.

getDefaultLocaleString

public java.lang.String getDefaultLocaleString()
Returns:
the String

setDefaultLocale

public void setDefaultLocale(java.lang.String pDefaultLocale)
Parameters:
DefaultLocale - the String to set

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets the Transaction Manager.


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Transaction Manager


getRecipientNameParamName

public java.lang.String getRecipientNameParamName()
Gets the name of the Name value used for the To: field. This is configured in the component property file.

Returns:
the name of the Name value used for the To: field.

setRecipientNameParamName

public void setRecipientNameParamName(java.lang.String pRecipientNameParamName)
Sets the name of the Name value used for the To: field. This is configured in the component property file.

Parameters:
pRecipientNameParamName - - the name of the Name value used for the To: field.

getRecipientEmailParamName

public java.lang.String getRecipientEmailParamName()
Gets the name of the Email value used for the To: field. This is configured in the component property file.

Returns:
the name of the Email value used for the To: field.

setRecipientEmailParamName

public void setRecipientEmailParamName(java.lang.String pRecipientEmailParamName)
Sets the name of the Email value used for the To: field. This is configured in the component property file.

Parameters:
pRecipientEmailParamName - - the name of the Email value used for the To: field.

getSenderNameParamName

public java.lang.String getSenderNameParamName()
Gets the name of the Name value used for the From: field. This is configured in the component property file.

Returns:
the name of the Name value used for the from field.

setSenderNameParamName

public void setSenderNameParamName(java.lang.String pSenderNameParamName)
Sets the name of the Name value used for the From: field. This is configured in the component property file.

Parameters:
pSenderNameParamName - - the name of the Name value used for the From: field.

getSenderEmailParamName

public java.lang.String getSenderEmailParamName()
Gets the name of the Email value used for the From: field. This is configured in the component property file.

Returns:
the name of the Email value used for the From: field.

setSenderEmailParamName

public void setSenderEmailParamName(java.lang.String pSenderEmailParamName)
Sets the name of the Email value used for the From: field. This is configured in the component property file.

Parameters:
pSenderEmailParamName - - the name of the Email value used for the From: field.

getMessageParamName

public java.lang.String getMessageParamName()
Gets the name of the parameter used for the Message: field. This is configured in the component property file.

Returns:
the name of the parameter used for the Message: field.

setMessageParamName

public void setMessageParamName(java.lang.String pMessageParamName)
Sets the name of the parameter used for the Message: field. This is configured in the component property file.

Parameters:
pMessageParamName - - the name of the parameter used for the Comment: field.

getProductIdParamName

public java.lang.String getProductIdParamName()
Gets the name of the parameter used for the ProductId: field. This is configured in the component property file.

Returns:
the name of the parameter used for the ProductId: field.

setProductIdParamName

public void setProductIdParamName(java.lang.String pProductIdParamName)
Sets the name of the parameter used for the ProductId: field. This is configured in the component property file.

Parameters:
pProductIdParamName - - the name of the parameter used for the ProductId: field.

getSubjectParamName

public java.lang.String getSubjectParamName()
Gets the name of the parameter used for the Subject: field. This is configured in the component property file.

Returns:
the name of the parameter used for the Subject: field.

setSubjectParamName

public void setSubjectParamName(java.lang.String pSubjectParamName)
Sets the name of the parameter used for the Subject: field. This is configured in the component property file.

Parameters:
pSubjectParamName - - the name of the parameter used for the Subject: field.

getProfileParamName

public java.lang.String getProfileParamName()
Gets the name of the parameter used to send the current user profile to the template. This is configured in the component property file.

Returns:
The name of the parameter used to send the current user profile to the template.

setProfileParamName

public void setProfileParamName(java.lang.String pProfileParamName)
Sets the name of the parameter used to send the current user profile to the template. This is configured in the component property file.

Parameters:
pProfileParamName - The name of the parameter used to send the current user profile to the template.

setLocaleParamName

public void setLocaleParamName(java.lang.String pLocaleParamName)
Parameters:
pLocaleParamName - - locale parameter name.

getLocaleParamName

public java.lang.String getLocaleParamName()
Returns:
the value of property getEmailParamName.

setDefaultEmailInfo

public void setDefaultEmailInfo(atg.userprofiling.email.TemplateEmailInfo pDefaultEmailInfo)
Sets the default email information. This is configured in the component property file.

Parameters:
pDefaultEmailInfo - - the default email information

getDefaultEmailInfo

public atg.userprofiling.email.TemplateEmailInfo getDefaultEmailInfo()
Gets the default email information. This is configured in the component property file.

Returns:
the default email information

setTemplateUrl

public void setTemplateUrl(java.lang.String pTemplateUrl)
Sets the URL for the email template used to send the email. This is configured in the component property file.

Parameters:
pTemplateUrl - - the URL

getTemplateUrl

public java.lang.String getTemplateUrl()
Gets the URL for the email template used to send the email. This is configured in the component property file.

Returns:
the URL

setSendEmailInSeparateThread

public void setSendEmailInSeparateThread(boolean pSendEmailInSeparateThread)
Sets boolean indicating whether the email is sent in a separate thread.

Parameters:
pSendEmailInSeparateThread - boolean indicating whether the email is sent in a separate thread.

isSendEmailInSeparateThread

public boolean isSendEmailInSeparateThread()
Returns:
boolean indicating whether the email is sent in a separate thread.

setPersistEmails

public void setPersistEmails(boolean pPersistEmails)
Sets boolean indicating whether the email is persisted before it is sent.

Parameters:
pPersistEmails - boolean indicating whether the email is persisted before it is sent.

isPersistEmails

public boolean isPersistEmails()
Returns:
boolean indicating whether the email is persisted before it is sent.

setEmailSender

public void setEmailSender(atg.userprofiling.email.TemplateEmailSender pEmailSender)
Sets the email send component. This is configured in the component property file.

Parameters:
pEmailSender - - the email send component

getEmailSender

public atg.userprofiling.email.TemplateEmailSender getEmailSender()
Gets the email send component. This is configured in the component property file.

Returns:
the email send component

getProductItemName

public java.lang.String getProductItemName()
Gets the name of the product item.

Returns:
the name of the product item.

setProductItemName

public void setProductItemName(java.lang.String pProductItemName)
Sets the name of the product item.

Parameters:
pProductItemName - - the name of the product item.

getCatalogRepository

public atg.repository.MutableRepository getCatalogRepository()
Gets the value of the catalogRepository field.

Returns:
the value of the catalogRepository field.

setCatalogRepository

public void setCatalogRepository(atg.repository.MutableRepository pCatalogRepository)
Sets the value of the catalogRepository: field.

Parameters:
pCatalogRepository - - the value of the catalogRepository: field.

getStoreNameResource

public java.lang.String getStoreNameResource()
Returns:
the storeNameResource.

setStoreNameResource

public void setStoreNameResource(java.lang.String pStoreNameResource)
Parameters:
pStoreNameResource - The storeNameResource to set.

getDisplayNamePropertyName

public java.lang.String getDisplayNamePropertyName()
Gets the name of the Display Name property.

Returns:
the name of the Display Name property.

setDisplayNamePropertyName

public void setDisplayNamePropertyName(java.lang.String pDisplayNamePropertyName)
Sets the name of the Display Name property.

Parameters:
pDisplayNamePropertyName - - the name of the Display Name property.

getStoreConfiguration

public StoreConfiguration getStoreConfiguration()
Returns:
the storeConfiguration.

setStoreConfiguration

public void setStoreConfiguration(StoreConfiguration pStoreConfiguration)
Parameters:
pStoreConfiguration - The storeConfiguration to set.

getEmailAFriendResourceBundleName

public java.lang.String getEmailAFriendResourceBundleName()
Returns:
the location of the Email a Friend resources bundle.

setEmailAFriendResourceBundleName

public void setEmailAFriendResourceBundleName(java.lang.String pEmailAFriendResourceBundleName)
Parameters:
pEmailAFriendResourceBundleName - - the location of the Email a Friend resource bundle.

getEmailAFriendResourceBundle

public java.util.ResourceBundle getEmailAFriendResourceBundle()
Returns:
the Email a Friend resources bundle.

setSiteIdParamName

public void setSiteIdParamName(java.lang.String pSiteIdParamName)
The siteId parameter name - it represents the Site ID from which the email is dispatched parameter to be used in Email template

Parameters:
pSiteIdParamName - siteId parameter name

getSiteIdParamName

public java.lang.String getSiteIdParamName()
Returns:
the value of property SiteIdParamName

getTemplateUrlName

public java.lang.String getTemplateUrlName()
Returns:
the String

setTemplateUrlName

public void setTemplateUrlName(java.lang.String pTemplateUrlName)
Parameters:
mTemplateUrlName - the String to set

getStoreSitePropertiesManager

public atg.projects.store.multisite.StoreSitePropertiesManager getStoreSitePropertiesManager()
Returns:
the StoreSitePropertiesManager

setStoreSitePropertiesManager

public void setStoreSitePropertiesManager(atg.projects.store.multisite.StoreSitePropertiesManager pStoreSitePropertiesManager)
Parameters:
StoreSitePropertiesManager - the StoreSitePropertiesManager to set

getPromoTemplateUrls

public java.util.ArrayList<java.lang.String> getPromoTemplateUrls()

setPromoTemplateUrls

public void setPromoTemplateUrls(java.util.ArrayList<java.lang.String> pPromoTemplateUrls)

getPropertyManager

public StorePropertyManager getPropertyManager()

setPropertyManager

public void setPropertyManager(StorePropertyManager pPropertyManager)

validateEmailAddress

public boolean validateEmailAddress(java.lang.String pEmailAddress)
Check to see if Email format is correct.

Parameters:
pEmailAddress - - e-mail address
Returns:
true if format is correct, false - otherwise

createSender

public java.lang.String createSender(java.lang.String pFirstName,
                                     java.lang.String pLastName,
                                     java.lang.String pEmail)
Compose the sender tag as: pFirstName pLastName

Parameters:
pFirstName - sender's first name
pLastName - sender's last name
pEmail - sender's email
Returns:
String as: pFirstName pLastName

createQualifiedString

public java.lang.String createQualifiedString(java.lang.String pName,
                                              java.lang.String pEmail)
Create string of view: pName<pEmail>

Parameters:
pName -
pEmail -
Returns:

prepareEmailInfo

public atg.userprofiling.email.TemplateEmailInfoImpl prepareEmailInfo(java.util.Map pEmailParams)
                                                               throws atg.repository.RepositoryException
Prepare email info template. Initialize basic parameters: template URL, subject, from:, to:

Returns:
TemplateEmailInfoImpl object with preset fields
Throws:
atg.repository.RepositoryException

prepareEmailInfoParams

public java.util.Map prepareEmailInfoParams(atg.userprofiling.Profile pProfile,
                                            atg.userprofiling.email.TemplateEmailInfoImpl pEmailInfo,
                                            java.util.Map pEmailParams)
Prepare email parameters before sending

Parameters:
pEmailInfo - email template
pEmailParams - map of parameters
Returns:

sendEmail

public void sendEmail(atg.userprofiling.Profile pProfile,
                      java.util.Map pEmailParams)
               throws atg.userprofiling.email.TemplateEmailException,
                      atg.repository.RepositoryException
Prepare email and send it.

Parameters:
pParams -
Throws:
atg.userprofiling.email.TemplateEmailException
atg.repository.RepositoryException

addRecipients

protected java.util.List addRecipients(atg.userprofiling.Profile pProfile,
                                       atg.userprofiling.email.TemplateEmailInfoImpl emailInfo)
Returns list of recipients

Parameters:
emailInfo -
Returns:
list of recipients

getSubject

protected java.lang.String getSubject(java.lang.String pProductId)
                               throws atg.repository.RepositoryException
Compute the subject for the email message with Product Name as part of subject.

Parameters:
pProductId - - product id
Returns:
subject
Throws:
atg.repository.RepositoryException - if error occurs