com.atlassian.confluence.mail.template
Class PreRenderedMailNotificationQueueItem

java.lang.Object
  extended by com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem
      extended by com.atlassian.confluence.mail.template.MailNotificationQueueItem
          extended by com.atlassian.confluence.mail.template.PreRenderedMailNotificationQueueItem
All Implemented Interfaces:
com.atlassian.core.task.Task, com.atlassian.mail.queue.MailQueueItem, java.io.Serializable, java.lang.Comparable<com.atlassian.mail.queue.MailQueueItem>

public class PreRenderedMailNotificationQueueItem
extends MailNotificationQueueItem
implements com.atlassian.mail.queue.MailQueueItem

See Also:
Serialized Form

Nested Class Summary
static class PreRenderedMailNotificationQueueItem.Builder
          A builder for PreRenderedMailNotificationQueueItems.
 
Field Summary
 
Fields inherited from class com.atlassian.confluence.mail.template.MailNotificationQueueItem
TEMPLATES_LOCATION
 
Fields inherited from class com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem
body, dateQueued, MIME_TYPE_HTML, MIME_TYPE_TEXT
 
Method Summary
 void addDatasources(java.util.Collection<javax.activation.DataSource> datasources)
          Deprecated. since 5.2, prefer using Builder#andRelatedBodyParts(Collection) instead as this method could be called after send()
static MailNotificationQueueItem createFromTemplateContent(com.atlassian.user.User recipient, java.lang.String templateContent, java.lang.String subject)
          Deprecated. since 5.2, use with(User, String, String) instead
static PreRenderedMailNotificationQueueItem createFromTemplateFile(com.atlassian.user.User recipient, java.lang.String templateFileName, java.lang.String subject)
          Deprecated. since 5.2, use with(User, String, String) instead
static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient, NotificationData notificationData, java.lang.String subject, java.util.Map<java.lang.String,java.lang.Object> contextMap)
          Deprecated. since 4.3, use with(User, String, String) instead
static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient, NotificationData notificationData, java.lang.String subject, NotificationContext contextClone)
          Deprecated. since 5.2, use with(User, String, String) instead
static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient, java.lang.String templateFileName, java.lang.String subject, java.util.Map<java.lang.String,java.lang.Object> contextMap, com.atlassian.user.User modifier)
          Deprecated. since 5.2, use with(User, String, String) instead
static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient, com.atlassian.user.User modifier, java.lang.String templateName, java.lang.String subject, java.util.Collection<javax.activation.DataSource> templateImageDataSources, java.util.Map<java.lang.String,java.lang.Object> contextMap)
          Deprecated. since 5.2, use with(User, String, String) instead
static MailNotificationQueueItem createFromTemplateFileAndLocation(com.atlassian.user.User recipient, java.lang.String templateLocation, java.lang.String templateFileName, java.lang.String subject)
          Deprecated. since 5.2, use with(User, String, String) instead
protected  com.atlassian.mail.Email createMailObject()
           
 void render()
           
protected  java.lang.String renderTemplate(java.lang.String templateLocation, java.lang.String templateName, java.util.Map<java.lang.String,java.lang.Object> contextMap)
           
 void send()
           
static PreRenderedMailNotificationQueueItem.Builder with(com.atlassian.user.User recipient, java.lang.String templateFileName, java.lang.String subject)
          Mandatory parametrisation in order to construct a PreRenderedMailNotificationQueueItem instance.
 
Methods inherited from class com.atlassian.confluence.mail.template.MailNotificationQueueItem
getDefaultTemplateLocation, getMimeType, getMimeTypeForUser, getTemplateLocationFromUserPreference, getUserAccessor
 
Methods inherited from class com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem
addVelocityContextParam, clearContext, compareTo, execute, getBody, getDateQueued, getLastError, getRenderedContent, getRenderedContent, getSendCount, getSubject, getTemplateContent, getTemplateFileName, getTemplateLocation, getVelocityContextParam, hasError, incrementSendCount, isRecognisedMimeType, preRenderBody, removeVelocityContextParam, retrieveMailServer, setBody, setLastError, setSubject, setTemplateContent, setTemplateFileName, setTemplateLocation, transformForEmail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.mail.queue.MailQueueItem
getDateQueued, getSendCount, getSubject, hasError
 
Methods inherited from interface com.atlassian.core.task.Task
execute
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

createFromTemplateFile

@Deprecated
public static PreRenderedMailNotificationQueueItem createFromTemplateFile(com.atlassian.user.User recipient,
                                                                                     java.lang.String templateFileName,
                                                                                     java.lang.String subject)
Deprecated. since 5.2, use with(User, String, String) instead


createFromTemplateFileAndContext

@Deprecated
public static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient,
                                                                                               NotificationData notificationData,
                                                                                               java.lang.String subject,
                                                                                               java.util.Map<java.lang.String,java.lang.Object> contextMap)
Deprecated. since 4.3, use with(User, String, String) instead

Creates a template from a file and a context

Parameters:
recipient - the recipient
notificationData - the notification data
subject - the subject
contextMap - the context map for this email.
Returns:
the pre-rendered item

createFromTemplateFileAndContext

@Deprecated
public static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient,
                                                                                               NotificationData notificationData,
                                                                                               java.lang.String subject,
                                                                                               NotificationContext contextClone)
Deprecated. since 5.2, use with(User, String, String) instead

Creates a template from a file and a context

Parameters:
recipient - the recipient
notificationData - the notification data
subject - the subject
contextClone - a clone of the context of notificationData obtained by NotificationData.cloneContext(). Values can be overridden for one instance of notification, for example the i18n bean.
Returns:
the pre-rendered item

createFromTemplateFileAndContext

public static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient,
                                                                                    com.atlassian.user.User modifier,
                                                                                    java.lang.String templateName,
                                                                                    java.lang.String subject,
                                                                                    java.util.Collection<javax.activation.DataSource> templateImageDataSources,
                                                                                    java.util.Map<java.lang.String,java.lang.Object> contextMap)
Deprecated. since 5.2, use with(User, String, String) instead


createFromTemplateFileAndContext

@Deprecated
public static PreRenderedMailNotificationQueueItem createFromTemplateFileAndContext(com.atlassian.user.User recipient,
                                                                                               java.lang.String templateFileName,
                                                                                               java.lang.String subject,
                                                                                               java.util.Map<java.lang.String,java.lang.Object> contextMap,
                                                                                               com.atlassian.user.User modifier)
Deprecated. since 5.2, use with(User, String, String) instead


createFromTemplateFileAndLocation

@Deprecated
public static MailNotificationQueueItem createFromTemplateFileAndLocation(com.atlassian.user.User recipient,
                                                                                     java.lang.String templateLocation,
                                                                                     java.lang.String templateFileName,
                                                                                     java.lang.String subject)
Deprecated. since 5.2, use with(User, String, String) instead


createFromTemplateContent

@Deprecated
public static MailNotificationQueueItem createFromTemplateContent(com.atlassian.user.User recipient,
                                                                             java.lang.String templateContent,
                                                                             java.lang.String subject)
Deprecated. since 5.2, use with(User, String, String) instead


with

public static PreRenderedMailNotificationQueueItem.Builder with(com.atlassian.user.User recipient,
                                                                java.lang.String templateFileName,
                                                                java.lang.String subject)
Mandatory parametrisation in order to construct a PreRenderedMailNotificationQueueItem instance.

The templateFileName denotes the templating technology to be used. E.g. parametrising the constructor with myTemplateFile.vm will lead to Apache Velocity being used as the engine, or myTemplateFile.soy will lead to Google Closure Templates being used.

Parameters:
recipient - the recipient of this email
templateFileName - the name of the template
subject - the subject, assumed to be pre-rendered
See Also:
specifying the template's location, specifying if the subject gets rendered

render

public void render()

send

public final void send()
                throws com.atlassian.mail.MailException
Specified by:
send in interface com.atlassian.mail.queue.MailQueueItem
Overrides:
send in class AbstractMailNotificationQueueItem
Throws:
com.atlassian.mail.MailException

createMailObject

protected com.atlassian.mail.Email createMailObject()
Overrides:
createMailObject in class MailNotificationQueueItem

addDatasources

public void addDatasources(java.util.Collection<javax.activation.DataSource> datasources)
Deprecated. since 5.2, prefer using Builder#andRelatedBodyParts(Collection) instead as this method could be called after send()


renderTemplate

protected java.lang.String renderTemplate(java.lang.String templateLocation,
                                          java.lang.String templateName,
                                          java.util.Map<java.lang.String,java.lang.Object> contextMap)
Overrides:
renderTemplate in class AbstractMailNotificationQueueItem


Copyright © 2003-2014 Atlassian. All Rights Reserved.