this.notificationService = notificationService;
}
@Override
public CodeReviewComment addComment(Long reviewId, int lineNumber, String body) throws NotFoundException {
CodeReview review = get(reviewId);
JCUser currentUser = userService.getCurrentUser();
permissionService.checkPermission(
review.getTopic().getBranch().getId(),
AclClassName.BRANCH,
BranchPermission.LEAVE_COMMENTS_IN_CODE_REVIEW);
CodeReviewComment comment = new CodeReviewComment();
comment.setLineNumber(lineNumber);
comment.setBody(body);
comment.setCreationDate(new DateTime(System.currentTimeMillis()));
comment.setAuthor(currentUser);
if (currentUser.isAutosubscribe()) {
review.getSubscribers().add(currentUser);
}
review.addComment(comment);
getDao().saveOrUpdate(review);
notificationService.subscribedEntityChanged(review);
return comment;
}