protected Vertex saveCommentHelper(final Comment comment, final String edgetype) { Vertex node = getOrCreateComment(comment.getId()); setProperty(node, PropertyName.BODY, comment.getBody()); setProperty(node, PropertyName.BODY_HTML, comment.getBodyHtml()); setProperty(node, PropertyName.BODY_TEXT, comment.getBodyText()); setProperty(node, PropertyName.URL, comment.getUrl()); setProperty(node, PropertyName.GITHUB_ID, comment.getId()); setProperty(node, PropertyName.CREATED_AT, comment.getCreatedAt()); setProperty(node, PropertyName.UPDATED_AT, comment.getUpdatedAt()); if (comment.getUser() != null) { Vertex user = getOrCreateUser(comment.getUser()); createEdgeIfNotExist(user, node, edgetype); } return node; }
/** * Edit gist comment * * @param comment * @return edited comment * @throws IOException */ public Comment editComment(Comment comment) throws IOException { if (comment == null) throw new IllegalArgumentException("Comment cannot be null"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_GISTS + SEGMENT_COMMENTS); uri.append('/').append(comment.getId()); return client.post(uri.toString(), comment, Comment.class); }
@Override public List<Comment> getComments() { final List<Comment> comments = new ArrayList<>(); try { final List<String> specifics = new ArrayList<>(); for (final CommitComment commitComment : pullRequestService.getComments( repository, violationCommentsToGitHubApi.getPullRequestId())) { comments.add( new Comment( Long.toString(commitComment.getId()), commitComment.getBody(), TYPE_DIFF, specifics)); } for (final org.eclipse.egit.github.core.Comment comment : issueSerivce.getComments(repository, violationCommentsToGitHubApi.getPullRequestId())) { comments.add( new Comment(Long.toString(comment.getId()), comment.getBody(), TYPE_PR, specifics)); } } catch (final Exception e) { violationsLogger.log(SEVERE, e.getMessage(), e); } return comments; }
/** * Edit issue comment * * @param user * @param repository * @param comment * @return edited comment * @throws IOException */ private Comment editComment(String repoId, Comment comment) throws IOException { if (comment == null) throw new IllegalArgumentException("Comment cannot be null"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(repoId); uri.append(SEGMENT_ISSUES).append(SEGMENT_COMMENTS); uri.append('/').append(comment.getId()); return client.post(uri.toString(), comment, Comment.class); }
List<CommitComment> commitComments = pullRequestService.getComments(getRepository(), pullRequest.getNumber()); for (Comment comment : commitComments) { if (!commentIds.contains(comment.getId())) { newComments.add(comment); commentIds.add(comment.getId()); commentIdToPullRequest.put(comment.getId(), pullRequest); if (!commentIds.contains(comment.getId())) { newComments.add(comment); commentIds.add(comment.getId()); commentIdToPullRequest.put(comment.getId(), pullRequest); e.getIn().setHeader(GitHubConstants.GITHUB_PULLREQUEST, commentIdToPullRequest.get(newComment.getId()));
private void deleteComment(Comment comment) { try { this.issueService.deleteComment(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), comment.getId()); } catch (IOException e1) { } }