Skip to content

Instantly share code, notes, and snippets.

@jechlin
Last active August 29, 2015 14:13
Show Gist options
  • Save jechlin/2824046dd7a4ada6bc3e to your computer and use it in GitHub Desktop.
Save jechlin/2824046dd7a4ada6bc3e to your computer and use it in GitHub Desktop.
package examples.answers
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.IssueEventDispatcher
import com.atlassian.jira.event.type.EventType
import groovy.util.logging.Log4j
import org.apache.log4j.Level
@Log4j
public class FireACommentOnResolve extends AbstractIssueEventListener{
@Override
void workflowEvent(IssueEvent event) {
log.setLevel(Level.DEBUG)
if (event.eventTypeId == EventType.ISSUE_GENERICEVENT_ID && event.getComment()) {
def issue = event.issue
IssueEventDispatcher.dispatchEvent(EventType.ISSUE_COMMENTED_ID as Long, issue, event.getUser(), event.getComment(), null, null);
}
if (event.eventTypeId == EventType.ISSUE_COMMENTED_ID && event.getComment()) {
log.debug("comment event fired with comment: ${event.getComment()}")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment