public class

MailThreadManagerImpl

extends Object
implements MailThreadManager
java.lang.Object
   ↳ com.atlassian.jira.mail.MailThreadManagerImpl

Summary

Public Constructors
MailThreadManagerImpl(OfBizDelegator ofBizDelegator, IssueManager issueManager)
Public Methods
Issue findIssueFromMessageId(String messageId)
Looks for an issue associated with the given message by inspecting the "Message-ID" header of the message.
@Nullable Issue getAssociatedIssueObject(Message message)
Looks for an issue associated with the given message by inspecting the "In-Reply-To" header of the message.
int removeAssociatedEntries(Long issueId)
Removes rows from NotificationInstance table associated with the given issue.
void storeIncomingMessageId(String messageId, String senderAddress, Issue issue, MailThreadManager.MailAction action)
Remembers that given messageId has been used to either create or comment on an Issue.
void threadNotificationEmail(Email email, Issue issue)
Thread the given email which is related to the given issue.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.mail.MailThreadManager

Public Constructors

public MailThreadManagerImpl (OfBizDelegator ofBizDelegator, IssueManager issueManager)

Public Methods

public Issue findIssueFromMessageId (String messageId)

Looks for an issue associated with the given message by inspecting the "Message-ID" header of the message.

Parameters
messageId Message-ID to be checked
Returns
  • Issue that is already associated with this Message-ID or null if none

@Nullable public Issue getAssociatedIssueObject (Message message)

Looks for an issue associated with the given message by inspecting the "In-Reply-To" header of the message.

Notifications sent from JIRA have a special form that allows us to parse out the Issue ID. We also remember the incoming Message-IDs so we can tell if another recipient replies to that message.

Parameters
message message to analyse
Returns
  • associated issue or null if no issue is associated with this message.

public int removeAssociatedEntries (Long issueId)

Removes rows from NotificationInstance table associated with the given issue. Used when we delete an issue.

Parameters
issueId the issue
Returns
  • row count

public void storeIncomingMessageId (String messageId, String senderAddress, Issue issue, MailThreadManager.MailAction action)

Remembers that given messageId has been used to either create or comment on an Issue.

This creates an entry in "NotificationInstance" table that will only be removed in two cases

Parameters
messageId The incoming Message-ID
senderAddress The sender
issue the issue that was affected (created or commented)
action Issue created or Issue commented

public void threadNotificationEmail (Email email, Issue issue)

Thread the given email which is related to the given issue.

Parameters
email the email to be sent
issue the issue that the email is about