Interface MessageHandlerContext
- All Known Implementing Classes:
DefaultMessageHandlerContext
@PublicApi
public interface MessageHandlerContext
Well-behaved MessageHandler implementations should use as much as possible
this interface to create appropriate entities.
Depending on the mode the handler is run in the calls will be mutative for JIRA (in normal
production run) or will create just dummy objects when run while testing message handler
from administration screen.
- Since:
- v5.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateAttachment(File file, String filename, String contentType, ApplicationUser author, Issue issue) Creates attachment (when run in real mode) or does nothing if run in dry run mode.createComment(Issue issue, ApplicationUser author, String body, boolean dispatchEvent) Creates a new issue comment in JIRA or a dummy comment in dry run modecreateIssue(ApplicationUser reporter, Issue issue) Creates a new issue in JIRA or a dummy issue in dry run modeCreates user in JIRA or just dummy user if run in dry run modeboolean
-
Method Details
-
createUser
ApplicationUser createUser(String username, String password, String email, String fullname, Integer userEventType) throws PermissionException, CreateException Creates user in JIRA or just dummy user if run in dry run mode- Parameters:
username-password-email-fullname-userEventType-- Returns:
- Throws:
PermissionExceptionCreateException
-
createComment
Creates a new issue comment in JIRA or a dummy comment in dry run mode- Parameters:
issue-author-body-dispatchEvent-- Returns:
-
createIssue
Creates a new issue in JIRA or a dummy issue in dry run mode- Parameters:
reporter-issue-- Returns:
- Throws:
CreateException
-
createAttachment
ChangeItemBean createAttachment(File file, String filename, String contentType, ApplicationUser author, Issue issue) throws AttachmentException Creates attachment (when run in real mode) or does nothing if run in dry run mode.- Parameters:
file-filename-contentType-author-issue-- Returns:
- a bean which should be passed later (if run in real mode) to
IssueUpdater.doUpdate(com.atlassian.jira.issue.util.IssueUpdateBean, boolean) - Throws:
AttachmentException
-
isRealRun
boolean isRealRun()- Returns:
trueif the context works in production mode (when handlers are run from the service) orfalseif runs
-
getMonitor
MessageHandlerExecutionMonitor getMonitor()- Returns:
- place where message handler should report its progress and problems with processing the message. Depending on the run mode it will be either logged in the log file (when real run) or showed to the user in UI (when run in test mode via configuring handler from UI)
-