com.atlassian.jira.plugins.mail.handlers
Class DryRunMessageHandlerContext

java.lang.Object
  extended by com.atlassian.jira.plugins.mail.handlers.DryRunMessageHandlerContext
All Implemented Interfaces:
MessageHandlerContext

public class DryRunMessageHandlerContext
extends Object
implements MessageHandlerContext

The context used in Test mode of MessageHandlers -> when the output from the run is shown back to the user.

Since:
v5.0

Constructor Summary
DryRunMessageHandlerContext(MessageHandlerExecutionMonitor messageHandlerExecutionMonitor)
           
 
Method Summary
 ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, Issue issue)
          Creates attachment (when run in real mode) or does nothing if run in dry run mode.
 Comment createComment(Issue issue, com.atlassian.crowd.embedded.api.User author, String body, boolean dispatchEvent)
          Creates a new issue comment in JIRA or a dummy comment in dry run mode
 Issue createIssue(com.atlassian.crowd.embedded.api.User reporter, Issue issue)
          Creates a new issue in JIRA or a dummy issue in dry run mode
 com.atlassian.crowd.embedded.api.User createUser(String username, String password, String emailAddress, String displayName, Integer userEventType)
          Creates user in JIRA or just dummy user if run in dry run mode
 MessageHandlerExecutionMonitor getMonitor()
           
 int getNumCreatedAttachments()
           
 int getNumCreatedComments()
           
 int getNumCreatedIssues()
           
 int getNumCreatedUsers()
           
 boolean isRealRun()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DryRunMessageHandlerContext

public DryRunMessageHandlerContext(MessageHandlerExecutionMonitor messageHandlerExecutionMonitor)
Method Detail

createUser

public com.atlassian.crowd.embedded.api.User createUser(String username,
                                                        String password,
                                                        String emailAddress,
                                                        String displayName,
                                                        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 interface MessageHandlerContext
Returns:
Throws:
PermissionException
CreateException

isRealRun

public boolean isRealRun()
Specified by:
isRealRun in interface MessageHandlerContext
Returns:
true if the context works in production mode (when handlers are run from the service) or false if runs

createComment

public Comment createComment(Issue issue,
                             com.atlassian.crowd.embedded.api.User 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 interface MessageHandlerContext
Returns:

createIssue

public Issue createIssue(com.atlassian.crowd.embedded.api.User reporter,
                         Issue issue)
                  throws CreateException
Description copied from interface: MessageHandlerContext
Creates a new issue in JIRA or a dummy issue in dry run mode

Specified by:
createIssue in interface MessageHandlerContext
Returns:
Throws:
CreateException

createAttachment

public ChangeItemBean createAttachment(File file,
                                       String filename,
                                       String contentType,
                                       com.atlassian.crowd.embedded.api.User 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 interface MessageHandlerContext
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

getMonitor

public MessageHandlerExecutionMonitor getMonitor()
Specified by:
getMonitor in interface MessageHandlerContext
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)

getNumCreatedIssues

public int getNumCreatedIssues()

getNumCreatedComments

public int getNumCreatedComments()

getNumCreatedUsers

public int getNumCreatedUsers()

getNumCreatedAttachments

public int getNumCreatedAttachments()


Copyright © 2002-2012 Atlassian. All Rights Reserved.