Email templates are velocity macro files. When email templates are used to render email body, the following Velocity context attributes are available.
Name | Type | Description |
---|---|---|
attachmentsManager | com.atlassian.jira.mail.util.MailAttachmentsManager | Manager component |
baseurl | String | Base url of the JIRA instance, set under General Configuration |
buildutils | com.atlassian.jira.util.BuildUtils | |
customfieldManager | com.atlassian.jira.issue.CustomFieldManager | Support for adding custom fields to outgoing emails |
dateformatter | com.atlassian.jira.web.util.OutlookDate | Date format support |
issue | com.atlassian.jira.mail.TemplateIssue | Issue extended with support for processing in velocity templates |
i18n | com.atlassian.jira.util.I18nHelper | I18n support |
jirakeyutils | com.atlassian.jira.util.JiraKeyUtils | |
jirautils | com.atlassian.jira.util.JiraUtils | |
remoteUser | com.atlassian.crowd.embedded.api.User | Current user running the action or null |
rendererManager | com.atlassian.jira.issue.RendererManager | |
stringUtils | org.apache.commons.lang.StringUtils | String helper methods |
textutils | com.opensymphony.util.TextUtils | JIRA's text util methods |
userutils | com.atlassian.core.user.UserUtils | |
velocityhelper | com.atlassian.velocity.VelocityHelper | |
jetiFieldRenderer | Support for field rendering in templates. See details below. | |
jetiFieldFormatter | Support for date/time formatting in templates. See details below | |
number | com.atlassian.jira.util.velocity.Numbertool | Support for Number formatting in templates. See API documentation |
jetiFieldRenderer
FieldRenderer Interface
public interface FieldRenderer { String renderCustomField(Issue issue, String fieldKey);// String renderVersions(Collection<Version> versions);// String renderComponents(Collection<ProjectComponent> components);// String renderLabels(Collection<Label> labels);// String renderSecurityLevel(GenericValue securityLevel);// String renderIssueConstant(IssueConstant issueConstant);// String renderUser(User user);// String renderDateTime(Timestamp ts);// String renderEstimate(TemplateIssue ti, I18nHelper i18n); String renderRemainingEstimate(TemplateIssue ti, I18nHelper i18n); String renderWorklog(TemplateIssue ti, I18nHelper i18n); Object renderCustomFieldAsObject(Issue issue, String fieldKey); I18nHelper getI18nBean(String locale); //Returns a I18nBean for the given locale, locale string follows java syntax }
jetiFieldFormatter
FieldFormatters Interface
public interface FieldFormatters { //JIRA Date Formatting Options DateTimeFormatter getJiraDateTimeFormatter(); DateTimeFormatter getJiraDateTimeFormatter(String styleName); String formatSafely(DateTimeFormatter dateFormat, Date value); String formatSafely(DateTimeFormatter dateFormat, Object value); //Java Date Formatting Options DateFormat getJavaDateFormat(); DateFormat getJavaDateFormat(int style); DateFormat getJavaDateFormat(int style, String locale); DateFormat getJavaDateTimeFormat(); DateFormat getJavaDateTimeFormat(int dateStyle, int timeStyle); DateFormat getJavaDateTimeFormat(int dateStyle, int timeStyle, String locale); DateFormat getJavaDateTimeFormat(String pattern); String formatSafely(DateFormat dateFormat, Object value); String formatSafely(DateFormat dateFormat, Date value); }
- DateTimeFormatter is part of the JIRA API
- DateFormat is a standard way to format dates in Java