Esempio n. 1
0
 /**
  * groupKey를 통해 같은 코멘트그룹을 반환한다.
  *
  * @param groupKey
  * @param codeComments
  * @return
  */
 private List<CommitComment> commitCommentsGroupByKey(
     String groupKey, List<CommitComment> codeComments) {
   List<CommitComment> commitCommentGroups = new ArrayList<>();
   for (CommitComment commitComment : codeComments) {
     if (commitComment.groupKey().equals(groupKey)) {
       commitCommentGroups.add(commitComment);
     }
   }
   return commitCommentGroups;
 }
Esempio n. 2
0
 /**
  * groupKey를 통해 같은 코멘트그룹 목록을 반환한다. (같은 커밋, 같은 파일, 같은 라인의 댓글들)
  *
  * @param commitComments
  * @return
  */
 private Map<String, List<CommitComment>> sameTopicCommentGroups(
     List<CommitComment> commitComments) {
   Map<String, List<CommitComment>> commentGroup = new HashMap<>();
   for (CommitComment commitComment : commitComments) {
     commentGroup.put(
         commitComment.groupKey(),
         commitCommentsGroupByKey(commitComment.groupKey(), commitComments));
   }
   return commentGroup;
 }
Esempio n. 3
0
  /**
   * 답글목록을 부모글의 필드로 재할당한다.
   *
   * <p>commentGroup은 등록일순으로 오름차순 정렬되어 있는 상태이며 목록의 첫번째 코멘트를 부모글로 판단한다.
   *
   * @param commentGroup
   * @return
   */
  private List<CommitComment> reAssignReplyComments(Map<String, List<CommitComment>> commentGroup) {
    List<CommitComment> parentCommitComments = new ArrayList<>();

    for (List<CommitComment> commitComments : commentGroup.values()) {
      CommitComment parentComment = commitComments.get(0);
      if (hasReply(commitComments)) {
        parentComment.replies = replies(commitComments);
      }
      parentCommitComments.add(parentComment);
    }
    return parentCommitComments;
  }
Esempio n. 4
0
 /**
  * 코드 코멘트를 반환한다.
  *
  * @return
  */
 @Transient
 public List<CommitComment> getCommitComments() {
   return CommitComment.findByCommits(fromProject, pullRequestCommits);
 }