Wiki

Clone wiki

runner / MailHandler - Utility class

##What it is Internally the Custom Mail Handler consists of two classes, the handler itself that is visible to the Mail Plugin as handler, and the utility class that is passed to the script along with the Message object. This utility class is really a bunch of reworked methods taken from the default JIRA mail handlers that make the life easier.

#!java

boolean canHandleMessage(final Message message) throws MessagingException

boolean fingerPrintCheck(final Message message, MessageHandlerExecutionMonitor messageHandlerExecutionMonitor)

// Test if the message has In-Reply-To header to a message that is associated with an issue
Issue getAssociatedIssue(final Message message) throws MessagingException

Issue findIssueObjectInString(String subject)

String getEmailBody(Message message)

String stripQuotedLines(String body)

User getReporter(final Message message) throws MessagingException

boolean canAddComments(ApplicationUser reporter, Issue issue)

boolean isAssignable(ApplicationUser user, Project project)

boolean canCreateAttachments(User reporter, Issue issue)

boolean attachmentsAllowed()

boolean canCreateIssues(User reporter, Project project)

Collection<fr.gfi.jira.plugins.runner.mail.MailHandler.AttachmentWrapper>prepareAttachmentsForMessage(Message message, Issue issue)

Collection<ChangeItemBean> createPreparedAttachments(User reporter, Issue issue) throws IOException

void clearPreparedAttachments()

AttachmentWrapper addAttachment(String fileName, String filePath, String contentType) throws IOException, MessagingException

updateHistoryAndFireEvent(Collection<ChangeItemBean> attachmentsChangeItems, Issue issue, ApplicationUser reporter, Comment comment, Long eventTypeId) throws JiraException

Project getProject()

IssueType getIssueTypeObjectByName(String name

IssueType getIssueTypeObject()

String truncateSummary(String summary)

String getPriority(Message message, Project project, IssueType issueType)

String getPriorityFromMessage(Message message) throws MessagingException

String getDescription(Message message, Project project, IssueType issueType, User reporter)

String getReplyTo(final Message message) throws MessagingException

String recordFromAddressForAnon(ApplicationUser reporter, Message message, String body) throws MessagingException

User getDefaultAssignee(Project project)

MutableIssue getNewIssueObject()

void setDefaultSecurityLevel(MutableIssue issue) throws Exception

void setCustomFieldDefaults(MutableIssue issue)

void setCustomFieldValue(MutableIssue issue, String fieldId, Object value) throws java.text.ParseException

com.atlassian.jira.issue.customfields.option.Option getOptionId(final Object value, final CustomField customField)

void addCcWatchersAndAttachments(Message message, Issue issue, User reporter)

void addCcWatchersToIssue(Message message, Issue issue, User reporter, MessageHandlerContext context, MessageHandlerExecutionMonitor messageHandlerExecutionMonitor) throws MessagingException

Collection<User> getAllUsersFromEmails(Address addresses[])

User getFirstValidAssignee(Address[] addresses, Project project)

String getHTMLBody(Message message) throws MessagingException, IOException

com.atlassian.jira.plugins.mail.internal.MailLoopDetectionService getMailLoopDetectionService()

I18nHelper getI18nHelper()

ProjectManager getProjectManager()

FieldVisibilityManager getFieldVisibilityManager()

WatcherManager getWatcherManager()

CustomFieldManager getCustomFieldManager()

List<com.atlassian.jira.issue.Issue> getIssuesByJQL(String jql, ApplicationUser user)

Updated