Class IncidentItem
- All Implemented Interfaces:
ModelObject
/batch-control/incidents/<id>/ (SPEC item 11): detail view plus the
four state-changing POST endpoints (acknowledge, resolve, comment,
rerun).
Every endpoint is @RequirePOST (GET never changes state) and performs its
permission check before delegating. All business rules (the OPEN → ACKNOWLEDGED → RESOLVED
state machine, comment recording, rerun request creation and linking) are enforced by
IncidentService — this class contains zero state logic.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddoAcknowledge(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String comment) POSTacknowledge?comment=...— OPEN → ACKNOWLEDGED.voiddoComment(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String comment) POSTcomment?comment=...— adds a comment without a status change.voiddoRerun(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) POSTrerunwith the repeatedapproversfield (the singleapproverfield the rerun form posts is read too) — creates a rerunRunRequestcarrying the failed run's own parameter values and linked back to this incident, then redirects to the new request's detail page.voiddoResolve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String comment) POSTresolve?comment=...— ACKNOWLEDGED → RESOLVED.Jelly helper: human-readable timestamp.formErrors(String form) The refusal of formformon this request, or an empty one (DEF-09, Jelly).Approver candidates for the rerun request form (global list ∩ job restriction).Incident creation time (first transition).getId()e2e-04 UX-19: the job's URL for a viewer who may read it (P-09,findJob()), elsenull.getLinks()Link predicates: a link to another screen is rendered only if the user may open it.The stored console log excerpt as one string for the<pre>block.Root-relative build URL for the resolving run, or null (same rule asgetRunUrl()).Root-relative build URL for the originating run; null (plain text) when the id is malformed or the viewer lacks Item/Read on the job (D-44,Visibility.runUrlFromRunId(java.lang.String)).Permissions for this screen'sl:layout(the same set its section gate checks).booleanView gating only; the service re-validates the state machine.booleanComments stay possible in every state (SPEC section 4: RESOLVED still takes comments).booleanView gating for the rerun form (e2e-03 DEF-12):BatchControl/RequestandItem/Readon the incident's job, the permissions a run request needs (D-38a;Item/Buildis not required).booleanView gating only; the service re-validates the state machine.booleanWhether the incident's job still exists and is visible, so a rerun is possible at all.
-
Method Details
-
getIncident
-
getId
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject
-
format
Jelly helper: human-readable timestamp. -
getRunUrl
Root-relative build URL for the originating run; null (plain text) when the id is malformed or the viewer lacks Item/Read on the job (D-44,Visibility.runUrlFromRunId(java.lang.String)). -
getResolvedByRunUrl
Root-relative build URL for the resolving run, or null (same rule asgetRunUrl()). -
getCreatedAt
Incident creation time (first transition). -
getLogTailText
The stored console log excerpt as one string for the<pre>block. The Jelly default escaping renders it as inert text; secrets were masked at capture time (D-19). -
getApproverOptions
Approver candidates for the rerun request form (global list ∩ job restriction). -
isCanAcknowledge
public boolean isCanAcknowledge()View gating only; the service re-validates the state machine. -
isCanResolve
public boolean isCanResolve()View gating only; the service re-validates the state machine. -
isCanComment
public boolean isCanComment()Comments stay possible in every state (SPEC section 4: RESOLVED still takes comments). -
isCanRerun
public boolean isCanRerun()View gating for the rerun form (e2e-03 DEF-12):BatchControl/RequestandItem/Readon the incident's job, the permissions a run request needs (D-38a;Item/Buildis not required). A user withoutBatchControl/Requestis not offered the form. The endpoint and the service re-check. -
isJobAvailable
public boolean isJobAvailable()Whether the incident's job still exists and is visible, so a rerun is possible at all. -
getJobUrl
e2e-04 UX-19: the job's URL for a viewer who may read it (P-09,findJob()), elsenull. Its run request form is<url>batch-control/; the view links that form only together withisCanRerun(), the same Request + Item/Read test the form itself applies (D-38a). -
formErrors
The refusal of formformon this request, or an empty one (DEF-09, Jelly). -
getViewPermissions
Permissions for this screen'sl:layout(the same set its section gate checks). -
getLinks
Link predicates: a link to another screen is rendered only if the user may open it. -
doAcknowledge
public void doAcknowledge(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String comment) throws IOException, jakarta.servlet.ServletException POSTacknowledge?comment=...— OPEN → ACKNOWLEDGED.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doResolve
public void doResolve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String comment) throws IOException, jakarta.servlet.ServletException POSTresolve?comment=...— ACKNOWLEDGED → RESOLVED.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doComment
public void doComment(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String comment) throws IOException, jakarta.servlet.ServletException POSTcomment?comment=...— adds a comment without a status change.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doRerun
public void doRerun(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException POSTrerunwith the repeatedapproversfield (the singleapproverfield the rerun form posts is read too) — creates a rerunRunRequestcarrying the failed run's own parameter values and linked back to this incident, then redirects to the new request's detail page.D-72 (SPEC item 11): when a value of the failed run cannot be recovered (
RerunNeedsFormException: a stashed file the build has cleared, a deleted build) no request is created; the answer is a 302 to the job's Request Run form,<job>/batch-control/?p.<name>=<value>...&fromRerun=<incident id>, carrying the recoverable non-sensitive values within the prefill caps (RequestRunPrefill.rerunQuery(hudson.model.Job<?, ?>, java.util.Map<java.lang.String, java.lang.String>, java.lang.String)); the form says that file and password values must be provided again.- Throws:
IOExceptionjakarta.servlet.ServletException
-