com.atlassian.jira.service.util.handler
Class AbstractMessageHandler

java.lang.Object
  extended by com.atlassian.jira.service.util.handler.AbstractMessageHandler
All Implemented Interfaces:
MessageHandler
Direct Known Subclasses:
AbstractCommentHandler, CreateIssueHandler, CreateOrCommentHandler, CVSLogHandler, EmailHandler

public abstract class AbstractMessageHandler
extends java.lang.Object
implements MessageHandler

An AbstractMessageHandler that stores the parameter map.


Field Summary
 java.lang.String catchEmail
          New issues without this receipient are ignored.
 boolean createUsers
          Whether to create users if they do not exist
protected static java.lang.String KEY_CATCHEMAIL
           
protected static java.lang.String KEY_CREATEUSERS
           
protected static java.lang.String KEY_REPORTER
           
protected  java.util.Map params
           
 java.lang.String reporteruserName
          Username of default reporter, if sender not recognized.
 
Constructor Summary
AbstractMessageHandler()
           
 
Method Summary
protected  void createAttachmentsForMessage(javax.mail.Message message, org.ofbiz.core.entity.GenericValue issue)
          Loops through all the Parts, and for each one of type Part.ATTACHMENT, call createAttachmentWithPart(BodyPart, GenericValue).
protected  void createAttachmentWithPart(javax.mail.BodyPart part, org.ofbiz.core.entity.GenericValue issue)
          Create an attachment for a particular mime-part.
protected  org.ofbiz.core.entity.GenericValue getAssociatedIssue(javax.mail.Message message)
           
protected  java.io.File getFileFromPart(javax.mail.BodyPart part, org.ofbiz.core.entity.GenericValue issue)
           
protected  com.opensymphony.user.User getReporter(javax.mail.Message message)
          Get the reporter from the email address who sent the message, or else create a new user if creating users is set to true, or use the default reporter if one is specified.
abstract  boolean handleMessage(javax.mail.Message message)
          To be implemented in sub-classes
 void init(java.util.Map params)
           
protected  void recordMessageId(java.lang.String type, javax.mail.Message message, java.lang.Long issueId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_REPORTER

protected static final java.lang.String KEY_REPORTER
See Also:
Constant Field Values

KEY_CATCHEMAIL

protected static final java.lang.String KEY_CATCHEMAIL
See Also:
Constant Field Values

KEY_CREATEUSERS

protected static final java.lang.String KEY_CREATEUSERS
See Also:
Constant Field Values

params

protected java.util.Map params

reporteruserName

public java.lang.String reporteruserName
Username of default reporter, if sender not recognized.


catchEmail

public java.lang.String catchEmail
New issues without this receipient are ignored.


createUsers

public boolean createUsers
Whether to create users if they do not exist

Constructor Detail

AbstractMessageHandler

public AbstractMessageHandler()
Method Detail

init

public void init(java.util.Map params)
Specified by:
init in interface MessageHandler

handleMessage

public abstract boolean handleMessage(javax.mail.Message message)
                               throws javax.mail.MessagingException
To be implemented in sub-classes

Specified by:
handleMessage in interface MessageHandler
Throws:
javax.mail.MessagingException

createAttachmentsForMessage

protected void createAttachmentsForMessage(javax.mail.Message message,
                                           org.ofbiz.core.entity.GenericValue issue)
                                    throws java.io.IOException,
                                           javax.mail.MessagingException
Loops through all the Parts, and for each one of type Part.ATTACHMENT, call createAttachmentWithPart(BodyPart, GenericValue).

Parameters:
message - The multipart message to search for attachments in
issue - The issue to create attachments in
Throws:
java.io.IOException - If there is a problem creating the attachment
javax.mail.MessagingException - If there is a problem reading the message

createAttachmentWithPart

protected void createAttachmentWithPart(javax.mail.BodyPart part,
                                        org.ofbiz.core.entity.GenericValue issue)
                                 throws java.io.IOException
Create an attachment for a particular mime-part. The BodyPart must be of type Part.ATTACHMENT.

Parameters:
part - The part of disposition Part.ATTACHMENT to create the attachment from
issue - The issue to create attachments in
Throws:
java.io.IOException - If there is a problem creating the attachment in the filesystem

getFileFromPart

protected java.io.File getFileFromPart(javax.mail.BodyPart part,
                                       org.ofbiz.core.entity.GenericValue issue)
                                throws java.io.IOException,
                                       javax.mail.MessagingException,
                                       org.ofbiz.core.entity.GenericEntityException
Throws:
java.io.IOException
javax.mail.MessagingException
org.ofbiz.core.entity.GenericEntityException

getReporter

protected com.opensymphony.user.User getReporter(javax.mail.Message message)
                                          throws javax.mail.MessagingException
Get the reporter from the email address who sent the message, or else create a new user if creating users is set to true, or use the default reporter if one is specified.

If neither of these are found, return null.

Parameters:
message - The email message to search through.
Returns:
The user who sent the email, or the default reporter, or null.
Throws:
javax.mail.MessagingException - If there is a problem getting the user who created the message.

recordMessageId

protected void recordMessageId(java.lang.String type,
                               javax.mail.Message message,
                               java.lang.Long issueId)
                        throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getAssociatedIssue

protected org.ofbiz.core.entity.GenericValue getAssociatedIssue(javax.mail.Message message)


Copyright © 2002-2006 Atlassian. All Rights Reserved.