Working with comments on issues
In this recipe, we will see how to manage commenting on issues using the JIRA API.
Let us have a look at the three major operations—creating, editing, and deleting comments. We will also have a look at how to restrict the comment visibility to a specific group of people or to a project role.
How to do it...
JIRA uses the CommentService class to manage the comments on an issue.
Creating comments on issues
A comment can be added on to an issue in a few simple steps:
Create
commentParamsof typeCommentService.CommentParameters, with the appropriate values. You can do it with the help ofCommentService.CommentParameters.CommentParametersBuilder, as shown here:CommentService.CommentParameters commentParams = new CommentService.CommentParameters .CommentParametersBuilder().issue(issue) .body(commentString).build();
Here,
commentStringis the comment we are adding andissueis the issue on which the comment is added.Validate...