use of org.sonarqube.ws.Issues.Comments in project sonarqube by SonarSource.
the class SearchResponseFormat method formatIssueComments.
private static void formatIssueComments(SearchResponseData data, Issue.Builder wsIssue, IssueDto dto) {
Comments.Builder wsComments = Comments.newBuilder();
List<IssueChangeDto> comments = data.getCommentsForIssueKey(dto.getKey());
if (comments != null) {
Comment.Builder wsComment = Comment.newBuilder();
for (IssueChangeDto comment : comments) {
String markdown = comment.getChangeData();
wsComment.clear().setKey(comment.getKey()).setUpdatable(data.isUpdatableComment(comment.getKey())).setCreatedAt(DateUtils.formatDateTime(new Date(comment.getIssueChangeCreationDate())));
ofNullable(data.getUserByUuid(comment.getUserUuid())).ifPresent(user -> wsComment.setLogin(user.getLogin()));
if (markdown != null) {
wsComment.setHtmlText(Markdown.convertToHtml(markdown)).setMarkdown(markdown);
}
wsComments.addComments(wsComment);
}
}
wsIssue.setComments(wsComments);
}
Aggregations