com.atlassian.jira.mail
Class MailThreadManagerImpl

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

public class MailThreadManagerImpl
extends Object
implements MailThreadManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.mail.MailThreadManager
MailThreadManager.MailAction
 
Field Summary
 
Fields inherited from interface com.atlassian.jira.mail.MailThreadManager
ISSUE_COMMENTED_FROM_EMAIL, ISSUE_CREATED_FROM_EMAIL, NOTIFICATION_ISSUE_ASSIGNED, NOTIFICATION_ISSUE_CLOSED, NOTIFICATION_ISSUE_COMMENT_EDITED, NOTIFICATION_ISSUE_COMMENTED, NOTIFICATION_ISSUE_CREATED, NOTIFICATION_ISSUE_DELETED, NOTIFICATION_ISSUE_GENERICEVENT, NOTIFICATION_ISSUE_MOVED, NOTIFICATION_ISSUE_REOPENED, NOTIFICATION_ISSUE_RESOLVED, NOTIFICATION_ISSUE_UPDATED, NOTIFICATION_ISSUE_WORKLOG_DELETED, NOTIFICATION_ISSUE_WORKLOG_UPDATED, NOTIFICATION_ISSUE_WORKLOGGED, NOTIFICATION_ISSUE_WORKSTARTED, NOTIFICATION_ISSUE_WORKSTOPPED, NOTIFICATION_KEY
 
Constructor Summary
MailThreadManagerImpl(OfBizDelegator ofBizDelegator, IssueManager issueManager, EventTypeManager eventTypeManager)
           
 
Method Summary
 void createMailThread(String type, Long source, String emailAddress, String messageId)
          Remembers the given incoming MessageID.
 org.ofbiz.core.entity.GenericValue getAssociatedIssue(javax.mail.Message message)
          Looks for an issue associated with the given message.
 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.
 String getThreadType(Long eventTypeId)
          No longer used because we don't use store all outgoing notifications (see JRA-9979).
 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 the given incoming MessageID.
 void threadNotificationEmail(Email email, Issue issue)
          Thread the given email which is related to the given issue.
 void threadNotificationEmail(Email email, Long issueId)
          Thread the given email which is related to the given issue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailThreadManagerImpl

public MailThreadManagerImpl(OfBizDelegator ofBizDelegator,
                             IssueManager issueManager,
                             EventTypeManager eventTypeManager)
Method Detail

storeIncomingMessageId

public void storeIncomingMessageId(String messageId,
                                   String senderAddress,
                                   Issue issue,
                                   MailThreadManager.MailAction action)
Description copied from interface: MailThreadManager
Remembers the given incoming MessageID.

This is used when someone emails JIRA and CCs some else, and that person in turn does a reply-all. Such an email will not have the Issue Key in the subject.

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

createMailThread

public void createMailThread(String type,
                             Long source,
                             String emailAddress,
                             String messageId)
Description copied from interface: MailThreadManager
Remembers the given incoming MessageID.

As of v5.2, this should only be used for incoming messages, outgoing "Notification" messages are ignored. Instead we craft a special Message-ID that we can parse the Issue ID out of if someone replies to the notification.

Specified by:
createMailThread in interface MailThreadManager

threadNotificationEmail

public void threadNotificationEmail(Email email,
                                    Long issueId)
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
issueId - the issue that the email is about

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

getThreadType

public String getThreadType(Long eventTypeId)
Description copied from interface: MailThreadManager
No longer used because we don't use store all outgoing notifications (see JRA-9979).

Specified by:
getThreadType in interface MailThreadManager
Parameters:
eventTypeId - eventTypeId

getAssociatedIssue

public org.ofbiz.core.entity.GenericValue getAssociatedIssue(javax.mail.Message message)
Description copied from interface: MailThreadManager
Looks for an issue associated with the given message.

The "In-Reply-To" header of the message is parsed to see if it was sent by this JIRA server and if so we retrieve the Issue ID from it.

Specified by:
getAssociatedIssue in interface MailThreadManager
Parameters:
message - message to analyse
Returns:
associated issue or null if no issue is 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.

Specified by:
getAssociatedIssueObject in interface MailThreadManager
Parameters:
message - message to analyse
Returns:
associated issue or null if no issue is associated with this message.

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


Copyright © 2002-2014 Atlassian. All Rights Reserved.