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 aJobto make use ofParametersDefinitionPropertyand be scheduled in various ways. Stateless so there is no need to keep an instance of it in a field. Besides implementingParameterizedJobMixIn.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
- override
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static 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
Fields Modifier and Type Field Description static AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob>BUILD_NOW_TEXTAllows customization of the human-readable display name to be rendered in the Build Now link.static AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob>BUILD_WITH_PARAMETERS_TEXT
-
Constructor Summary
Constructors Constructor Description ParameterizedJobMixIn()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract JobTasJob()voiddoBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)voiddoBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)voiddoCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)SearchIndexBuilderextendSearchIndex(SearchIndexBuilder sib)Use from aJob.makeSearchIndex()override.static CauseActiongetBuildCause(ParameterizedJobMixIn.ParameterizedJob job, org.kohsuke.stapler.StaplerRequest req)Computes the build cause, using RemoteCause or UserCause as appropriate.StringgetBuildNowText()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.booleanisParameterized()Standard implementation ofParameterizedJobMixIn.ParameterizedJob.isParameterized().booleanscheduleBuild()booleanscheduleBuild(int quietPeriod)booleanscheduleBuild(int quietPeriod, Cause c)booleanscheduleBuild(Cause c)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 Detail
-
BUILD_NOW_TEXT
public static final AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> BUILD_NOW_TEXT
Allows customization of the human-readable display name to be rendered in the Build Now link.- Since:
- 1.624
- See Also:
getBuildNowText()
-
BUILD_WITH_PARAMETERS_TEXT
public static final AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> BUILD_WITH_PARAMETERS_TEXT
-
-
Method Detail
-
asJob
protected abstract JobT asJob()
-
scheduleBuild
public final boolean scheduleBuild()
- See Also:
BuildableItem.scheduleBuild()
-
scheduleBuild
public final boolean scheduleBuild(Cause c)
- See Also:
BuildableItem.scheduleBuild(Cause)
-
scheduleBuild
public final boolean scheduleBuild(int quietPeriod)
- See Also:
BuildableItem.scheduleBuild(int)
-
scheduleBuild
public final boolean scheduleBuild(int quietPeriod, Cause c)- See Also:
BuildableItem.scheduleBuild(int, Cause)
-
scheduleBuild2
@CheckForNull public final QueueTaskFuture<RunT> scheduleBuild2(int quietPeriod, Action... actions)
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.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletExceptionStandard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuild(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse, jenkins.util.TimeDuration).- Throws:
IOExceptionjavax.servlet.ServletException
-
doBuildWithParameters
public final void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletExceptionStandard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuildWithParameters(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse, jenkins.util.TimeDuration).- Throws:
IOExceptionjavax.servlet.ServletException
-
doCancelQueue
public final void doCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletExceptionStandard implementation ofParameterizedJobMixIn.ParameterizedJob.doCancelQueue(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse).- Throws:
IOExceptionjavax.servlet.ServletException
-
extendSearchIndex
public final SearchIndexBuilder extendSearchIndex(SearchIndexBuilder sib)
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.StaplerRequest req)
Computes the build cause, using RemoteCause or UserCause as appropriate.
-
getBuildNowText
public final String getBuildNowText()
Suggested implementation ofParameterizedJobMixIn.ParameterizedJob.getBuildNowText().
-
getTrigger
@CheckForNull public static <T extends Trigger<?>> T getTrigger(Job<?,?> job, Class<T> clazz)
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
-
-