@PublicApi @Deprecated public interface

MailThreadManager

com.atlassian.jira.mail.MailThreadManager
Known Indirect Subclasses

This interface is deprecated.
mail handlers no longer need to register processed email with this class, JIRA no longer relies on this to prevent duplicate issue being created from one email.

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Summary

Nested Classes
enum MailThreadManager.MailAction Indicates an action in response to an incoming email. 
Public Methods
@Nullable 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.

Public Methods

@Nullable 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