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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceParameterizedJobMixIn.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
FieldsModifier and TypeFieldDescriptionAllows customization of the human-readable display name to be rendered in the Build Now link. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract JobTasJob()final voiddoBuild(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, TimeDuration delay) final voiddoBuildWithParameters(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, TimeDuration delay) final voiddoCancelQueue(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) final SearchIndexBuilderUse from aJob.makeSearchIndex()override.static CauseActiongetBuildCause(ParameterizedJobMixIn.ParameterizedJob job, org.kohsuke.stapler.StaplerRequest2 req) Computes the build cause, using RemoteCause or UserCause as appropriate.final StringSuggested 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 booleanStandard implementation ofParameterizedJobMixIn.ParameterizedJob.isParameterized().final booleanfinal booleanscheduleBuild(int quietPeriod) final booleanscheduleBuild(int quietPeriod, Cause c) final booleanfinal QueueTaskFuture<RunT>scheduleBuild2(int quietPeriod, Action... actions) Standard implementation ofParameterizedJobMixIn.ParameterizedJob.scheduleBuild2(int, hudson.model.Action...).static Queue.ItemscheduleBuild2(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 forTriggerimplementations, 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-1to use the job’s default settingsactions- various actions to associate with the scheduling, such asParametersActionorCauseAction- 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.QueueDecisionHandlerrejected it), or ifjobis not aParameterizedJobMixIn.ParameterizedJobor 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:
IOExceptionjakarta.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:
IOExceptionjakarta.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:
IOExceptionjakarta.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
jobis not aParameterizedJobMixIn.ParameterizedJob - Since:
- 1.621
-