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 aJob
to make use ofParametersDefinitionProperty
and 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 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
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ParameterizedJobMixIn()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract JobT
asJob()
void
doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)
void
doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)
void
doCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
SearchIndexBuilder
extendSearchIndex(SearchIndexBuilder sib)
Use from aJob.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 ofParameterizedJobMixIn.ParameterizedJob.getBuildNowText()
.static <T extends Trigger<?>>
TgetTrigger(Job<?,?> job, Class<T> clazz)
Checks for the existence of a specific trigger on a job.boolean
isParameterized()
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.isParameterized()
.boolean
scheduleBuild()
boolean
scheduleBuild(int quietPeriod)
boolean
scheduleBuild(int quietPeriod, Cause c)
boolean
scheduleBuild(Cause c)
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 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()
-
-
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 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.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuild(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse, jenkins.util.TimeDuration)
.- Throws:
IOException
javax.servlet.ServletException
-
doBuildWithParameters
public final void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doBuildWithParameters(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse, jenkins.util.TimeDuration)
.- Throws:
IOException
javax.servlet.ServletException
-
doCancelQueue
public final void doCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
Standard implementation ofParameterizedJobMixIn.ParameterizedJob.doCancelQueue(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)
.- Throws:
IOException
javax.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
job
is not aParameterizedJobMixIn.ParameterizedJob
- Since:
- 1.621
-
-