atg.userprofiling.email
Class MessageContentProcessor

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.userprofiling.email.MessageContentProcessor
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
HtmlContentProcessor, SimpleContentProcessor

public abstract class MessageContentProcessor
extends GenericService

A service which processes the content of an email message in some application-specific way, and stuffs the resulting content into the passed in javax.mail.Message object.

This is an abstract class; the child classes should override the setMessageContent method to implement specific content processing schemes.

See Also:
Message, SimpleContentProcessor

Nested Class Summary
static class MessageContentProcessor.UrlAndMimeType
          Holds the URL and the last mime type of the template.
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
MessageContentProcessor()
           
 
Method Summary
 void pruneAlternatives(java.lang.Object pRecipient, java.util.List pUrlAndLastMimeTypeList, boolean pBeforeRender)
          Prune the list of alternative types by modifying pUrlAndLastMimeTypeList.
 void setMessageContent(javax.mail.Message pMessage, java.lang.String pContent)
          Processes the email message content and stuffs the resulting content into the Message.
 void setMessageContent(javax.mail.Message pMessage, java.lang.String pContent, java.io.File pAttachment, boolean pInlineAttachment)
          Processes the email message content and stuffs the resulting content into the Message.
abstract  void setMessageContent(javax.mail.Message pMessage, java.lang.String pContent, java.lang.String pContentType, java.io.File[] pAttachments, boolean pInlineAttachments)
          Processes the email message content and stuffs the resulting content into the Message.
 void setMessageContents(javax.mail.Message pMessage, java.lang.String[] pContents, java.lang.String[] pContentTypes, java.io.File[] pAttachments, boolean pInlineAttachments)
          Processes the email message content and stuffs the resulting content into the Message.
 boolean supportsMultipleContents()
          Whether or not we support multiple contents.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
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

Constructor Detail

MessageContentProcessor

public MessageContentProcessor()
Method Detail

setMessageContent

public void setMessageContent(javax.mail.Message pMessage,
                              java.lang.String pContent)
                       throws TemplateEmailException
Processes the email message content and stuffs the resulting content into the Message.

Throws:
TemplateEmailException - if the content could not be processed or set in the Message

setMessageContent

public void setMessageContent(javax.mail.Message pMessage,
                              java.lang.String pContent,
                              java.io.File pAttachment,
                              boolean pInlineAttachment)
                       throws TemplateEmailException
Processes the email message content and stuffs the resulting content into the Message.

Parameters:
pAttachment - the file to attach to the message, in addition to setting the regular content
pInlineAttachment - if true, the file will be inlined into the message, rather than attached
Throws:
TemplateEmailException - if the content could not be processed or set in the Message

setMessageContent

public abstract void setMessageContent(javax.mail.Message pMessage,
                                       java.lang.String pContent,
                                       java.lang.String pContentType,
                                       java.io.File[] pAttachments,
                                       boolean pInlineAttachments)
                                throws TemplateEmailException
Processes the email message content and stuffs the resulting content into the Message.

Parameters:
pAttachments - the files to attach to the message, in addition to setting the regular content
pInlineAttachments - if true, the files will be inlined into the message, rather than attached
Throws:
TemplateEmailException - if the content could not be processed or set in the Message

supportsMultipleContents

public boolean supportsMultipleContents()
Whether or not we support multiple contents.


setMessageContents

public void setMessageContents(javax.mail.Message pMessage,
                               java.lang.String[] pContents,
                               java.lang.String[] pContentTypes,
                               java.io.File[] pAttachments,
                               boolean pInlineAttachments)
                        throws TemplateEmailException
Processes the email message content and stuffs the resulting content into the Message. Note that not all MessageContentProcessors support multiple contents, so check supportsMultipleContents before invoking.

Parameters:
pContents - an array of multi-part-alternative contents
pContentTypes - an array of content types which correspond to each of the pContents elements.
pInlineAttachments - if true, the files will be inlined into the message, rather than attached
pAttachments - the files to attach to the message, in addition to setting the regular content
pInlineAttachments - if true, the files will be inlined into the message, rather than attached
Throws:
TemplateEmailException - if the content could not be processed or set in the Message

pruneAlternatives

public void pruneAlternatives(java.lang.Object pRecipient,
                              java.util.List pUrlAndLastMimeTypeList,
                              boolean pBeforeRender)
Prune the list of alternative types by modifying pUrlAndLastMimeTypeList. Be sure to leave at least one. Note one should only remove from the list... only add or re-arrange. Note that pruneAlternatives gets called twice... one before and once after.

Parameters:
pRecipient - The recipient for whole the email is being rendered*
pUrlAndMimeTypeList - a list of UrlAndMimeType objects representing the templates. Note that if pBeforeRender is true, the mime-type is calculated from the previous time the email template was rendered, and may be null.
pBeforeRender - whether we are pruning before or after the templates have been rendered.