com.atlassian.confluence.mail.template
Class MailNotificationQueueItem

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

public class MailNotificationQueueItem
extends AbstractMailNotificationQueueItem

Handles mail notifications to Confluence users

See Also:
Serialized Form

Field Summary
static java.lang.String TEMPLATES_LOCATION
          Deprecated. since 5.2, use #getDefaultTemplateLocation(String)
 
Fields inherited from class com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem
body, dateQueued, MIME_TYPE_HTML, MIME_TYPE_TEXT
 
Constructor Summary
protected MailNotificationQueueItem(com.atlassian.user.User user, java.lang.String templateContent, java.lang.String subject)
           
protected MailNotificationQueueItem(com.atlassian.user.User user, java.lang.String templateLocation, java.lang.String templateFileName, java.lang.String subject)
           
 
Method Summary
static MailNotificationQueueItem createFromTemplateContent(com.atlassian.user.User user, java.lang.String templateContent, java.lang.String subject)
           
static MailNotificationQueueItem createFromTemplateFile(com.atlassian.user.User user, java.lang.String templateFileName, java.lang.String subject)
           
static MailNotificationQueueItem createFromTemplateFileAndLocation(com.atlassian.user.User user, java.lang.String templateLocation, java.lang.String templateFileName, java.lang.String subject)
           
protected  com.atlassian.mail.Email createMailObject()
           
protected static java.lang.String getDefaultTemplateLocation(com.atlassian.user.User user, java.lang.String templateFileName)
          Returns the default location for the given user and template name.
protected  java.lang.String getMimeType()
           
protected static java.lang.String getMimeTypeForUser(com.atlassian.user.User user)
          TODO: CONFDEV-3278 With the switch to XHTML from wiki markup, we no longer support TEXT or HTML selection.
protected static java.lang.String getTemplateLocationFromUserPreference(com.atlassian.user.User user)
          Deprecated. since 5.2, use #getDefaultTemplateLocation(String)
static UserAccessor 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, renderTemplate, retrieveMailServer, send, 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
 

Field Detail

TEMPLATES_LOCATION

public static final java.lang.String TEMPLATES_LOCATION
Deprecated. since 5.2, use #getDefaultTemplateLocation(String)
See Also:
Constant Field Values
Constructor Detail

MailNotificationQueueItem

protected MailNotificationQueueItem(com.atlassian.user.User user,
                                    java.lang.String templateLocation,
                                    java.lang.String templateFileName,
                                    java.lang.String subject)

MailNotificationQueueItem

protected MailNotificationQueueItem(com.atlassian.user.User user,
                                    java.lang.String templateContent,
                                    java.lang.String subject)
Method Detail

createFromTemplateFile

public static MailNotificationQueueItem createFromTemplateFile(com.atlassian.user.User user,
                                                               java.lang.String templateFileName,
                                                               java.lang.String subject)

createFromTemplateFileAndLocation

public static MailNotificationQueueItem createFromTemplateFileAndLocation(com.atlassian.user.User user,
                                                                          java.lang.String templateLocation,
                                                                          java.lang.String templateFileName,
                                                                          java.lang.String subject)

createFromTemplateContent

public static MailNotificationQueueItem createFromTemplateContent(com.atlassian.user.User user,
                                                                  java.lang.String templateContent,
                                                                  java.lang.String subject)

getMimeType

protected java.lang.String getMimeType()

createMailObject

protected com.atlassian.mail.Email createMailObject()
Specified by:
createMailObject in class AbstractMailNotificationQueueItem

getMimeTypeForUser

protected static java.lang.String getMimeTypeForUser(com.atlassian.user.User user)
TODO: CONFDEV-3278 With the switch to XHTML from wiki markup, we no longer support TEXT or HTML selection. It is always HTML, but some day we might want to add support for something else, so keep the structure for selection in place, but just hidden.

Parameters:
user - The user to check
Returns:
the user's preferred format for email notifications

getTemplateLocationFromUserPreference

protected static java.lang.String getTemplateLocationFromUserPreference(com.atlassian.user.User user)
Deprecated. since 5.2, use #getDefaultTemplateLocation(String)

TODO: CONFDEV-3278 Retrieve the location of the mail notification templates, based on the user's email notification format preference.

Parameters:
user - The user whose preferences to check for the appropriate email format
Returns:
the location in which the appropriate mail notification templates reside

getDefaultTemplateLocation

protected static java.lang.String getDefaultTemplateLocation(@Nullable
                                                             com.atlassian.user.User user,
                                                             @Nullable
                                                             java.lang.String templateFileName)
Returns the default location for the given user and template name.

If a template name ends with .vm indicating a Velocity template, a path relative to the webapp context is returned. In any other case, a completeKey pointing to a web resource is returned.

Parameters:
user - the name of the user for which the default location should be retrieved, currently not used
templateFileName - the name of the template for which the default location should be retrieved
Returns:
the default template location

getUserAccessor

public static UserAccessor getUserAccessor()


Copyright © 2003-2014 Atlassian. All Rights Reserved.