Class AbstractMailNotificationQueueItem
- java.lang.Object
-
- com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem
-
- All Implemented Interfaces:
com.atlassian.core.task.Task,com.atlassian.mail.queue.MailQueueItem,Serializable,Comparable<com.atlassian.mail.queue.MailQueueItem>
- Direct Known Subclasses:
MailNotificationQueueItem,NonUserMailNotificationQueueItem
public abstract class AbstractMailNotificationQueueItem extends Object implements com.atlassian.mail.queue.MailQueueItem, com.atlassian.core.task.Task
An abstract mail notification queue item that provides default implementations of most methods.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringbodyprotected DatedateQueuedstatic StringMIME_TYPE_HTMLstatic StringMIME_TYPE_TEXT
-
Constructor Summary
Constructors Constructor Description AbstractMailNotificationQueueItem(String templateContent)AbstractMailNotificationQueueItem(String templateLocation, String templateFileName)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddVelocityContextParam(String name, Object value)voidclearContext()intcompareTo(com.atlassian.mail.queue.MailQueueItem that)protected abstract com.atlassian.mail.EmailcreateMailObject()voidexecute()StringgetBody()DategetDateQueued()StringgetLastError()StringgetRenderedContent()StringgetRenderedContent(String content)intgetSendCount()StringgetSubject()StringgetTemplateContent()StringgetTemplateFileName()StringgetTemplateLocation()ObjectgetVelocityContextParam(String name)booleanhasError()protected voidincrementSendCount()protected static booleanisRecognisedMimeType(String mimePref)voidpreRenderBody(Map<String,Object> contextMap)This method will not retain a local copy of the contextMap - making it advantageous for pre-rendering templates with contexts comprising of transient or session-based data.ObjectremoveVelocityContextParam(String name)protected StringrenderTemplate(String templateLocation, String templateName, Map<String,Object> contextMap)protected com.atlassian.mail.server.SMTPMailServerretrieveMailServer()voidsend()voidsetBody(String body)protected voidsetLastError(String lastError)voidsetSubject(String subject)voidsetTemplateContent(String templateContent)voidsetTemplateFileName(String templateFileName)voidsetTemplateLocation(String templateLocation)protected StringtransformForEmail(String input)
-
-
-
Field Detail
-
dateQueued
protected Date dateQueued
-
MIME_TYPE_HTML
public static final String MIME_TYPE_HTML
- See Also:
- Constant Field Values
-
MIME_TYPE_TEXT
public static final String MIME_TYPE_TEXT
- See Also:
- Constant Field Values
-
body
protected String body
-
-
Method Detail
-
compareTo
public int compareTo(com.atlassian.mail.queue.MailQueueItem that)
- Specified by:
compareToin interfaceComparable<com.atlassian.mail.queue.MailQueueItem>
-
getLastError
public String getLastError()
-
setLastError
protected void setLastError(String lastError)
-
getSubject
public String getSubject()
- Specified by:
getSubjectin interfacecom.atlassian.mail.queue.MailQueueItem
-
getDateQueued
public Date getDateQueued()
- Specified by:
getDateQueuedin interfacecom.atlassian.mail.queue.MailQueueItem
-
getSendCount
public int getSendCount()
- Specified by:
getSendCountin interfacecom.atlassian.mail.queue.MailQueueItem
-
setSubject
public void setSubject(String subject)
-
hasError
public boolean hasError()
- Specified by:
hasErrorin interfacecom.atlassian.mail.queue.MailQueueItem
-
execute
public void execute() throws Exception- Specified by:
executein interfacecom.atlassian.core.task.Task- Throws:
Exception
-
send
public void send() throws com.atlassian.mail.MailException- Specified by:
sendin interfacecom.atlassian.mail.queue.MailQueueItem- Throws:
com.atlassian.mail.MailException
-
createMailObject
protected abstract com.atlassian.mail.Email createMailObject()
-
retrieveMailServer
protected com.atlassian.mail.server.SMTPMailServer retrieveMailServer() throws com.atlassian.mail.MailException- Throws:
com.atlassian.mail.MailException
-
incrementSendCount
protected void incrementSendCount()
-
isRecognisedMimeType
protected static boolean isRecognisedMimeType(String mimePref)
-
clearContext
public void clearContext()
-
preRenderBody
public void preRenderBody(Map<String,Object> contextMap)
This method will not retain a local copy of the contextMap - making it advantageous for pre-rendering templates with contexts comprising of transient or session-based data.
-
getRenderedContent
public String getRenderedContent()
-
getTemplateFileName
public String getTemplateFileName()
-
setTemplateFileName
public void setTemplateFileName(String templateFileName)
-
getTemplateContent
public String getTemplateContent()
-
setTemplateContent
public void setTemplateContent(String templateContent)
-
getTemplateLocation
public String getTemplateLocation()
-
setTemplateLocation
public void setTemplateLocation(String templateLocation)
-
getBody
public String getBody()
-
setBody
public void setBody(String body)
-
-