Class JobActivationForm
java.lang.Object
io.jenkins.plugins.batchcontrol.action.JobActivationForm
- All Implemented Interfaces:
Action,ModelObject
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class JobActivationForm
extends Object
implements Action
The activation request form at
<item>/batch-control-activation/ (SPEC item 6a, D-39,
D-64) for a job (JobRequestActionFactory) or a computed folder, which carries the
activation of its children (D-46c, ComputedFolderActivationActionFactory). An action
of its own, without a sidebar entry, so its breadcrumbs read <item> > Activation.
Without BatchControl/Request getUrlName() is null: the URL space
answers 404, so this form is never shown to a user who could not submit it.
The form offers the one action that can change anything: ACTIVATE for a job that is
not activated, HOLD for one that is. doSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2) passes the posted value to
ActivationService.create(hudson.model.Job<?, ?>, io.jenkins.plugins.batchcontrol.model.ActivationRequest.Action, java.lang.String, java.util.List<java.lang.String>), which is the only place a request is validated and stored;
this class holds no state logic.
-
Method Summary
Modifier and TypeMethodDescriptionactionLabel(ActivationRequest.Action action) S-13-08: the request kind as the screens word it.voiddoSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) POSTsubmitwithaction(ACTIVATE|HOLD),reasonand the repeatedapproversfield; redirects to the request at/batch-control/activations/<id>/.Jelly helper: human-readable timestamp.Approver candidates: global approver list ∩ job-level restriction (if configured).A computed child carries no activation of its own: the item returned here does (D-46c).The refusal of the last submission on this request, or an empty one (DEF-09).No sidebar entry: the job and folder pages link the form from their activation notice.getItem()The action a new request would ask for:HOLDwhen activated, elseACTIVATE.Job<?, ?> The job, under the name core'sl:job-subpagereads (it.object), so the form renders as a sub-page of the job on the new job page (e2e-14 DEF-08);nullfor a computed folder, which the view keeps on the classic layout.The PENDING requests of this job the viewer may see (P-09), oldest first.getState()nullwithoutBatchControl/Request: the form exposes the approver list, so its URL space is absent (404) rather than refused, the same rule as before D-64 (on a jobBatchControl/Request; on a computed folder the service's predicate, Request andItem/Read).Permissions for the form'sl:layout.booleanWhether the job may run on timer and upstream triggers as far as activation is concerned.booleanS-14-02: whether the viewer holdsItem/Readon the carrier, so its name may be shown; otherwise the view renders a neutral line.booleanisFolder()Whether the target is a computed folder rather than a job (the view words it accordingly).booleanisHeld()Whether an approved hold took the job out of service (as opposed to never activated).booleanWhether run control is on, i.e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Action
getDescription, getEvent, getGroup, getSemantic, isVisibleInContextMenu
-
Method Details
-
getItem
-
getObject
The job, under the name core'sl:job-subpagereads (it.object), so the form renders as a sub-page of the job on the new job page (e2e-14 DEF-08);nullfor a computed folder, which the view keeps on the classic layout. -
isFolder
public boolean isFolder()Whether the target is a computed folder rather than a job (the view words it accordingly). -
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getIconFileName
No sidebar entry: the job and folder pages link the form from their activation notice.- Specified by:
getIconFileNamein interfaceAction
-
getUrlName
nullwithoutBatchControl/Request: the form exposes the approver list, so its URL space is absent (404) rather than refused, the same rule as before D-64 (on a jobBatchControl/Request; on a computed folder the service's predicate, Request andItem/Read).doSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)re-checks the permissions. Alwaysnullon a job's sub-item (a matrix configuration, a Maven module), which has no activation of its own (D-82): its notice links the parent job instead.- Specified by:
getUrlNamein interfaceAction
-
getViewPermissions
Permissions for the form'sl:layout. -
isActivated
public boolean isActivated()Whether the job may run on timer and upstream triggers as far as activation is concerned. -
isHeld
public boolean isHeld()Whether an approved hold took the job out of service (as opposed to never activated). -
getCarrier
A computed child carries no activation of its own: the item returned here does (D-46c).nullfor an item that carries its own. -
isCarrierReadable
public boolean isCarrierReadable()S-14-02: whether the viewer holdsItem/Readon the carrier, so its name may be shown; otherwise the view renders a neutral line. -
isRunControlled
public boolean isRunControlled()Whether run control is on, i.e. the gate applies (D-46a: whatever approvalRequired says). -
getState
-
getNextAction
The action a new request would ask for:HOLDwhen activated, elseACTIVATE. -
getPendingRequests
The PENDING requests of this job the viewer may see (P-09), oldest first. -
getApproverOptions
Approver candidates: global approver list ∩ job-level restriction (if configured). -
actionLabel
S-13-08: the request kind as the screens word it. -
format
Jelly helper: human-readable timestamp. -
doSubmit
public void doSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException POSTsubmitwithaction(ACTIVATE|HOLD),reasonand the repeatedapproversfield; redirects to the request at/batch-control/activations/<id>/. A refused submission re-renders the form (HTTP 400) with the message next to its field and the input kept (e2e-03 DEF-09).- Throws:
IOExceptionjakarta.servlet.ServletException
-
getFormErrors
The refusal of the last submission on this request, or an empty one (DEF-09).
-