In this recipe, we will see how to manage comments on an issue.
Adding a comment on an issue using SOAP can be done as follows:
Create a
RemoteCommentobject
and set the necessary fields using the setter methods.final RemoteComment comment = new RemoteComment(); comment.setBody(COMMENT_BODY); //comment.setRoleLevel(ROLE_LEVEL); // Id of your project role comment.setGroupLevel(null); // Make it visible to all
Note that the ID shouldn't be set on the object as it will be generated automatically when the comment is created on the issue. Also, the visibility can be set only for a group or for a role, not for both at the same time.
Add the comment to the issue:
jiraSoapService.addComment(authToken, ISSUE_KEY, comment);
Comments on an issue can be retrieved using the
getComments
method, which returns an array ofRemoteComment
objects.RemoteComment[] comments = jiraSoapService.getComments...