use of org.sonarqube.ws.client.issue.AddCommentRequest in project sonarqube by SonarSource.
the class AddCommentAction method handle.
@Override
public void handle(Request request, Response response) {
userSession.checkLoggedIn();
AddCommentRequest wsRequest = toWsRequest(request);
try (DbSession dbSession = dbClient.openSession(false)) {
IssueDto issueDto = issueFinder.getByKey(dbSession, wsRequest.getIssue());
IssueChangeContext context = IssueChangeContext.createUser(new Date(system2.now()), userSession.getLogin());
DefaultIssue defaultIssue = issueDto.toDefaultIssue();
issueFieldsSetter.addComment(defaultIssue, wsRequest.getText(), context);
issueUpdater.saveIssue(dbSession, defaultIssue, context, wsRequest.getText());
responseWriter.write(defaultIssue.key(), request, response);
}
}
Aggregations