Package com.atlassian.jira.mail
Class MailThreadManagerImpl
java.lang.Object
com.atlassian.jira.mail.MailThreadManagerImpl
- All Implemented Interfaces:
MailThreadManager
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.mail.MailThreadManager
MailThreadManager.MailAction
-
Constructor Summary
ConstructorsConstructorDescriptionMailThreadManagerImpl
(OfBizDelegator ofBizDelegator, IssueManager issueManager) -
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.
-
Constructor Details
-
MailThreadManagerImpl
-
-
Method Details
-
storeIncomingMessageId
public void storeIncomingMessageId(String messageId, String senderAddress, Issue issue, MailThreadManager.MailAction action) Description copied from interface:MailThreadManager
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
MailThreadManager.removeAssociatedEntries(Long)
- Specified by:
storeIncomingMessageId
in interfaceMailThreadManager
- Parameters:
messageId
- The incoming Message-IDsenderAddress
- The senderissue
- the issue that was affected (created or commented)action
- Issue created or Issue commented
-
threadNotificationEmail
Description copied from interface:MailThreadManager
Thread the given email which is related to the given issue.- Specified by:
threadNotificationEmail
in interfaceMailThreadManager
- Parameters:
email
- the email to be sentissue
- the issue that the email is about
-
getAssociatedIssueObjects
Description copied from interface:MailThreadManager
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.
- Specified by:
getAssociatedIssueObjects
in interfaceMailThreadManager
- Parameters:
message
- message to analyse- Returns:
- Potentially empty list of issues associated with this message.
-
getAssociatedIssueObject
Description copied from interface:MailThreadManager
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.
- Specified by:
getAssociatedIssueObject
in interfaceMailThreadManager
- Parameters:
message
- message to analyse- Returns:
- associated issue or null if no issue is associated with this message.
-
findIssueFromMessageId
Description copied from interface:MailThreadManager
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.- Specified by:
findIssueFromMessageId
in interfaceMailThreadManager
- Parameters:
messageId
- Message-ID to be checked- Returns:
- Issue that is already associated with this Message-ID or null if none
-
findIssuesFromMessageId
Description copied from interface:MailThreadManager
Looks for issues associated with the given message by inspecting the "Message-ID" header of the message.- Specified by:
findIssuesFromMessageId
in interfaceMailThreadManager
- Parameters:
messageId
- Message-ID to be checked- Returns:
- Potentially empty list of issues that are already associated with this Message-ID
-
removeAssociatedEntries
Description copied from interface:MailThreadManager
Removes rows from NotificationInstance table associated with the given issue. Used when we delete an issue.- Specified by:
removeAssociatedEntries
in interfaceMailThreadManager
- Parameters:
issueId
- the issue- Returns:
- row count
-