Class JobActivationNoticeAction

java.lang.Object
io.jenkins.plugins.batchcontrol.action.JobActivationNoticeAction
All Implemented Interfaces:
Action, ModelObject

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class JobActivationNoticeAction extends Object implements Action
The job-page Batch Control notice area: whether a run-controlled job is activated, not activated or on hold, with a link to the activation request form (SPEC item 6a), and, on an approval-required job, that manual runs need an approved run request, with a link to the request form (SPEC item 6, e2e-03 DEF-01).

Like JobTriggerLockAction it has no sidebar entry and no URL; its jobMain.jelly renders on the job page. It is shown to Item/Read holders while run control is on, for every job whatever approvalRequired says (D-46a), and it never changes state. The link to the form is rendered only for a BatchControl/Request holder, the only user who may open it (SPEC item 2). A computed child (a branch job) has no activation of its own: the notice names the computed folder that carries it (D-46c) and links to that folder for a viewer who may read it. A job's sub-item (a matrix configuration, a Maven module) has neither an activation nor run approval of its own (D-82): the notice says it follows its parent job's, links to that job for a viewer who may read it, and offers no request link of its own.

  • Constructor Details

    • JobActivationNoticeAction

      public JobActivationNoticeAction(Job<?,?> job)
  • Method Details

    • getJob

      public Job<?,?> getJob()
    • getIconFileName

      @CheckForNull public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      @CheckForNull public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • isShown

      public boolean isShown()
      Whether the notice is rendered: run control on and the viewer holds Item/Read.
    • isApprovalRequired

      public boolean isApprovalRequired()
      e2e-03 DEF-01 (SPEC item 6): whether the "manual runs need an approved request" notice is rendered. Shown with the activation notice (isShown()) on every job whose manual runs need approval (JobRequestAction.isActive()), because a build button of another plugin (Rebuild, Retry, a customised build button) or core's scripted Build Now reports a refusal only as its own generic failure message; the job page is where the user can still read why and where to go. The link to the request form follows isCanRequest().
    • isSubItem

      public boolean isSubItem()
      D-82: whether the job is a sub-item of a job (a matrix configuration, a Maven module), which follows its parent job's activation and run approval and has no requests of its own.
    • getParentJob

      public Job<?,?> getParentJob()
      D-82: the job whose activation and run approval a sub-item follows (its topmost parent job).
    • getSubItemNoun

      public String getSubItemNoun()
      D-82: what the sub-item is called, from its own pronoun ("configuration" for a matrix configuration, "module" for a Maven module).
    • isActivated

      public boolean isActivated()
    • isHeld

      public boolean isHeld()
      Whether an approved hold took the job out of service (as opposed to never activated).
    • getCarrier

      @CheckForNull public Item getCarrier()
      The computed folder that carries this job's activation when the job is a computed child (D-46c), else null.
    • carrierState

      public String carrierState(Item carrier)
      "activated", "on hold" or "not activated" for the carrying folder.
    • carrierUrl

      @CheckForNull public String carrierUrl(Item carrier)
      The carrying folder's URL when the viewer may read it, else null (plain text).
    • actionLabel

      public String actionLabel(ActivationRequest.Action action)
      S-13-08: the request kind as the screens word it.
    • isCanRequest

      public boolean isCanRequest()
      Whether the viewer may open the activation request form (BatchControl/Request).
    • isCanRequestRun

      public boolean isCanRequestRun()
      Whether the viewer may submit a run request for this job, so the run request form is linked (e2e-03 DEF-12): BatchControl/Request and Item/Read on the job (D-38a), the same predicate as the sidebar entry.
    • getPendingRequests

      public List<ActivationRequest> getPendingRequests()
      The PENDING requests of this job the viewer may see (P-09).