Class RequestItem
- All Implemented Interfaces:
ModelObject
/batch-control/requests/<id>/: detail view plus the four
state-changing POST endpoints (approve, reject, cancel,
changeApprover).
Every endpoint is @RequirePOST (GET never changes state) and performs its permission
check before delegating; all business rules (approver eligibility, comment requirements,
requester-only/requester-or-Manage rules, atomic state transitions) are enforced by
RunRequestService — this class contains zero state logic.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne row of the recent-run table. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoApprove(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String comment) POSTapprove?comment=...— approver decision (comment optional).voiddoCancel(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) POSTcancel— authenticated users only; service enforces requester-or-Manage.voiddoChangeApprover(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) POSTchangeApproverwith the repeatedapproversfield — replaces the designated set (D-26, D-37); the service enforces requester-only, PENDING and eligibility.voiddoReject(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String comment) POSTreject?comment=...— approver decision (service enforces non-empty comment).Jelly helper: human-readable timestamp.formErrors(String form) The refusal of formformon this request, or an empty one (DEF-09, Jelly).intThe approved-but-not-run timeout, for the disabled-job and cancelled-run notices.Approver candidates for the change-approver form (global list ∩ job restriction).Root-relative URL of the build this request produced.getId()Job URL relative to the Jenkins root if the job exists and the user may see it, else null.intHow many recent-run rows were actually found (at mostgetRecentRunLimit()).intHow many recent runs this rendering shows, from therunsquery parameter (?runs=20) and defaulting to 5.The sizes offered by the?runs=links below the recent-run table.The most recent runs of the requested job, newest first, so an approver can see how the job behaved last time without opening a second tab (T-E2E-05).D-38a: the frozen sentence shown whenisRequesterLacksBuild()holds.Permissions for this screen'sl:layout(the same set its section gate checks).booleanWhether the request is approved but its build has not been recorded yet (UX-10).booleanView gating for the cancel link; the service enforces requester-or-Manage.booleanView gating for the change-approver form; the service enforces requester-only.booleanView gating for the approve/reject forms: only a member of the designated set sees them (D-29, D-37).booleanisDesignated(String approver) Whether the change-approver picker starts with this candidate checked: the current members, so the form edits the set rather than retyping it.booleanD-55 (SPEC item 3): whether the request's job is disabled, so the decision form says to enable it first and offers no Approve button, and an approved request says that it waits.booleanbooleanR2-05: whether the request is approved but the queue item of its run was cancelled, from the queue or by disabling the job (which cancels the job's queued items, D-55), before a build started.booleanWhether the job has more runs than were shown, so the view can tell "these are all of them" apart from "this is the newest page of a longer history".booleanD-38a: whether the detail page states that the requester does not holdItem/Buildon the job (evaluated for the requester, not the viewer).Jelly helper: an approver set for display (a1, a2); empty for none.
-
Method Details
-
getRequest
-
getId
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject
-
format
Jelly helper: human-readable timestamp. -
isRequesterLacksBuild
public boolean isRequesterLacksBuild()D-38a: whether the detail page states that the requester does not holdItem/Buildon the job (evaluated for the requester, not the viewer). -
getRequesterLacksBuildNotice
D-38a: the frozen sentence shown whenisRequesterLacksBuild()holds. -
getJobUrl
Job URL relative to the Jenkins root if the job exists and the user may see it, else null. -
getExecutedRunUrl
Root-relative URL of the build this request produced.- Returns:
- null when the request produced no run, when the stored id is not of the form
jobFullName#number, when the build has since been deleted, or when the job is not visible to the caller (P-09). The view then renders the stored id as plain text instead of a dead link.
-
getRecentRuns
The most recent runs of the requested job, newest first, so an approver can see how the job behaved last time without opening a second tab (T-E2E-05). At mostgetRecentRunLimit()rows.P-09: the job is resolved through the permission-aware
findJob(), so a caller who may see the request but not the job — and a request whose job has been deleted — gets an empty list; the run history of an invisible job is never disclosed. Therunsquery parameter only changes how many rows this list holds, never whether the job is resolved, so it cannot be used to step around that check. The view distinguishes the two cases throughgetJobUrl(). -
getRecentRunLimit
public int getRecentRunLimit()How many recent runs this rendering shows, from therunsquery parameter (?runs=20) and defaulting to 5.The value is matched against
RECENT_RUN_LIMIT_OPTIONSrather than clamped, so anything else — a value above the cap such as?runs=100000, a negative number, a non-multiple such as7, or text — silently falls back to the default instead of producing an error page. That makes the largest option the enforced upper bound on how much build history one page load may read, whatever the caller types in the URL. -
getRecentRunCount
public int getRecentRunCount()How many recent-run rows were actually found (at mostgetRecentRunLimit()). -
getRecentRunLimitOptions
The sizes offered by the?runs=links below the recent-run table. -
isRecentRunsTruncated
public boolean isRecentRunsTruncated()Whether the job has more runs than were shown, so the view can tell "these are all of them" apart from "this is the newest page of a longer history". Call aftergetRecentRuns(). -
getApproverOptions
Approver candidates for the change-approver form (global list ∩ job restriction). -
isPending
public boolean isPending() -
isAwaitingExecution
public boolean isAwaitingExecution()Whether the request is approved but its build has not been recorded yet (UX-10).Approving redirects back to this read-only page, and the APPROVED → EXECUTED transition plus the run id are written later by the execution listener, so the page the approver lands on is one refresh behind. The view uses this to say so. It turns false as soon as the status moves on (EXECUTED, EXPIRED, INVALIDATED) and is false for PENDING, REJECTED and CANCELLED. R2-05: it is false as well once the queue item of the approved run was cancelled (
isQueueCancelled()): that run will not start, so "starts shortly" would be false. -
isQueueCancelled
public boolean isQueueCancelled()R2-05: whether the request is approved but the queue item of its run was cancelled, from the queue or by disabling the job (which cancels the job's queued items, D-55), before a build started. The service records it (RunRequestService#recordQueueCancelled) and never submits that run again; the approved-run timeout ends the request. The view says that the run will not start instead of theisAwaitingExecution()notice. -
isJobDisabled
public boolean isJobDisabled()D-55 (SPEC item 3): whether the request's job is disabled, so the decision form says to enable it first and offers no Approve button, and an approved request says that it waits. Resolved through the permission-awarefindJob()(P-09): for a viewer who may not read the job this isfalse, and the service's own refusal of the approval is what they see. Display only; the service enforces the refusal. -
getApprovedRunTimeoutMinutes
public int getApprovedRunTimeoutMinutes()The approved-but-not-run timeout, for the disabled-job and cancelled-run notices. -
isCanDecide
public boolean isCanDecide()View gating for the approve/reject forms: only a member of the designated set sees them (D-29, D-37). The endpoints and the service re-check for real. -
join
Jelly helper: an approver set for display (a1, a2); empty for none. -
isDesignated
Whether the change-approver picker starts with this candidate checked: the current members, so the form edits the set rather than retyping it. -
isCanCancel
public boolean isCanCancel()View gating for the cancel link; the service enforces requester-or-Manage. -
isCanChangeApprover
public boolean isCanChangeApprover()View gating for the change-approver form; the service enforces requester-only. -
getViewPermissions
Permissions for this screen'sl:layout(the same set its section gate checks). -
doApprove
public void doApprove(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String comment) throws IOException, jakarta.servlet.ServletException POSTapprove?comment=...— approver decision (comment optional). D-72b: a comment holding a character that cannot be stored is shown next to the comment; a request whose stored values do not match the displayed ones, or that was stored before D-72, is refused by the service (IllegalStateException) and its message shown above the form, like a failed save; the request stays pending.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doReject
public void doReject(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String comment) throws IOException, jakarta.servlet.ServletException POSTreject?comment=...— approver decision (service enforces non-empty comment).- Throws:
IOExceptionjakarta.servlet.ServletException
-
doCancel
public void doCancel(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException POSTcancel— authenticated users only; service enforces requester-or-Manage.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doChangeApprover
public void doChangeApprover(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException POSTchangeApproverwith the repeatedapproversfield — replaces the designated set (D-26, D-37); the service enforces requester-only, PENDING and eligibility.- Throws:
IOExceptionjakarta.servlet.ServletException
-
formErrors
The refusal of formformon this request, or an empty one (DEF-09, Jelly).
-