Package jenkins.model
Class ParameterizedJobMixIn<JobT extends Job<JobT,RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT,RunT> & Queue.Task,RunT extends Run<JobT,RunT> & Queue.Executable>
java.lang.Object
jenkins.model.ParameterizedJobMixIn<JobT,RunT>
public abstract class ParameterizedJobMixIn<JobT extends Job<JobT,RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT,RunT> & Queue.Task,RunT extends Run<JobT,RunT> & Queue.Executable>
extends Object
Allows a
Job
to make use of ParametersDefinitionProperty
and be scheduled in various ways.
Stateless so there is no need to keep an instance of it in a field.
Besides implementing ParameterizedJobMixIn.ParameterizedJob
, you should
- override
Job.makeSearchIndex()
to callextendSearchIndex(hudson.search.SearchIndexBuilder)
- override
AbstractItem.performDelete()
to callParameterizedJobMixIn.ParameterizedJob.makeDisabled(boolean)
- override
Job.getIconColor()
to callParameterizedJobMixIn.ParameterizedJob.isDisabled()
- use
<p:config-disableBuild/>
- use
<p:makeDisabled/>
- Since:
- 1.556
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
ParameterizedJobMixIn.ParameterizedJob<JobT extends Job<JobT,
RunT> & ParameterizedJobMixIn.ParameterizedJob<JobT, RunT> & Queue.Task, RunT extends Run<JobT, RunT> & Queue.Executable> Marker for job using this mixin, and default implementations of many methods. -
Field Summary
Modifier and TypeFieldDescriptionAllows customization of the human-readable display name to be rendered in the Build Now link. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract JobT
asJob()
final void
doBuild
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, TimeDuration delay) final void
doBuildWithParameters
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, TimeDuration delay) final void
doCancelQueue
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) final SearchIndexBuilder
Use from aJob.makeSearchIndex()
override.static CauseAction
getBuildCause
(ParameterizedJobMixIn.ParameterizedJob job, org.kohsuke.stapler.StaplerRequest2 req) Computes the build cause, using RemoteCause or UserCause as appropriate.final String
Suggested implementation ofParameterizedJobMixIn.ParameterizedJob.getBuildNowText()
.static <T extends Trigger<?>>
TgetTrigger
(Job<?, ?> job, Class<T> clazz) Checks for the existence of a specific trigger on a job.final boolean
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.isParameterized()
.final boolean
final boolean
scheduleBuild
(int quietPeriod) final boolean
scheduleBuild
(int quietPeriod, Cause c) final boolean
final QueueTaskFuture<RunT>
scheduleBuild2
(int quietPeriod, Action... actions) Standard implementation ofParameterizedJobMixIn.ParameterizedJob.scheduleBuild2(int, hudson.model.Action...)
.static Queue.Item
scheduleBuild2
(Job<?, ?> job, int quietPeriod, Action... actions) Convenience method to schedule a build.
-
Field Details
-
BUILD_NOW_TEXT
public static final AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> BUILD_NOW_TEXTAllows customization of the human-readable display name to be rendered in the Build Now link.- Since:
- 1.624
- See Also:
-
BUILD_WITH_PARAMETERS_TEXT
public static final AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> BUILD_WITH_PARAMETERS_TEXT
-
-
Constructor Details
-
ParameterizedJobMixIn
public ParameterizedJobMixIn()
-
-
Method Details
-
asJob
-
scheduleBuild
public final boolean scheduleBuild()- See Also:
-
scheduleBuild
- See Also:
-
scheduleBuild
public final boolean scheduleBuild(int quietPeriod) - See Also:
-
scheduleBuild
- See Also:
-
scheduleBuild2
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.scheduleBuild2(int, hudson.model.Action...)
. -
scheduleBuild2
@CheckForNull public static Queue.Item scheduleBuild2(Job<?, ?> job, int quietPeriod, Action... actions) Convenience method to schedule a build. Useful forTrigger
implementations, for example. If you need to wait for the build to start (or finish), useQueue.Item.getFuture()
.- Parameters:
job
- a job which might be schedulablequietPeriod
- seconds to wait before starting; use-1
to use the job’s default settingsactions
- various actions to associate with the scheduling, such asParametersAction
orCauseAction
- Returns:
- a newly created, or reused, queue item if the job could be scheduled;
null if it was refused for some reason (e.g., some
Queue.QueueDecisionHandler
rejected it), or ifjob
is not aParameterizedJobMixIn.ParameterizedJob
or it is notJob.isBuildable()
) - Since:
- 1.621
-
isParameterized
public final boolean isParameterized()Standard implementation ofParameterizedJobMixIn.ParameterizedJob.isParameterized()
. -
doBuild
public final void doBuild(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter TimeDuration delay) throws IOException, jakarta.servlet.ServletException Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuild(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2, jenkins.util.TimeDuration)
.- Throws:
IOException
jakarta.servlet.ServletException
-
doBuildWithParameters
public final void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter TimeDuration delay) throws IOException, jakarta.servlet.ServletException Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuildWithParameters(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2, jenkins.util.TimeDuration)
.- Throws:
IOException
jakarta.servlet.ServletException
-
doCancelQueue
public final void doCancelQueue(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doCancelQueue(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)
.- Throws:
IOException
jakarta.servlet.ServletException
-
extendSearchIndex
Use from aJob.makeSearchIndex()
override.- Parameters:
sib
- the super value- Returns:
- the value to return
-
getBuildCause
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static CauseAction getBuildCause(ParameterizedJobMixIn.ParameterizedJob job, org.kohsuke.stapler.StaplerRequest2 req) Computes the build cause, using RemoteCause or UserCause as appropriate. -
getBuildNowText
Suggested implementation ofParameterizedJobMixIn.ParameterizedJob.getBuildNowText()
. -
getTrigger
Checks for the existence of a specific trigger on a job.- Type Parameters:
T
- a trigger type- Parameters:
job
- a jobclazz
- the type of the trigger- Returns:
- a configured trigger of the requested type, or null if there is none such, or
job
is not aParameterizedJobMixIn.ParameterizedJob
- Since:
- 1.621
-