Package com.atlassian.jira.mail
Interface MailThreadManager
- All Known Implementing Classes:
MailThreadManagerImpl
@PublicApi
public interface MailThreadManager
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Indicates an action in response to an incoming email. -
Method Summary
Modifier and TypeMethodDescriptionfindIssueFromMessageId
(String messageId) Looks for an issue associated with the given message by inspecting the "Message-ID" header of the message.findIssuesFromMessageId
(String messageId) Looks for issues associated with the given message by inspecting the "Message-ID" header of the message.getAssociatedIssueObject
(javax.mail.Message message) Looks for an issue associated with the given message by inspecting the "In-Reply-To" header of the message.getAssociatedIssueObjects
(javax.mail.Message message) Looks for issues 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.
-
Method Details
-
storeIncomingMessageId
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
- Issue being deleted
- Entry is deleted manually with a call to
removeAssociatedEntries(Long)
- Parameters:
messageId
- The incoming Message-IDsenderAddress
- The senderissue
- the issue that was affected (created or commented)action
- Issue created or Issue commented- Since:
- v5.2.3
-
threadNotificationEmail
Thread the given email which is related to the given issue.- Parameters:
email
- the email to be sentissue
- the issue that the email is about
-
getAssociatedIssueObject
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, but we assume only one issue can be associated with an incoming message ID.
- Parameters:
message
- message to analyse- Returns:
- associated issue or null if no issue is associated with this message.
-
getAssociatedIssueObjects
Looks for issues 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, there should only be a single associated message in this case. We also remember the incoming Message-IDs so we can tell if another recipient replies to that message.
- Parameters:
message
- message to analyse- Returns:
- Potentially empty list of issues associated with this message.
- Since:
- v7.4.0
-
findIssueFromMessageId
Looks for an issue associated with the given message by inspecting the "Message-ID" header of the message. Assumes only one incoming email channel and therefore only the first issue found is relevant.- Parameters:
messageId
- Message-ID to be checked- Returns:
- Issue that is already associated with this Message-ID or null if none
-
findIssuesFromMessageId
Looks for issues associated with the given message by inspecting the "Message-ID" header of the message.- Parameters:
messageId
- Message-ID to be checked- Returns:
- Potentially empty list of issues that are already associated with this Message-ID
- Since:
- v7.4.0
-
removeAssociatedEntries
Removes rows from NotificationInstance table associated with the given issue. Used when we delete an issue.- Parameters:
issueId
- the issue- Returns:
- row count
-