cern.jira.emailhandler
Class NonQuotedCommentHandler

java.lang.Object
  extended by AbstractCommentHandler
      extended by cern.jira.emailhandler.NonQuotedCommentHandler

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 (i.e. lines that start with > or |).

See Also:
FullCommentHandler

Field Summary
private static Category log
           
private  java.util.Collection messages
           
private static java.lang.String OUTLOOK_QUOTED_FILE
           
 
Constructor Summary
NonQuotedCommentHandler()
           
 
Method Summary
protected  boolean attachHtmlParts(Part part)
          Attaches HTML parts.
protected  boolean attachPlainTextParts(Part part)
          Attaches plaintext parts.
protected  java.lang.String getEmailBody(Message message)
          Given a message, adds the entire message body as a comment to the first issue referenced in the subject.
private  java.util.Collection getOutlookQuoteSeparators()
           
private  boolean isOutlookQuotedLine(java.lang.String line)
           
private  boolean isQuotedLine(java.lang.String line)
           
private  boolean looksLikeAttribution(java.lang.String line)
           
 java.lang.String stripQuotedLines(java.lang.String body)
          Given an email body, strips quoted lines and the 'attribution' line that most mailers prepend (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Category log

OUTLOOK_QUOTED_FILE

private static final java.lang.String OUTLOOK_QUOTED_FILE
See Also:
Constant Field Values

messages

private java.util.Collection messages
Constructor Detail

NonQuotedCommentHandler

public NonQuotedCommentHandler()
Method Detail

getEmailBody

protected java.lang.String getEmailBody(Message message)
                                 throws MessagingException
Given a message, adds the entire message body as a comment to the first issue referenced in the subject.

Throws:
MessagingException

stripQuotedLines

public java.lang.String stripQuotedLines(java.lang.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:").


looksLikeAttribution

private boolean looksLikeAttribution(java.lang.String line)

isQuotedLine

private boolean isQuotedLine(java.lang.String line)

isOutlookQuotedLine

private boolean isOutlookQuotedLine(java.lang.String line)

getOutlookQuoteSeparators

private java.util.Collection getOutlookQuoteSeparators()

attachPlainTextParts

protected boolean attachPlainTextParts(Part part)
                                throws MessagingException,
                                       java.io.IOException
Attaches plaintext parts. Plain text parts must be kept if they are not empty.

Parameters:
part - the part being tested
Returns:
true if the part content is not empty, false otherwise
Throws:
MessagingException
java.io.IOException

attachHtmlParts

protected boolean attachHtmlParts(Part part)
                           throws MessagingException,
                                  java.io.IOException
Attaches HTML parts. 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.

Parameters:
part - the part being tested
Returns:
always false
Throws:
MessagingException
java.io.IOException