Class ReviewComment

java.lang.Object
io.jenkins.plugins.interactiveinput.view.ReviewComment
All Implemented Interfaces:
Serializable

public class ReviewComment extends Object implements Serializable
A single Confluence-style comment on a 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 Details

  • 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

      public ReviewComment(@NonNull String id, int line, @NonNull String body, @NonNull String author, long createdTs, @CheckForNull String parentId, @CheckForNull String authorLabel, @CheckForNull String quote)
  • Method Details

    • getId

      @NonNull public String getId()
    • getLine

      public int getLine()
    • isLineAnchored

      public boolean isLineAnchored()
      Returns:
      true if this comment is anchored to a specific source line.
    • getBody

      @NonNull public String getBody()
    • getAuthor

      @NonNull public String getAuthor()
    • getCreatedTs

      public long getCreatedTs()
    • getParentId

      @CheckForNull public String getParentId()
      Returns:
      the id of the comment this one replies to, or null if it is a root comment.
    • isReply

      public boolean isReply()
      Returns:
      true if this comment is a reply nested under another comment.
    • getAuthorLabel

      @CheckForNull public String getAuthorLabel()
      Returns:
      a display-only label to show instead of the real author (e.g. an automation name like "AI response"), or null to show the real author. This never changes getAuthor(), which always holds the true, server-set identity used for audit.
    • getQuote

      @CheckForNull public String getQuote()
      Returns:
      the verbatim text the reviewer highlighted when leaving this comment (a sub-phrase or a multi-line span), or null when the comment was left via the "+" affordance / as a general note, or for legacy data. Display-only; the comment still anchors at getLine().
    • isResolved

      public boolean isResolved()
    • setResolved

      public void setResolved(boolean resolved)
    • toJson

      @NonNull public net.sf.json.JSONObject toJson()
      Returns:
      this comment as JSON. The body is the raw markdown source; the caller (REST layer) is responsible for adding a sanitised bodyHtml rendered via MarkdownRenderer — HTML escaping is never done here.