Class BuildPipelineView
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.View
-
- au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<View>
,DescriptorByNameOwner
,ModelObject
,Saveable
,SearchableModelObject
,SearchItem
,AccessControlled
,ModelObjectWithChildren
- Direct Known Subclasses:
ReadOnlyBuildPipelineView
public class BuildPipelineView extends View
This view displays the set of jobs that are related based on their upstream\downstream relationships as a pipeline. Each build pipeline becomes a row on the view.- Author:
- Centrum Systems
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BuildPipelineView.DescriptorImpl
This descriptor class is required to configure the View Pagestatic interface
BuildPipelineView.Function<F,T>
A function which accepts an argument and returns a result.-
Nested classes/interfaces inherited from class hudson.model.View
View.AsynchPeople, View.People, View.PropertyList, View.UserInfo
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.View
CONFIGURE, CREATE, DELETE, description, filterExecutors, filterQueue, LIST, name, NEW_PRONOUN, owner, PERMISSIONS, READ, SORTER
-
-
Constructor Summary
Constructors Constructor Description BuildPipelineView(String name, String buildViewTitle, ProjectGridBuilder gridBuilder, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, boolean alwaysAllowManualTrigger, boolean showPipelineParameters, boolean showPipelineParametersInHeaders, boolean showPipelineDefinitionHeader, int refreshFrequency, String cssUrl, String selectedJob, PipelineHeaderExtension columnHeaders, PipelineHeaderExtension rowHeaders, BuildCardExtension buildCard)
BuildPipelineView(String name, String buildViewTitle, ProjectGridBuilder gridBuilder, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, String cssUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(TopLevelItem item)
Item
doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
String
getAlwaysAllowManualTrigger()
BuildCardExtension
getBuildCard()
BuildPipelineForm
getBuildPipelineForm()
Returns BuildPipelineForm containing the build pipeline to display.String
getBuildViewTitle()
PipelineHeaderExtension
getColumnHeaders()
String
getConsoleOutputLinkStyle()
String
getCssUrl()
List<AbstractProject<?,?>>
getDownstreamProjects(AbstractProject<?,?> currentProject)
Get a List of downstream projects.ProjectGridBuilder
getGridBuilder()
Collection<TopLevelItem>
getItems()
String
getNoOfDisplayedBuilds()
String
getProjectURL(AbstractProject<?,?> project)
Retrieves the project URLint
getRefreshFrequency()
int
getRefreshFrequencyInMillis()
PipelineHeaderExtension
getRowHeaders()
String
getShowPipelineDefinitionHeader()
String
getTriggerOnlyLatestJob()
boolean
hasBuildPermission()
Checks whether the user has a permission to start a new instance of the pipeline.boolean
hasConfigurePermission()
Checks whether the user has Configure permission for the current project.boolean
hasDownstreamProjects(AbstractProject<?,?> currentProject)
Determines if the current project has any downstream projectsboolean
hasPermission(Permission p)
boolean
isAlwaysAllowManualTrigger()
boolean
isNewWindowConsoleOutputLinkStyle()
boolean
isProjectParameterized()
Checks if this build starts with parametersboolean
isShowPipelineDefinitionHeader()
boolean
isThisWindowConsoleOutputLinkStyle()
boolean
isTriggerOnlyLatestJob()
void
onJobRenamed(Item item, String oldName, String newName)
If a project name is changed we check if the selected job for this view also needs to be changed.protected Object
readResolve()
Migrate old data, set new fieldsint
rerunBuild(String externalizableId)
Re-run a project, passing in the CauseActions from the previous completedRun
so that the new run will appear in the same pipeline.void
setAlwaysAllowManualTrigger(boolean alwaysAllowManualTrigger)
void
setBuildCard(BuildCardExtension buildCard)
void
setBuildViewTitle(String buildViewTitle)
void
setColumnHeaders(PipelineHeaderExtension columnHeaders)
void
setConsoleOutputLinkStyle(String consoleOutputLinkStyle)
void
setCssUrl(String cssUrl)
void
setGridBuilder(ProjectGridBuilder gridBuilder)
void
setNoOfDisplayedBuilds(String noOfDisplayedBuilds)
void
setRefreshFrequency(int refreshFrequency)
void
setRowHeaders(PipelineHeaderExtension rowHeaders)
void
setShowPipelineDefinitionHeader(boolean showPipelineDefinitionHeader)
void
setTriggerOnlyLatestJob(boolean triggerOnlyLatestJob)
protected void
submit(org.kohsuke.stapler.StaplerRequest req)
Handles the configuration submissionint
triggerManualBuild(Integer upstreamBuildNumber, String triggerProjectName, String upstreamProjectName)
Trigger a manual build-
Methods inherited from class hudson.model.View
all, allInstantiable, create, createViewFromXML, doCheckJobName, doChildrenContextMenu, doConfigDotXml, doConfigSubmit, doDoDelete, doItemCategories, doRssAll, doRssFailed, doRssLatest, doSubmitDescription, getAbsoluteUrl, getACL, getActions, getAllItems, getAllProperties, getApi, getApplicablePropertyDescriptors, getApproximateQueueItemsQuickly, getAsynchPeople, getBuilds, getColumns, getComputers, getDescription, getDescriptor, getDisplayName, getDynamic, getIndenter, getItem, getItemCreatePermission, getJob, getNewPronoun, getOwner, getOwnerItemGroup, getOwnerPrimaryView, getOwnerViewActions, getPeople, getPostConstructLandingPage, getProperties, getQueueItems, getSearchUrl, getTimeline, getUrl, getViewName, getViewUrl, getVisiblePropertyDescriptors, getWidgets, hasPeople, isAutomaticRefreshEnabled, isDefault, isEditable, isFilterExecutors, isFilterQueue, makeSearchIndex, makeSearchIndex, registerPermissions, rename, save, setDescription, toString, updateByXml, updateTransientActions, writeXml
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission2
-
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
-
-
-
-
Constructor Detail
-
BuildPipelineView
public BuildPipelineView(String name, String buildViewTitle, ProjectGridBuilder gridBuilder, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, String cssUrl)
- Parameters:
name
- the name of the pipeline build view.buildViewTitle
- the build view title.gridBuilder
- controls the data to be displayed.noOfDisplayedBuilds
- a count of the number of builds displayed on the viewtriggerOnlyLatestJob
- Indicates whether only the latest job will be triggered.cssUrl
- URL for the custom CSS file.
-
BuildPipelineView
@DataBoundConstructor public BuildPipelineView(String name, String buildViewTitle, ProjectGridBuilder gridBuilder, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, boolean alwaysAllowManualTrigger, boolean showPipelineParameters, boolean showPipelineParametersInHeaders, boolean showPipelineDefinitionHeader, int refreshFrequency, String cssUrl, String selectedJob, PipelineHeaderExtension columnHeaders, PipelineHeaderExtension rowHeaders, BuildCardExtension buildCard)
- Parameters:
name
- the name of the pipeline build view.buildViewTitle
- the build view title.gridBuilder
- controls the data to be displayed.noOfDisplayedBuilds
- a count of the number of builds displayed on the viewtriggerOnlyLatestJob
- Indicates whether only the latest job will be triggered.alwaysAllowManualTrigger
- Indicates whether manual trigger will always be available.showPipelineParameters
- Indicates whether pipeline parameter values should be shown.showPipelineParametersInHeaders
- Indicates whether the pipeline headers should show the pipeline parameter values for the last successful instance.showPipelineDefinitionHeader
- Indicates whether the pipeline headers should be shown.refreshFrequency
- Frequency at which the build pipeline plugin refreshes build cardscssUrl
- URL for the custom CSS file.selectedJob
- the first job name in the pipeline. it can be set to null when gridBuilder is passed.columnHeaders
- seecolumnHeaders
rowHeaders
- seerowHeaders
buildCard
- seebuildCard
-
-
Method Detail
-
readResolve
protected Object readResolve()
Migrate old data, set new fields- Returns:
- must be always 'this'
- See Also:
- Jenkins wiki entry on the subject
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException, Descriptor.FormException
Handles the configuration submission- Specified by:
submit
in classView
- Parameters:
req
- Stapler Request- Throws:
Descriptor.FormException
- Form ExceptionIOException
- IO Exceptionjavax.servlet.ServletException
- Servlet Exception
-
hasBuildPermission
public boolean hasBuildPermission()
Checks whether the user has a permission to start a new instance of the pipeline.- Returns:
- - true: Has Build permission; false: Does not have Build permission
- See Also:
Item
-
isProjectParameterized
public boolean isProjectParameterized()
Checks if this build starts with parameters- Returns:
- - true: The build has parameters; false: Does not have parameters
-
getColumnHeaders
public PipelineHeaderExtension getColumnHeaders()
-
setColumnHeaders
public void setColumnHeaders(PipelineHeaderExtension columnHeaders)
-
getRowHeaders
public PipelineHeaderExtension getRowHeaders()
-
setRowHeaders
public void setRowHeaders(PipelineHeaderExtension rowHeaders)
-
getBuildCard
public BuildCardExtension getBuildCard()
-
setBuildCard
public void setBuildCard(BuildCardExtension buildCard)
-
hasConfigurePermission
public boolean hasConfigurePermission()
Checks whether the user has Configure permission for the current project.- Returns:
- - true: Has Configure permission; false: Does not have Configure permission
-
getGridBuilder
public ProjectGridBuilder getGridBuilder()
-
setGridBuilder
public void setGridBuilder(ProjectGridBuilder gridBuilder)
-
getDownstreamProjects
public List<AbstractProject<?,?>> getDownstreamProjects(AbstractProject<?,?> currentProject)
Get a List of downstream projects.- Parameters:
currentProject
- - The project from which we want the downstream projects- Returns:
- - A List of downstream projects
-
hasDownstreamProjects
public boolean hasDownstreamProjects(AbstractProject<?,?> currentProject)
Determines if the current project has any downstream projects- Parameters:
currentProject
- - The project from which we are testing.- Returns:
- - true; has downstream projects; false: does not have downstream projects
-
getBuildPipelineForm
public BuildPipelineForm getBuildPipelineForm()
Returns BuildPipelineForm containing the build pipeline to display.- Returns:
- - Representation of the projects and their related builds making up the build pipeline view
-
getProjectURL
public String getProjectURL(AbstractProject<?,?> project) throws URISyntaxException
Retrieves the project URL- Parameters:
project
- - The project- Returns:
- URL - of the project
- Throws:
URISyntaxException
- on error
-
triggerManualBuild
@JavaScriptMethod public int triggerManualBuild(Integer upstreamBuildNumber, String triggerProjectName, String upstreamProjectName)
Trigger a manual build- Parameters:
upstreamBuildNumber
- upstream build numbertriggerProjectName
- project that is triggeredupstreamProjectName
- upstream project- Returns:
- next build number that has been scheduled
-
rerunBuild
@JavaScriptMethod public int rerunBuild(String externalizableId)
Re-run a project, passing in the CauseActions from the previous completedRun
so that the new run will appear in the same pipeline.- Parameters:
externalizableId
- the externalizableId of the Run. SeeRun.getExternalizableId()
- Returns:
- the number of re-run build
-
getBuildViewTitle
public String getBuildViewTitle()
-
setBuildViewTitle
public void setBuildViewTitle(String buildViewTitle)
-
getCssUrl
public String getCssUrl()
-
setCssUrl
public void setCssUrl(String cssUrl)
-
getNoOfDisplayedBuilds
public String getNoOfDisplayedBuilds()
-
setNoOfDisplayedBuilds
public void setNoOfDisplayedBuilds(String noOfDisplayedBuilds)
-
getConsoleOutputLinkStyle
public String getConsoleOutputLinkStyle()
-
setConsoleOutputLinkStyle
public void setConsoleOutputLinkStyle(String consoleOutputLinkStyle)
-
isNewWindowConsoleOutputLinkStyle
public boolean isNewWindowConsoleOutputLinkStyle()
-
isThisWindowConsoleOutputLinkStyle
public boolean isThisWindowConsoleOutputLinkStyle()
-
isTriggerOnlyLatestJob
public boolean isTriggerOnlyLatestJob()
-
getTriggerOnlyLatestJob
public String getTriggerOnlyLatestJob()
-
setTriggerOnlyLatestJob
public void setTriggerOnlyLatestJob(boolean triggerOnlyLatestJob)
-
isAlwaysAllowManualTrigger
public boolean isAlwaysAllowManualTrigger()
-
getAlwaysAllowManualTrigger
public String getAlwaysAllowManualTrigger()
-
setAlwaysAllowManualTrigger
public void setAlwaysAllowManualTrigger(boolean alwaysAllowManualTrigger)
-
getRefreshFrequency
public int getRefreshFrequency()
-
setRefreshFrequency
public void setRefreshFrequency(int refreshFrequency)
-
getRefreshFrequencyInMillis
public int getRefreshFrequencyInMillis()
-
isShowPipelineDefinitionHeader
public boolean isShowPipelineDefinitionHeader()
-
getShowPipelineDefinitionHeader
public String getShowPipelineDefinitionHeader()
-
setShowPipelineDefinitionHeader
public void setShowPipelineDefinitionHeader(boolean showPipelineDefinitionHeader)
-
getItems
public Collection<TopLevelItem> getItems()
-
contains
public boolean contains(TopLevelItem item)
-
onJobRenamed
public void onJobRenamed(Item item, String oldName, String newName)
If a project name is changed we check if the selected job for this view also needs to be changed.- Overrides:
onJobRenamed
in classView
- Parameters:
item
- - The Item that has been renamedoldName
- - The old name of the ItemnewName
- - The new name of the Item
-
doCreateItem
public Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
- Specified by:
doCreateItem
in classView
- Throws:
IOException
javax.servlet.ServletException
-
hasPermission
public boolean hasPermission(Permission p)
-
-