public class CommentsUtil
extends java.lang.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 |
Modifier and Type | Method and Description |
---|---|
java.util.List<Comment> |
byPatchSet(ReviewDb db,
ChangeNotes notes,
PatchSet.Id psId) |
java.util.List<Change.Id> |
changesWithDraftsByAuthor(ReviewDb db,
Account.Id author)
Deprecated.
|
void |
deleteAllDraftsFromAllUsers(Change.Id changeId) |
void |
deleteCommentByRewritingHistory(ReviewDb db,
ChangeUpdate update,
Comment.Key commentKey,
PatchSet.Id psId,
java.lang.String newMessage) |
void |
deleteComments(ReviewDb db,
ChangeUpdate update,
java.lang.Iterable<Comment> comments) |
java.util.List<Comment> |
draftByChange(ReviewDb db,
ChangeNotes notes) |
java.util.List<Comment> |
draftByChangeAuthor(ReviewDb db,
ChangeNotes notes,
Account.Id author) |
java.util.List<Comment> |
draftByChangeFileAuthor(ReviewDb db,
ChangeNotes notes,
java.lang.String file,
Account.Id author) |
java.util.List<Comment> |
draftByPatchSetAuthor(ReviewDb db,
PatchSet.Id psId,
Account.Id author,
ChangeNotes notes) |
static java.lang.String |
extractMessageId(java.lang.String tag) |
static PatchSet.Id |
getCommentPsId(Change.Id changeId,
Comment comment) |
java.util.Optional<Comment> |
getDraft(ReviewDb db,
ChangeNotes notes,
IdentifiedUser user,
Comment.Key key) |
java.util.Collection<org.eclipse.jgit.lib.Ref> |
getDraftRefs(Change.Id changeId)
Get NoteDb draft refs for a change.
|
java.util.Optional<Comment> |
getPublished(ReviewDb db,
ChangeNotes notes,
Comment.Key key) |
Comment |
newComment(ChangeContext ctx,
java.lang.String path,
PatchSet.Id psId,
short side,
java.lang.String message,
java.lang.Boolean unresolved,
java.lang.String parentUuid) |
RobotComment |
newRobotComment(ChangeContext ctx,
java.lang.String path,
PatchSet.Id psId,
short side,
java.lang.String message,
java.lang.String robotId,
java.lang.String robotRunId) |
void |
publish(ChangeContext ctx,
PatchSet.Id psId,
java.util.Collection<Comment> drafts,
java.lang.String tag) |
java.util.List<Comment> |
publishedByChange(ReviewDb db,
ChangeNotes notes) |
java.util.List<Comment> |
publishedByChangeFile(ReviewDb db,
ChangeNotes notes,
Change.Id changeId,
java.lang.String file) |
java.util.List<Comment> |
publishedByPatchSet(ReviewDb db,
ChangeNotes notes,
PatchSet.Id psId) |
void |
putComments(ReviewDb db,
ChangeUpdate update,
PatchLineComment.Status status,
java.lang.Iterable<Comment> comments) |
void |
putRobotComments(ChangeUpdate update,
java.lang.Iterable<RobotComment> comments) |
java.util.List<RobotComment> |
robotCommentsByChange(ChangeNotes notes) |
java.util.List<RobotComment> |
robotCommentsByPatchSet(ChangeNotes notes,
PatchSet.Id psId) |
static void |
setCommentRevId(Comment c,
PatchListCache cache,
Change change,
PatchSet ps) |
static java.util.List<Comment> |
toComments(java.lang.String serverId,
java.lang.Iterable<PatchLineComment> comments) |
static java.lang.Iterable<PatchLineComment> |
toPatchLineComments(Change.Id changeId,
PatchLineComment.Status status,
java.lang.Iterable<Comment> comments) |
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 static java.lang.String extractMessageId(java.lang.String tag)
public Comment newComment(ChangeContext ctx, java.lang.String path, PatchSet.Id psId, short side, java.lang.String message, java.lang.Boolean unresolved, java.lang.String parentUuid) throws com.google.gwtorm.server.OrmException, UnprocessableEntityException
com.google.gwtorm.server.OrmException
UnprocessableEntityException
public RobotComment newRobotComment(ChangeContext ctx, java.lang.String path, PatchSet.Id psId, short side, java.lang.String message, java.lang.String robotId, java.lang.String robotRunId)
public java.util.Optional<Comment> getPublished(ReviewDb db, ChangeNotes notes, Comment.Key key) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.Optional<Comment> getDraft(ReviewDb db, ChangeNotes notes, IdentifiedUser user, Comment.Key key) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> publishedByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<RobotComment> robotCommentsByChange(ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> draftByChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> publishedByChangeFile(ReviewDb db, ChangeNotes notes, Change.Id changeId, java.lang.String file) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> publishedByPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.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 java.util.List<Comment> draftByChangeFileAuthor(ReviewDb db, ChangeNotes notes, java.lang.String file, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public java.util.List<Comment> draftByChangeAuthor(ReviewDb db, ChangeNotes notes, Account.Id author) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
@Deprecated public java.util.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, java.lang.Iterable<Comment> comments) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void putRobotComments(ChangeUpdate update, java.lang.Iterable<RobotComment> comments)
public void deleteComments(ReviewDb db, ChangeUpdate update, java.lang.Iterable<Comment> comments) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void deleteCommentByRewritingHistory(ReviewDb db, ChangeUpdate update, Comment.Key commentKey, PatchSet.Id psId, java.lang.String newMessage) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void deleteAllDraftsFromAllUsers(Change.Id changeId) throws java.io.IOException
java.io.IOException
public static void setCommentRevId(Comment c, PatchListCache cache, Change change, PatchSet ps) throws PatchListNotAvailableException
PatchListNotAvailableException
public java.util.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 java.lang.Iterable<PatchLineComment> toPatchLineComments(Change.Id changeId, PatchLineComment.Status status, java.lang.Iterable<Comment> comments)
public static java.util.List<Comment> toComments(java.lang.String serverId, java.lang.Iterable<PatchLineComment> comments)
public void publish(ChangeContext ctx, PatchSet.Id psId, java.util.Collection<Comment> drafts, java.lang.String tag) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException