|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler
public class CreateIssueHandler
A message handler to create a new issue from an incoming message. Note: requires public noarg constructor as this class is instantiated by reflection
Field Summary | |
---|---|
static String |
CC_ASSIGNEE
|
static String |
CC_WATCHER
|
boolean |
ccAssignee
|
boolean |
ccWatcher
|
static boolean |
DEFAULT_CC_ASSIGNEE
|
String |
issueType
|
static String |
KEY_ISSUETYPE
|
static String |
KEY_PROJECT
|
String |
projectKey
|
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, permissionManager, 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 | |
---|---|
CreateIssueHandler()
|
Method Summary | |
---|---|
void |
addCcWatchersToIssue(javax.mail.Message message,
Issue issue,
com.atlassian.crowd.embedded.api.User reporter,
MessageHandlerContext context,
MessageHandlerExecutionMonitor messageHandlerExecutionMonitor)
Adds all valid users that are in the email to and cc fields as watchers of the issue. |
protected boolean |
attachHtmlParts(javax.mail.Part part)
Html parts are not attached but rather potentially form the source of issue text. |
protected boolean |
attachPlainTextParts(javax.mail.Part part)
Text parts are not attached but rather potentially form the source of issue text. |
Collection<com.atlassian.crowd.embedded.api.User> |
getAllUsersFromEmails(javax.mail.Address[] addresses)
|
static com.atlassian.crowd.embedded.api.User |
getFirstValidAssignee(javax.mail.Address[] addresses,
Project project)
Given an array of addresses, this method returns the first valid assignee for the appropriate project. |
protected Project |
getProject(javax.mail.Message message)
|
protected ProjectManager |
getProjectManager()
|
boolean |
handleMessage(javax.mail.Message message,
MessageHandlerContext context)
Perform the specific work of this handler for the given message. |
protected boolean |
hasValidIssueType()
|
void |
init(Map<String,String> params,
MessageHandlerErrorCollector errorCollector)
Will be called before any messages are to be handled. |
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, isAutoSubmitted, isDeliveryStatus, recordMessageId, renameFileIfInvalid, shouldAttach |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY_PROJECT
public static final String KEY_ISSUETYPE
public static final String CC_ASSIGNEE
public static final String CC_WATCHER
public String projectKey
public String issueType
public static final boolean DEFAULT_CC_ASSIGNEE
public boolean ccAssignee
public boolean ccWatcher
Constructor Detail |
---|
public CreateIssueHandler()
Method Detail |
---|
public void init(Map<String,String> params, MessageHandlerErrorCollector errorCollector)
MessageHandler
init
in interface MessageHandler
init
in class AbstractMessageHandler
params
- configuration.errorCollector
- potential problems encountered during initialization of the handler
should be reported here. Depending on the run mode it may be e.g. displayed back to the user (when handler
is tested from UI) or logged to the file .public boolean handleMessage(javax.mail.Message message, MessageHandlerContext context) throws javax.mail.MessagingException
AbstractMessageHandler
handleMessage
in interface MessageHandler
handleMessage
in class AbstractMessageHandler
message
- the message to check for handling.context
- user-friendly message handler should utilize this interface
to create issue, comments, users and provide feedback information about messages being
processed and problems being encountered. While MessageHandler-s are run
from UI (in TEST / dry-run mode) such invocations are not mutative (they do not create any
JIRA entities) and information provided by the handler is displayed back to the user
as a summary of the dry-run.
javax.mail.MessagingException
- if anything went wrong.public void addCcWatchersToIssue(javax.mail.Message message, Issue issue, com.atlassian.crowd.embedded.api.User reporter, MessageHandlerContext context, MessageHandlerExecutionMonitor messageHandlerExecutionMonitor) throws javax.mail.MessagingException
message
- message to extract the email addresses fromissue
- issue to add the watchers toreporter
- context
- messageHandlerExecutionMonitor
- @throws MessagingException message errors
javax.mail.MessagingException
public Collection<com.atlassian.crowd.embedded.api.User> getAllUsersFromEmails(javax.mail.Address[] addresses)
protected Project getProject(javax.mail.Message message)
protected boolean hasValidIssueType()
protected ProjectManager getProjectManager()
public static com.atlassian.crowd.embedded.api.User getFirstValidAssignee(javax.mail.Address[] addresses, Project project)
addresses
- array of addressesproject
- project generic value
protected boolean attachPlainTextParts(javax.mail.Part part) throws javax.mail.MessagingException, IOException
attachPlainTextParts
in class AbstractMessageHandler
part
- The part which will have a content type of text/plain to be tested.
javax.mail.MessagingException
IOException
protected boolean attachHtmlParts(javax.mail.Part part) throws javax.mail.MessagingException, IOException
attachHtmlParts
in class AbstractMessageHandler
part
- The part which will have a content type of text/html to be tested.
javax.mail.MessagingException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |