public class CommentsUtil extends Object
These methods either query for and update Comments in the NoteDb or ReviewDb, depending on the state of the NotesMigration.
| Modifier and Type | Field and Description |
|---|---|
static com.google.common.collect.Ordering<CommentInfo> |
COMMENT_INFO_ORDER |
static com.google.common.collect.Ordering<Comment> |
COMMENT_ORDER |
public static final com.google.common.collect.Ordering<Comment> COMMENT_ORDER
public static final com.google.common.collect.Ordering<CommentInfo> COMMENT_INFO_ORDER
public static PatchSet.Id getCommentPsId(Change.Id changeId, Comment comment)
public Comment newComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, Boolean unresolved, String parentUuid) throws com.google.gwtorm.server.OrmException, UnprocessableEntityException
com.google.gwtorm.server.OrmExceptionUnprocessableEntityExceptionpublic RobotComment newRobotComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, String robotId, String robotRunId)
public Optional<Comment> getPublished(ReviewDb db, ChangeNotes notes, Comment.Key key) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic Optional<Comment> getDraft(ReviewDb db, ChangeNotes notes, IdentifiedUser user, Comment.Key key) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> publishedByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<RobotComment> robotCommentsByChange(ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> draftByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> publishedByChangeFile(ReviewDb db, ChangeNotes notes, Change.Id changeId, String file) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> publishedByPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> draftByPatchSetAuthor(ReviewDb db, PatchSet.Id psId, Account.Id author, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> draftByChangeFileAuthor(ReviewDb db, ChangeNotes notes, String file, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic List<Comment> draftByChangeAuthor(ReviewDb db, ChangeNotes notes, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic void putComments(ReviewDb db, ChangeUpdate update, PatchLineComment.Status status, Iterable<Comment> comments) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic void putRobotComments(ChangeUpdate update, Iterable<RobotComment> comments)
public void deleteComments(ReviewDb db, ChangeUpdate update, Iterable<Comment> comments) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic void deleteCommentByRewritingHistory(ReviewDb db, ChangeUpdate update, Comment.Key commentKey, PatchSet.Id psId, String newMessage) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmExceptionpublic void deleteAllDraftsFromAllUsers(Change.Id changeId) throws IOException
IOExceptionpublic static void setCommentRevId(Comment c, PatchListCache cache, Change change, PatchSet ps) throws PatchListNotAvailableException
PatchListNotAvailableExceptionpublic Collection<org.eclipse.jgit.lib.Ref> getDraftRefs(Change.Id changeId) throws com.google.gwtorm.server.OrmException
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.
changeId - change ID.com.google.gwtorm.server.OrmExceptionpublic static Iterable<PatchLineComment> toPatchLineComments(Change.Id changeId, PatchLineComment.Status status, Iterable<Comment> comments)
public static List<Comment> toComments(String serverId, Iterable<PatchLineComment> comments)