Class BuildViewExtension
- java.lang.Object
-
- hudson.plugins.project_inheritance.projects.view.BuildViewExtension
-
- All Implemented Interfaces:
ExtensionPoint
public abstract class BuildViewExtension extends Object implements ExtensionPoint
This class servers as an extension point to render additional configuration entries for a build action.It is useful to add additional properties to the build; regardless of whether or not this happens on a build or re-build.
The extension needs to implement a "value.groovy" or "value.jelly" which gets added into the form tag of the build submission. The name of this file can be overridden via
getValuePage()
.The fields will be put into the JSON form data inside the
StaplerRequest
when the build is executed. For simplicity's sake, the methodonBuild(AbstractProject, StaplerRequest)
will be called whenever a build is configured.- Author:
- mhschroe
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description BuildViewExtension()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<Action>
callAll(AbstractProject<?,?> project, org.kohsuke.stapler.StaplerRequest req)
static net.sf.json.JSONObject
getSubmittedFormSafely(org.kohsuke.stapler.StaplerRequest req)
Calling getSubmittedForm, if no form is present in aStaplerRequest
will throw an ugly exception.String
getValuePage()
static void
mergeParameters(List<Action> actions)
List<Action>
onBuild(AbstractProject<?,?> project, org.kohsuke.stapler.StaplerRequest req)
This function is being called, shortly before a build is being scheduled.
-
-
-
Method Detail
-
getValuePage
public String getValuePage()
-
onBuild
public List<Action> onBuild(AbstractProject<?,?> project, org.kohsuke.stapler.StaplerRequest req) throws javax.servlet.ServletException
This function is being called, shortly before a build is being scheduled.It allows you to inspect and alter the project and StaplerRequest and return additional Actions to be contributed to the build.
If a
ParametersAction
is returned, its definitions will be merged with the ParametersAction created from the build parameter page.- Parameters:
project
- the project for which a build will be startedreq
- the WebUI request that triggered the build.- Returns:
- a list of actions to contribute. May be empty, but never null.
- Throws:
javax.servlet.ServletException
- in case the build should be prevented entirely.
-
callAll
public static final List<Action> callAll(AbstractProject<?,?> project, org.kohsuke.stapler.StaplerRequest req) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getSubmittedFormSafely
public static final net.sf.json.JSONObject getSubmittedFormSafely(org.kohsuke.stapler.StaplerRequest req)
Calling getSubmittedForm, if no form is present in aStaplerRequest
will throw an ugly exception. Call this to avoid the exception.This can happen when triggering jobs that do not have parameters, and thus trigger a build purely via an HTTP GET without a form.
- Parameters:
req
- the user-request- Returns:
- the JSON form, or null if none is present (or the request was not a POST)
-
-