Interface MailThreadManager

All Known Implementing Classes:
MailThreadManagerImpl

@PublicApi public interface MailThreadManager
  • 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

      Parameters:
      messageId - The incoming Message-ID
      senderAddress - The sender
      issue - the issue that was affected (created or commented)
      action - Issue created or Issue commented
      Since:
      v5.2.3
    • threadNotificationEmail

      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
    • getAssociatedIssueObject

      @Nullable Issue getAssociatedIssueObject(javax.mail.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, 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

      @Nonnull List<Issue> getAssociatedIssueObjects(javax.mail.Message message)
      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

      @Nullable Issue findIssueFromMessageId(String messageId)
      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

      @Nonnull List<Issue> findIssuesFromMessageId(String messageId)
      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

      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