Class MailThreadManagerImpl

java.lang.Object
com.atlassian.jira.mail.MailThreadManagerImpl
All Implemented Interfaces:
MailThreadManager

public class MailThreadManagerImpl extends Object implements MailThreadManager
  • Constructor Details

  • 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

      Specified by:
      storeIncomingMessageId in interface MailThreadManager
      Parameters:
      messageId - The incoming Message-ID
      senderAddress - The sender
      issue - the issue that was affected (created or commented)
      action - Issue created or Issue commented
    • threadNotificationEmail

      public void threadNotificationEmail(Email email, Issue issue)
      Description copied from interface: MailThreadManager
      Thread the given email which is related to the given issue.
      Specified by:
      threadNotificationEmail in interface MailThreadManager
      Parameters:
      email - the email to be sent
      issue - the issue that the email is about
    • getAssociatedIssueObjects

      @Nonnull public List<Issue> getAssociatedIssueObjects(javax.mail.Message message)
      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 interface MailThreadManager
      Parameters:
      message - message to analyse
      Returns:
      Potentially empty list of issues associated with this message.
    • getAssociatedIssueObject

      @Nullable public Issue getAssociatedIssueObject(javax.mail.Message message)
      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 interface MailThreadManager
      Parameters:
      message - message to analyse
      Returns:
      associated issue or null if no issue is associated with this message.
    • findIssueFromMessageId

      public Issue findIssueFromMessageId(String messageId)
      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 interface MailThreadManager
      Parameters:
      messageId - Message-ID to be checked
      Returns:
      Issue that is already associated with this Message-ID or null if none
    • findIssuesFromMessageId

      @Nonnull public List<Issue> findIssuesFromMessageId(String messageId)
      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 interface MailThreadManager
      Parameters:
      messageId - Message-ID to be checked
      Returns:
      Potentially empty list of issues that are already associated with this Message-ID
    • removeAssociatedEntries

      public int removeAssociatedEntries(Long issueId)
      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 interface MailThreadManager
      Parameters:
      issueId - the issue
      Returns:
      row count