Class DefaultMessageHandlerContext
java.lang.Object
com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext
- All Implemented Interfaces:
MessageHandlerContext
This class has been made public only to allow easy unit testing by tests from other packages. This is the standard
implementation which dispatches calls to appropriate JIRA managers.
This implementation respects the character limit. In case issue description/environment or comment length is too long the text is trimmed to match the size
and original text is added as issue attachment, however, if attachments are off or the file with extracted text exceeds the size limit the attachment
won't be added and info will be issued in the monitor.
- Since:
- v5.0
-
Constructor Summary
ConstructorDescriptionDefaultMessageHandlerContext
(CommentManager commentManager, MessageHandlerExecutionMonitor monitor, IssueManager issueManager, AttachmentManager attachmentManager) Deprecated.DefaultMessageHandlerContext
(CommentManager commentManager, MessageHandlerExecutionMonitor monitor, IssueManager issueManager, AttachmentManager attachmentManager, TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, PermissionManager permissionManager, ApplicationProperties applicationProperties, ApplicationRoleManager applicationRoleManager, UserService userService, AttachmentConfigManager attachmentConfigManager) -
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
-
Constructor Details
-
DefaultMessageHandlerContext
public DefaultMessageHandlerContext(CommentManager commentManager, MessageHandlerExecutionMonitor monitor, IssueManager issueManager, AttachmentManager attachmentManager, TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, PermissionManager permissionManager, ApplicationProperties applicationProperties, ApplicationRoleManager applicationRoleManager, UserService userService, AttachmentConfigManager attachmentConfigManager) -
DefaultMessageHandlerContext
@Deprecated public DefaultMessageHandlerContext(CommentManager commentManager, MessageHandlerExecutionMonitor monitor, IssueManager issueManager, AttachmentManager attachmentManager) Used in jira-mail-plugin tests.
-
-
Method Details
-
createUser
public ApplicationUser createUser(String username, String password, String email, String fullname, Integer userEventType) throws PermissionException, CreateException Description copied from interface:MessageHandlerContext
Creates user in JIRA or just dummy user if run in dry run mode- Specified by:
createUser
in interfaceMessageHandlerContext
- Returns:
- Throws:
PermissionException
CreateException
-
createComment
public Comment createComment(Issue issue, ApplicationUser author, String body, boolean dispatchEvent) Description copied from interface:MessageHandlerContext
Creates a new issue comment in JIRA or a dummy comment in dry run mode- Specified by:
createComment
in interfaceMessageHandlerContext
- Returns:
-
createIssue
Description copied from interface:MessageHandlerContext
Creates a new issue in JIRA or a dummy issue in dry run mode- Specified by:
createIssue
in interfaceMessageHandlerContext
- Returns:
- Throws:
CreateException
-
createAttachment
public ChangeItemBean createAttachment(File file, String filename, String contentType, ApplicationUser author, Issue issue) throws AttachmentException Description copied from interface:MessageHandlerContext
Creates attachment (when run in real mode) or does nothing if run in dry run mode.- Specified by:
createAttachment
in interfaceMessageHandlerContext
- 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
public boolean isRealRun()- Specified by:
isRealRun
in interfaceMessageHandlerContext
- Returns:
true
if the context works in production mode (when handlers are run from the service) orfalse
if runs
-
getMonitor
- Specified by:
getMonitor
in interfaceMessageHandlerContext
- 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)
-
DefaultMessageHandlerContext(CommentManager, MessageHandlerExecutionMonitor, IssueManager, AttachmentManager, TextFieldCharacterLengthValidator, PermissionManager, ApplicationProperties, ApplicationRoleManager, UserService, AttachmentConfigManager)