Package com.google.gerrit.server
Class CommentsUtil
- java.lang.Object
-
- com.google.gerrit.server.CommentsUtil
-
public class CommentsUtil extends Object
Utility functions to manipulate Comments.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.Ordering<CommentInfo>
COMMENT_INFO_ORDER
static com.google.common.collect.Ordering<Comment>
COMMENT_ORDER
-
Method Summary
-
-
-
Field Detail
-
COMMENT_ORDER
public static final com.google.common.collect.Ordering<Comment> COMMENT_ORDER
-
COMMENT_INFO_ORDER
public static final com.google.common.collect.Ordering<CommentInfo> COMMENT_INFO_ORDER
-
-
Method Detail
-
getCommentPsId
public static PatchSet.Id getCommentPsId(Change.Id changeId, Comment comment)
-
newComment
public Comment newComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, Boolean unresolved, String parentUuid) throws UnprocessableEntityException
- Throws:
UnprocessableEntityException
-
newRobotComment
public RobotComment newRobotComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, String robotId, String robotRunId)
-
getPublished
public Optional<Comment> getPublished(ChangeNotes notes, Comment.Key key)
-
getDraft
public Optional<Comment> getDraft(ChangeNotes notes, IdentifiedUser user, Comment.Key key)
-
publishedByChange
public List<Comment> publishedByChange(ChangeNotes notes)
-
robotCommentsByChange
public List<RobotComment> robotCommentsByChange(ChangeNotes notes)
-
draftByChange
public List<Comment> draftByChange(ChangeNotes notes)
-
byPatchSet
public List<Comment> byPatchSet(ChangeNotes notes, PatchSet.Id psId)
-
publishedByChangeFile
public List<Comment> publishedByChangeFile(ChangeNotes notes, String file)
-
publishedByPatchSet
public List<Comment> publishedByPatchSet(ChangeNotes notes, PatchSet.Id psId)
-
robotCommentsByPatchSet
public List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId)
-
linkCommentsToChangeMessages
public static void linkCommentsToChangeMessages(List<? extends CommentInfo> comments, List<ChangeMessage> changeMessages)
This method populates the "changeMessageId" field of the comments parameter based on timestamp matching. The comments objects will be modified.Each comment will be matched to the nearest next change message in timestamp
- Parameters:
comments
- the list of commentschangeMessages
- list of change messages
-
draftByPatchSetAuthor
public List<Comment> draftByPatchSetAuthor(PatchSet.Id psId, Account.Id author, ChangeNotes notes)
-
draftByChangeFileAuthor
public List<Comment> draftByChangeFileAuthor(ChangeNotes notes, String file, Account.Id author)
-
draftByChangeAuthor
public List<Comment> draftByChangeAuthor(ChangeNotes notes, Account.Id author)
-
putComments
public void putComments(ChangeUpdate update, Comment.Status status, Iterable<Comment> comments)
-
putRobotComments
public void putRobotComments(ChangeUpdate update, Iterable<RobotComment> comments)
-
deleteComments
public void deleteComments(ChangeUpdate update, Iterable<Comment> comments)
-
deleteCommentByRewritingHistory
public void deleteCommentByRewritingHistory(ChangeUpdate update, Comment.Key commentKey, String newMessage)
-
setCommentCommitId
public static void setCommentCommitId(Comment c, PatchListCache cache, Change change, PatchSet ps) throws PatchListNotAvailableException
- Throws:
PatchListNotAvailableException
-
getDraftRefs
public Collection<org.eclipse.jgit.lib.Ref> getDraftRefs(Change.Id changeId)
Get NoteDb draft refs for a change.Works if NoteDb is not enabled, but the results are not meaningful.
This is just a simple ref scan, so the results may potentially include refs for zombie draft comments. A zombie draft is one which has been published but the write to delete the draft ref from All-Users failed.
- Parameters:
changeId
- change ID.- Returns:
- raw refs from All-Users repo.
-
-