Class ReviewDocument

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

public class ReviewDocument extends Object implements Serializable
A durable, reviewable snapshot of a file published by the interactiveView pipeline step.

At step time the named file's content is copied ("snapshotted") into the plugin store so the review still works after the workspace/build is cleaned. Reviewers can add ReviewComments, edit the durable review copy (each edit is a new ContentVersion; the original workspace file is never touched), and record a ReviewStatus decision. For a blocking (wait:true) view the decision resumes the paused pipeline.

Only metadata (this object, including comments and version metadata) is persisted via XStream to views.xml; the version bytes live in per-document files. State transitions are guarded by ViewStore, which synchronises on the individual document instance.

See Also:
  • Field Details

  • Constructor Details

    • ReviewDocument

      public ReviewDocument(@NonNull String id, @NonNull String jobFullName, int buildNumber, @NonNull String reportName, @NonNull String title, @NonNull String fileName, @NonNull String format, @NonNull String language, @NonNull String createdBy, long createdTs, boolean commentable, boolean editable, boolean notify, boolean blocking, @CheckForNull String submitterFilter, long slaMs, @CheckForNull String groupId, @CheckForNull String mode)
  • Method Details

    • getId

      @NonNull public String getId()
    • getJobFullName

      @NonNull public String getJobFullName()
    • getBuildNumber

      public int getBuildNumber()
    • getReportName

      @NonNull public String getReportName()
    • getTitle

      @NonNull public String getTitle()
    • getFileName

      @NonNull public String getFileName()
    • getFormat

      @NonNull public String getFormat()
    • getLanguage

      @NonNull public String getLanguage()
    • getCreatedBy

      @NonNull public String getCreatedBy()
    • getCreatedTs

      public long getCreatedTs()
    • isCommentable

      public boolean isCommentable()
    • isEditable

      public boolean isEditable()
    • isNotify

      public boolean isNotify()
    • isBlocking

      public boolean isBlocking()
    • getSubmitterFilter

      @CheckForNull public String getSubmitterFilter()
    • getGroupId

      @NonNull public String getGroupId()
      Returns:
      the grouping key for files published together, or this document's own id when it was published on its own — so callers can always group by a stable, non-null key. Legacy documents (no stored group) return their id and therefore form singleton groups.
    • isGrouped

      public boolean isGrouped()
      Returns:
      true if this review was published as one of a multi-file group (glob/dir).
    • getMode

      @NonNull public String getMode()
      Returns:
      MODE_INFO for a read-only informational viewer, otherwise MODE_REVIEW (a decision is required). Legacy documents with no stored mode are treated as review.
    • isDecisionRequired

      public boolean isDecisionRequired()
      Returns:
      true if this review needs an approve/reject/acknowledge decision (review mode).
    • getSlaMs

      public long getSlaMs()
    • getExpiresAt

      public long getExpiresAt()
    • getStatus

      @NonNull public ReviewStatus getStatus()
    • getDecidedBy

      @CheckForNull public String getDecidedBy()
    • getDecidedTs

      public long getDecidedTs()
    • getCurrentVersion

      public int getCurrentVersion()
    • isBuildDeleted

      public boolean isBuildDeleted()
      Returns:
      true if the owning build has been deleted. The review is retained (its history is durable) but is excluded from the notification centre and the sidebar/badge counts, and the per-job interactive-view page renders it as "build deleted" without a live build link.
    • getComments

      @NonNull public List<ReviewComment> getComments()
      Returns:
      an unmodifiable view of the comments (never null).
    • getCommentCount

      public int getCommentCount()
      Returns:
      the number of comments (convenience for Jelly views).
    • getCreatedDate

      @NonNull public Date getCreatedDate()
      Returns:
      the creation time as a Date (convenience for Jelly date formatting).
    • getVersions

      @NonNull public List<ContentVersion> getVersions()
      Returns:
      an unmodifiable view of the content-version metadata (never null).
    • isExpired

      public boolean isExpired(long now)
      Returns:
      true if a blocking SLA is configured and it has elapsed relative to now.
    • remainingMs

      public long remainingMs(long now)
      Returns:
      remaining SLA milliseconds (-1 when no SLA, 0 when already due).
    • toJson

      @NonNull public net.sf.json.JSONObject toJson(boolean includeComments, long now)
      Serialise the document metadata to JSON for the REST API and the review page.
      Parameters:
      includeComments - whether to include the comment list (raw markdown bodies; the caller adds sanitised bodyHtml)
      now - reference time for remainingMs