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.OrmException
UnprocessableEntityException
public RobotComment newRobotComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, String robotId, String robotRunId)
public Optional<Comment> get(ReviewDb db, ChangeNotes notes, Comment.Key key) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> publishedByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<RobotComment> robotCommentsByChange(ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> draftByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> publishedByChangeFile(ReviewDb db, ChangeNotes notes, Change.Id changeId, String file) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> publishedByPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> draftByPatchSetAuthor(ReviewDb db, PatchSet.Id psId, Account.Id author, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> draftByChangeFileAuthor(ReviewDb db, ChangeNotes notes, String file, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public List<Comment> draftByChangeAuthor(ReviewDb db, ChangeNotes notes, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
@Deprecated public List<Change.Id> changesWithDraftsByAuthor(ReviewDb db, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void putComments(ReviewDb db, ChangeUpdate update, PatchLineComment.Status status, Iterable<Comment> comments) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public 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.OrmException
public void deleteAllDraftsFromAllUsers(Change.Id changeId) throws IOException
IOException
public static void setCommentRevId(Comment c, PatchListCache cache, Change change, PatchSet ps) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public 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.OrmException
public static Iterable<PatchLineComment> toPatchLineComments(Change.Id changeId, PatchLineComment.Status status, Iterable<Comment> comments)
public static List<Comment> toComments(String serverId, Iterable<PatchLineComment> comments)