Class 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
    • Constructor Detail

      • AbstractMailNotificationQueueItem

        public AbstractMailNotificationQueueItem​(String templateContent)
      • AbstractMailNotificationQueueItem

        public AbstractMailNotificationQueueItem​(String templateLocation,
                                                 String templateFileName)
    • Method Detail

      • compareTo

        public int compareTo​(com.atlassian.mail.queue.MailQueueItem that)
        Specified by:
        compareTo in interface Comparable<com.atlassian.mail.queue.MailQueueItem>
      • getLastError

        public String getLastError()
      • setLastError

        protected void setLastError​(String lastError)
      • getSubject

        public String getSubject()
        Specified by:
        getSubject in interface com.atlassian.mail.queue.MailQueueItem
      • getDateQueued

        public Date getDateQueued()
        Specified by:
        getDateQueued in interface com.atlassian.mail.queue.MailQueueItem
      • getSendCount

        public int getSendCount()
        Specified by:
        getSendCount in interface com.atlassian.mail.queue.MailQueueItem
      • setSubject

        public void setSubject​(String subject)
      • hasError

        public boolean hasError()
        Specified by:
        hasError in interface com.atlassian.mail.queue.MailQueueItem
      • execute

        public void execute()
                     throws Exception
        Specified by:
        execute in interface com.atlassian.core.task.Task
        Throws:
        Exception
      • send

        public void send()
                  throws com.atlassian.mail.MailException
        Specified by:
        send in interface com.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)
      • addVelocityContextParam

        public void addVelocityContextParam​(String name,
                                            Object value)
      • removeVelocityContextParam

        public Object removeVelocityContextParam​(String name)
      • clearContext

        public void clearContext()
      • getVelocityContextParam

        public Object getVelocityContextParam​(String name)
      • 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​(String content)
      • getRenderedContent

        public String getRenderedContent()
      • addUtilsToContext

        public static void addUtilsToContext​(Map<String,​Object> contextParams)
      • 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)
      • transformForEmail

        protected String transformForEmail​(String input)