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.
JIRA uses the CommentService
class to manage the comments on an issue.
A comment can be added on to an issue in a few simple steps:
Create
commentParams
of 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,
commentString
is the comment we are adding andissue
is the issue on which the comment is added.Validate...