Class ReviewComment
- All Implemented Interfaces:
Serializable
ReviewDocument.
A comment is either anchored to a source line (getLine() ≥ 1) or a general,
document-level note (getLine() == GENERAL). The body is raw
markdown authored by the reviewer; it is rendered to sanitised HTML at the REST layer
(never stored as HTML), so this model only ever holds the untrusted source text.
A comment may reply to another comment (threading), and may carry a
display-only author label shown instead of the real author — used by an
automation (e.g. the regenerate agent) to post a labelled "AI response" nested under a reviewer's
comment. The author always remains the true, server-set Jenkins/token identity for
audit and is never client-supplied.
A comment left by highlighting text may also carry a display-only quote — the
verbatim snippet that was highlighted — so the viewer can show back exactly what the reviewer selected,
even when it is a sub-phrase of a line or spans several lines. Anchoring still uses getLine().
Persisted via XStream as part of the owning ReviewDocument. All transitions on the
comment (only setResolved(boolean)) are performed by ViewStore while it holds the
owning document's monitor.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReviewComment(String id, int line, String body, String author, long createdTs) Back-compat constructor: a root comment shown under its real author (no reply, no display label).ReviewComment(String id, int line, String body, String author, long createdTs, String parentId, String authorLabel) Back-compat constructor: a comment with threading/label but no highlighted-selection quote.ReviewComment(String id, int line, String body, String author, long createdTs, String parentId, String authorLabel, String quote) -
Method Summary
-
Field Details
-
GENERAL
public static final int GENERALSentinelgetLine()value for a general (not line-anchored) comment.- See Also:
-
-
Constructor Details
-
ReviewComment
public ReviewComment(@NonNull String id, int line, @NonNull String body, @NonNull String author, long createdTs) Back-compat constructor: a root comment shown under its real author (no reply, no display label). -
ReviewComment
public ReviewComment(@NonNull String id, int line, @NonNull String body, @NonNull String author, long createdTs, @CheckForNull String parentId, @CheckForNull String authorLabel) Back-compat constructor: a comment with threading/label but no highlighted-selection quote. -
ReviewComment
-
-
Method Details
-
getId
-
getLine
public int getLine() -
isLineAnchored
public boolean isLineAnchored()- Returns:
trueif this comment is anchored to a specific source line.
-
getBody
-
getAuthor
-
getCreatedTs
public long getCreatedTs() -
getParentId
- Returns:
- the id of the comment this one replies to, or
nullif it is a root comment.
-
isReply
public boolean isReply()- Returns:
trueif this comment is a reply nested under another comment.
-
getAuthorLabel
- Returns:
- a display-only label to show instead of the real
author(e.g. an automation name like "AI response"), ornullto show the real author. This never changesgetAuthor(), which always holds the true, server-set identity used for audit.
-
getQuote
- Returns:
- the verbatim text the reviewer highlighted when leaving this comment (a sub-phrase or a
multi-line span), or
nullwhen the comment was left via the "+" affordance / as a general note, or for legacy data. Display-only; the comment still anchors atgetLine().
-
isResolved
public boolean isResolved() -
setResolved
public void setResolved(boolean resolved) -
toJson
@NonNull public net.sf.json.JSONObject toJson()- Returns:
- this comment as JSON. The
bodyis the raw markdown source; the caller (REST layer) is responsible for adding a sanitisedbodyHtmlrendered viaMarkdownRenderer— HTML escaping is never done here.
-