com.atlassian.jira.plugins.mail.handlers
Class NonQuotedCommentHandler

java.lang.Object
  extended by com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler
      extended by com.atlassian.jira.plugins.mail.handlers.AbstractCommentHandler
          extended by com.atlassian.jira.plugins.mail.handlers.NonQuotedCommentHandler
All Implemented Interfaces:
MessageHandler

public class NonQuotedCommentHandler
extends AbstractCommentHandler

This handler adds the body of the email as a comment, using the subject to determine which issue to add the comment to.

The difference between this and FullCommentHandler is that this will strip any quoted lines from the email (ie lines that start with > or |).

See Also:
FullCommentHandler

Field Summary
 
Fields inherited from class com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler
applicationProperties, bulk, catchEmail, CONTENT_TYPE_TEXT, createUsers, deleteEmail, HEADER_IN_REPLY_TO, HEADER_MESSAGE_ID, KEY_BULK, KEY_CATCHEMAIL, KEY_CREATEUSERS, KEY_FINGER_PRINT, KEY_NOTIFYUSERS, KEY_REPORTER, log, messageUserProcessor, notifyUsers, params, reporteruserName, userManager, VALUE_BULK_ACCEPT, VALUE_BULK_DELETE, VALUE_BULK_FORWARD, VALUE_BULK_IGNORE, VALUE_FINGER_PRINT_ACCEPT, VALUE_FINGER_PRINT_FORWARD, VALUE_FINGER_PRINT_IGNORE
 
Constructor Summary
NonQuotedCommentHandler()
           
NonQuotedCommentHandler(PermissionManager permissionManager, IssueUpdater issueUpdater, UserManager userManager, ApplicationProperties applicationProperties, JiraApplicationContext jiraApplicationContext, MailLoggingManager mailLoggingManager, MessageUserProcessor messageUserProcessor)
           
 
Method Summary
protected  boolean attachHtmlParts(javax.mail.Part part)
          Comments never wish to keep html parts that are not attachments as they extract the plain text part and use that as the content.
protected  boolean attachPlainTextParts(javax.mail.Part part)
          Plain text parts must be kept if they arent empty.
protected  String getEmailBody(javax.mail.Message message)
          Given a message - this handler will add the entire message body as a comment to the first issue referenced in the subject.
 String stripQuotedLines(String body)
          Given an email body, strips quoted lines and the 'attribution' line that most mailers prepend (eg.
 
Methods inherited from class com.atlassian.jira.plugins.mail.handlers.AbstractCommentHandler
getEventTypeId, handleMessage
 
Methods inherited from class com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler
attachAttachmentsParts, attachInlineParts, attachMessagePart, attachRelatedPart, canHandleMessage, createAttachmentsForMessage, createAttachmentWithPart, createUserForReporter, getAssociatedIssue, getFileFromPart, getFilenameForAttachment, getI18nBean, getMessageUserProcessor, getPrecedenceHeader, getReporter, init, isAutoSubmitted, isDeliveryStatus, recordMessageId, renameFileIfInvalid, shouldAttach
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonQuotedCommentHandler

public NonQuotedCommentHandler()

NonQuotedCommentHandler

public NonQuotedCommentHandler(PermissionManager permissionManager,
                               IssueUpdater issueUpdater,
                               UserManager userManager,
                               ApplicationProperties applicationProperties,
                               JiraApplicationContext jiraApplicationContext,
                               MailLoggingManager mailLoggingManager,
                               MessageUserProcessor messageUserProcessor)
Method Detail

getEmailBody

protected String getEmailBody(javax.mail.Message message)
                       throws javax.mail.MessagingException
Given a message - this handler will add the entire message body as a comment to the first issue referenced in the subject.

Specified by:
getEmailBody in class AbstractCommentHandler
Throws:
javax.mail.MessagingException

stripQuotedLines

public String stripQuotedLines(String body)
Given an email body, strips quoted lines and the 'attribution' line that most mailers prepend (eg. "On Wed 21 Oct 2004, Joe Bloggs wrote:").

Parameters:
body - email body
Returns:
stripped email body

attachPlainTextParts

protected boolean attachPlainTextParts(javax.mail.Part part)
                                throws javax.mail.MessagingException,
                                       IOException
Plain text parts must be kept if they arent empty.

Specified by:
attachPlainTextParts in class AbstractMessageHandler
Parameters:
part - The part being tested.
Returns:
Returns true if the part content is not empty, otherwise returns false.
Throws:
javax.mail.MessagingException - if javamail complains
IOException - if javamail complains

attachHtmlParts

protected boolean attachHtmlParts(javax.mail.Part part)
                           throws javax.mail.MessagingException,
                                  IOException
Comments never wish to keep html parts that are not attachments as they extract the plain text part and use that as the content. This method therefore is hard wired to always return false.

Specified by:
attachHtmlParts in class AbstractMessageHandler
Parameters:
part - The part being tested.
Returns:
Always returns false
Throws:
javax.mail.MessagingException
IOException


Copyright © 2002-2012 Atlassian. All Rights Reserved.