au.com.centrumsystems.hudson.plugin.buildpipeline
Class BuildPipelineView

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.View
          extended by au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.model.View>, hudson.model.ModelObject, hudson.model.Saveable, hudson.search.SearchableModelObject, hudson.search.SearchItem, hudson.security.AccessControlled, jenkins.model.ModelObjectWithChildren
Direct Known Subclasses:
ReadOnlyBuildPipelineView

public class BuildPipelineView
extends hudson.model.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
static class BuildPipelineView.DescriptorImpl
          This descriptor class is required to configure the View Page
 
Nested classes/interfaces inherited from class hudson.model.View
hudson.model.View.AsynchPeople, hudson.model.View.People, hudson.model.View.PropertyList, hudson.model.View.UserInfo
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.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, transientActions
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
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)
           
BuildPipelineView(String name, String buildViewTitle, ProjectGridBuilder gridBuilder, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, String cssUrl)
           
 
Method Summary
 boolean contains(hudson.model.TopLevelItem item)
           
 hudson.model.Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 String getAlwaysAllowManualTrigger()
           
 BuildPipelineForm getBuildPipelineForm()
          Returns BuildPipelineForm containing the build pipeline to display.
 String getBuildViewTitle()
           
 String getConsoleOutputLinkStyle()
           
 String getCssUrl()
           
 List<hudson.model.AbstractProject<?,?>> getDownstreamProjects(hudson.model.AbstractProject<?,?> currentProject)
          Get a List of downstream projects.
 ProjectGridBuilder getGridBuilder()
           
 Collection<hudson.model.TopLevelItem> getItems()
           
 String getNoOfDisplayedBuilds()
           
 String getProjectURL(hudson.model.AbstractProject<?,?> project)
          Retrieves the project URL
 int getRefreshFrequency()
           
 int getRefreshFrequencyInMillis()
           
 String getShowPipelineDefinitionHeader()
           
 String getShowPipelineParameters()
           
 String getShowPipelineParametersInHeaders()
           
 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(hudson.model.AbstractProject<?,?> currentProject)
          Determines if the current project has any downstream projects
 boolean hasPermission(hudson.security.Permission p)
           
 boolean isAlwaysAllowManualTrigger()
           
 boolean isNewWindowConsoleOutputLinkStyle()
           
 boolean isProjectParameterized()
          Checks if this build starts with parameters
 boolean isShowPipelineDefinitionHeader()
           
 boolean isShowPipelineParameters()
           
 boolean isShowPipelineParametersInHeaders()
           
 boolean isThisWindowConsoleOutputLinkStyle()
           
 boolean isTriggerOnlyLatestJob()
           
 void onJobRenamed(hudson.model.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()
           
 int rerunBuild(String externalizableId)
           
 int retryBuild(String triggerProjectName)
           
 void setAlwaysAllowManualTrigger(boolean alwaysAllowManualTrigger)
           
 void setBuildViewTitle(String buildViewTitle)
           
 void setConsoleOutputLinkStyle(String consoleOutputLinkStyle)
           
 void setCssUrl(String cssUrl)
           
 void setGridBuilder(ProjectGridBuilder gridBuilder)
           
 void setNoOfDisplayedBuilds(String noOfDisplayedBuilds)
           
 void setRefreshFrequency(int refreshFrequency)
           
 void setShowPipelineDefinitionHeader(boolean showPipelineDefinitionHeader)
           
 void setShowPipelineParameters(boolean showPipelineParameters)
           
 void setShowPipelineParametersInHeaders(boolean showPipelineParametersInHeaders)
           
 void setTriggerOnlyLatestJob(boolean triggerOnlyLatestJob)
           
protected  void submit(org.kohsuke.stapler.StaplerRequest req)
          Handles the configuration submission
 int triggerManualBuild(Integer upstreamBuildNumber, String triggerProjectName, String upstreamProjectName)
          Trigger a manual build
 
Methods inherited from class hudson.model.View
all, allInstantiable, checkPermission, create, createViewFromXML, doChildrenContextMenu, doConfigDotXml, doConfigSubmit, doDoDelete, 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, getWidgets, hasPeople, isDefault, isEditable, isFilterExecutors, isFilterQueue, makeSearchIndex, rename, save, 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
 

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 view
triggerOnlyLatestJob - 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)
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 view
triggerOnlyLatestJob - 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 cards
cssUrl - URL for the custom CSS file.
selectedJob - the first job name in the pipeline. it can be set to null when gridBuilder is passed.
Method Detail

readResolve

protected Object readResolve()
Returns:
must be always 'this'

submit

protected void submit(org.kohsuke.stapler.StaplerRequest req)
               throws IOException,
                      javax.servlet.ServletException,
                      hudson.model.Descriptor.FormException
Handles the configuration submission

Specified by:
submit in class hudson.model.View
Parameters:
req - Stapler Request
Throws:
hudson.model.Descriptor.FormException - Form Exception
IOException - IO Exception
javax.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

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<hudson.model.AbstractProject<?,?>> getDownstreamProjects(hudson.model.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(hudson.model.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(hudson.model.AbstractProject<?,?> project)
                     throws URISyntaxException
Retrieves the project URL

Parameters:
project - - The project
Returns:
URL - of the project
Throws:
URISyntaxException
URISyntaxException - URISyntaxException

triggerManualBuild

@JavaScriptMethod
public int triggerManualBuild(Integer upstreamBuildNumber,
                                               String triggerProjectName,
                                               String upstreamProjectName)
Trigger a manual build

Parameters:
upstreamBuildNumber - upstream build number
triggerProjectName - project that is triggered
upstreamProjectName - upstream project
Returns:
next build number that has been scheduled

retryBuild

@JavaScriptMethod
public int retryBuild(String triggerProjectName)
Parameters:
triggerProjectName - the triggerProjectName
Returns:
the number of re-tried build

rerunBuild

@JavaScriptMethod
public int rerunBuild(String externalizableId)
Parameters:
externalizableId - the externalizableId
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)

isShowPipelineParameters

public boolean isShowPipelineParameters()

getShowPipelineParameters

public String getShowPipelineParameters()

setShowPipelineParameters

public void setShowPipelineParameters(boolean showPipelineParameters)

isShowPipelineParametersInHeaders

public boolean isShowPipelineParametersInHeaders()

getShowPipelineParametersInHeaders

public String getShowPipelineParametersInHeaders()

setShowPipelineParametersInHeaders

public void setShowPipelineParametersInHeaders(boolean showPipelineParametersInHeaders)

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<hudson.model.TopLevelItem> getItems()
Specified by:
getItems in class hudson.model.View

contains

public boolean contains(hudson.model.TopLevelItem item)
Specified by:
contains in class hudson.model.View

onJobRenamed

public void onJobRenamed(hudson.model.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 class hudson.model.View
Parameters:
item - - The Item that has been renamed
oldName - - The old name of the Item
newName - - The new name of the Item

doCreateItem

public hudson.model.Item doCreateItem(org.kohsuke.stapler.StaplerRequest req,
                                      org.kohsuke.stapler.StaplerResponse rsp)
                               throws IOException,
                                      javax.servlet.ServletException
Specified by:
doCreateItem in class hudson.model.View
Throws:
IOException
javax.servlet.ServletException

hasPermission

public boolean hasPermission(hudson.security.Permission p)
Specified by:
hasPermission in interface hudson.security.AccessControlled
Overrides:
hasPermission in class hudson.model.View


Copyright © 2004-2015. All Rights Reserved.