cern.jira.emailhandler
Class AdvancedCreateOrCommentHandler

java.lang.Object
  extended by AbstractMessageHandler
      extended by cern.jira.emailhandler.AdvancedCreateOrCommentHandler

public class AdvancedCreateOrCommentHandler
extends AbstractMessageHandler

This is the main handler class of the JIRA Advanced Mail Handler.

It permits to create a new issue, or add a comment to an existing issue, from an incoming message. If the recipient or subject contains a project key the message is added as a comment to that issue; in this case, many of the issue options can be specified directly in the email body. If no project key is found, a new issue is created in the specified project.

Version:
3.0 (19-3-2009)
Author:
Daniele Raffo on the basis of the CreateOrCommentHandler class, copyright (c) 2002-2006 Atlassian

Field Summary
 java.lang.String defaultIssueType
          Default type for new issues.
 java.lang.String defaultProjectKey
          Default project where new issues are created.
private static java.lang.String FALSE
           
 java.lang.String jiraEmail
          Regex for JIRA email address.
 java.lang.String jiraEmailAlias
          Regex for alias of JIRA email address.
private static java.lang.String KEY_ISSUETYPE
           
private static java.lang.String KEY_JIRAALIAS
           
private static java.lang.String KEY_JIRAEMAIL
           
private static java.lang.String KEY_PROJECT
           
private static java.lang.String KEY_QUOTES
           
private static Category log
           
 java.lang.String stripquotes
          If set (to anything), quoted text is removed from comments.
 
Constructor Summary
AdvancedCreateOrCommentHandler()
           
 
Method Summary
protected  boolean attachHtmlParts(Part part)
          Attaches HTML parts.
protected  boolean attachPlainTextParts(Part part)
          Attaches plaintext parts.
 boolean handleMessage(Message message)
           
 void init(java.util.Map params)
           
 
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

defaultProjectKey

public java.lang.String defaultProjectKey
Default project where new issues are created.


defaultIssueType

public java.lang.String defaultIssueType
Default type for new issues.


stripquotes

public java.lang.String stripquotes
If set (to anything), quoted text is removed from comments.


jiraEmail

public java.lang.String jiraEmail
Regex for JIRA email address.


jiraEmailAlias

public java.lang.String jiraEmailAlias
Regex for alias of JIRA email address.


KEY_PROJECT

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

KEY_ISSUETYPE

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

KEY_QUOTES

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

FALSE

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

KEY_JIRAEMAIL

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

KEY_JIRAALIAS

private static final java.lang.String KEY_JIRAALIAS
See Also:
Constant Field Values
Constructor Detail

AdvancedCreateOrCommentHandler

public AdvancedCreateOrCommentHandler()
Method Detail

init

public void init(java.util.Map params)

handleMessage

public boolean handleMessage(Message message)
                      throws MessagingException
Throws:
MessagingException

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 content. This method therefore is hard wired to always return false.

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

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 plain text part being tested
Returns:
true if content is not empty and must be attached
Throws:
MessagingException
java.io.IOException