public abstract class ParameterizedJobMixIn<JobT extends Job<JobT,RunT> & ParameterizedJobMixIn.ParameterizedJob & Queue.Task,RunT extends Run<JobT,RunT> & Queue.Executable> extends Object
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.| Modifier and Type | Class and Description |
|---|---|
static interface |
ParameterizedJobMixIn.ParameterizedJob
Marker for job using this mixin.
|
| Modifier and Type | Field and Description |
|---|---|
static AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> |
BUILD_NOW_TEXT
Allows customization of the human-readable display name to be rendered in the Build Now link.
|
| Constructor and Description |
|---|
ParameterizedJobMixIn() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract JobT |
asJob() |
void |
doBuild(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
TimeDuration delay)
Schedules a new build command.
|
void |
doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
TimeDuration delay)
Supports build trigger with parameters via an HTTP GET or POST.
|
void |
doCancelQueue(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Cancels a scheduled build.
|
SearchIndexBuilder |
extendSearchIndex(SearchIndexBuilder sib)
Use from a
Job.makeSearchIndex() override. |
static CauseAction |
getBuildCause(ParameterizedJobMixIn.ParameterizedJob job,
org.kohsuke.stapler.StaplerRequest req)
Computes the build cause, using RemoteCause or UserCause as appropriate.
|
String |
getBuildNowText()
Suggested implementation of
ParameterizedJobMixIn.ParameterizedJob.getBuildNowText(). |
static <T extends Trigger<?>> |
getTrigger(Job<?,?> job,
Class<T> clazz)
Checks for the existence of a specific trigger on a job.
|
boolean |
isParameterized()
A job should define a method of the same signature for use from
BuildButtonColumn. |
boolean |
scheduleBuild() |
boolean |
scheduleBuild(Cause c) |
boolean |
scheduleBuild(int quietPeriod) |
boolean |
scheduleBuild(int quietPeriod,
Cause c) |
QueueTaskFuture<RunT> |
scheduleBuild2(int quietPeriod,
Action... actions)
Provides a standard implementation of an optional method of the same name in a
Job type to schedule a build with the ability to wait for its result. |
static Queue.Item |
scheduleBuild2(Job<?,?> job,
int quietPeriod,
Action... actions)
Convenience method to schedule a build.
|
public static final AlternativeUiTextProvider.Message<ParameterizedJobMixIn.ParameterizedJob> BUILD_NOW_TEXT
getBuildNowText()protected abstract JobT asJob()
public final boolean scheduleBuild()
BuildableItem.scheduleBuild()public final boolean scheduleBuild(Cause c)
BuildableItem.scheduleBuild(Cause)public final boolean scheduleBuild(int quietPeriod)
BuildableItem.scheduleBuild(int)public final boolean scheduleBuild(int quietPeriod,
Cause c)
BuildableItem.scheduleBuild(int, Cause)@CheckForNull public final QueueTaskFuture<RunT> scheduleBuild2(int quietPeriod, Action... actions)
Job type to schedule a build with the ability to wait for its result.
That job method is often used during functional tests (JenkinsRule.assertBuildStatusSuccess).quietPeriod - seconds to wait before starting (normally 0)actions - various actions to associate with the scheduling, such as ParametersAction or CauseAction@CheckForNull public static Queue.Item scheduleBuild2(Job<?,?> job, int quietPeriod, Action... actions)
Trigger implementations, for example.
If you need to wait for the build to start (or finish), use Queue.Item#getFuture.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 as ParametersAction or CauseActionQueue.QueueDecisionHandler rejected it), or if job is not a ParameterizedJobMixIn.ParameterizedJob or it is not Job.isBuildable())public final boolean isParameterized()
BuildButtonColumn.public final void doBuild(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
@QueryParameter
TimeDuration delay)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic final void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
@QueryParameter
TimeDuration delay)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic final void doCancelQueue(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
RequirePOST but with the same signature and delegate to this.IOExceptionjavax.servlet.ServletExceptionpublic final SearchIndexBuilder extendSearchIndex(SearchIndexBuilder sib)
Job.makeSearchIndex() override.sib - the super value@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final CauseAction getBuildCause(ParameterizedJobMixIn.ParameterizedJob job, org.kohsuke.stapler.StaplerRequest req)
public final String getBuildNowText()
ParameterizedJobMixIn.ParameterizedJob.getBuildNowText().
Uses BUILD_NOW_TEXT.@CheckForNull public static <T extends Trigger<?>> T getTrigger(Job<?,?> job, Class<T> clazz)
T - a trigger typejob - a jobclazz - the type of the triggerjob is not a ParameterizedJobMixIn.ParameterizedJobCopyright © 2019. All rights reserved.