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
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.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, SORTER, transientActions
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
BuildPipelineView(String name, String buildViewTitle, String selectedJob, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob)
           
BuildPipelineView(String name, String buildViewTitle, String selectedJob, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob, boolean alwaysAllowManualTrigger, boolean showPipelineParameters, int refreshFrequency)
           
 
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()
           
 List<hudson.model.AbstractProject<?,?>> getDownstreamProjects(hudson.model.AbstractProject<?,?> currentProject)
          Get a List of downstream projects.
 Collection<hudson.model.TopLevelItem> getItems()
           
 String getNoOfDisplayedBuilds()
           
 String getProjectURL(hudson.model.AbstractProject<?,?> project)
          Retrieves the project URL
 int getRefreshFrequency()
           
 int getRefreshFrequencyInMillis()
           
 String getSelectedJob()
           
 hudson.model.AbstractProject<?,?> getSelectedProject()
          Gets the selected project
 String getShowPipelineParameters()
           
 String getTriggerOnlyLatestJob()
           
 boolean hasBuildPermission(hudson.model.AbstractProject<?,?> currentProject)
          Checks whether the user has Build permission for the current project.
 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 hasSelectedProject()
          Tests if the selected project exists.
 boolean isAlwaysAllowManualTrigger()
           
 boolean isShowPipelineParameters()
           
 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.
 int rerunSuccessfulBuild(String externalizableId)
           
 void setAlwaysAllowManualTrigger(boolean alwaysAllowManualTrigger)
           
 void setBuildViewTitle(String buildViewTitle)
           
 void setNoOfDisplayedBuilds(String noOfDisplayedBuilds)
           
 void setRefreshFrequency(int refreshFrequency)
           
 void setSelectedJob(String selectedJob)
           
 void setShowPipelineParameters(boolean showPipelineParameters)
           
 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, doConfigSubmit, doDoDelete, doRssAll, doRssFailed, doRssLatest, doSubmitDescription, getAbsoluteUrl, getACL, getActions, getAllProperties, getApi, getApplicablePropertyDescriptors, 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, hasPermission, isDefault, isEditable, isFilterExecutors, isFilterQueue, makeSearchIndex, rename, save
 
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, toString, wait, wait, wait
 

Constructor Detail

BuildPipelineView

@DataBoundConstructor
public BuildPipelineView(String name,
                                              String buildViewTitle,
                                              String selectedJob,
                                              String noOfDisplayedBuilds,
                                              boolean triggerOnlyLatestJob)
Parameters:
name - the name of the pipeline build view.
buildViewTitle - the build view title.
selectedJob - the first job in the build pipeline.
noOfDisplayedBuilds - a count of the number of builds displayed on the view
triggerOnlyLatestJob - Indicates whether only the latest job will be triggered.

BuildPipelineView

@DataBoundConstructor
public BuildPipelineView(String name,
                                              String buildViewTitle,
                                              String selectedJob,
                                              String noOfDisplayedBuilds,
                                              boolean triggerOnlyLatestJob,
                                              boolean alwaysAllowManualTrigger,
                                              boolean showPipelineParameters,
                                              int refreshFrequency)
Parameters:
name - the name of the pipeline build view.
buildViewTitle - the build view title.
selectedJob - the first job in the build pipeline.
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.
refreshFrequency - Frequency at which the build pipeline plugin refreshes build cards
Method Detail

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

getSelectedProject

public hudson.model.AbstractProject<?,?> getSelectedProject()
Gets the selected project

Returns:
- The selected project in the current view

hasSelectedProject

public boolean hasSelectedProject()
Tests if the selected project exists.

Returns:
- true: Selected project exists; false: Selected project does not exist.

hasBuildPermission

public boolean hasBuildPermission(hudson.model.AbstractProject<?,?> currentProject)
Checks whether the user has Build permission for the current project.

Parameters:
currentProject - - The project being viewed.
Returns:
- true: Has Build permission; false: Does not have Build permission
See Also:
Item

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

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()
                                       throws URISyntaxException
Returns BuildPipelineForm containing the build pipeline to display.

Returns:
- Representation of the projects and their related builds making up the build pipeline view
Throws:
URISyntaxException - URISyntaxException

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
See Also:
ProjectUtil#getProjectURL(AbstractProject)}

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

rerunSuccessfulBuild

@JavaScriptMethod
public int rerunSuccessfulBuild(String externalizableId)
Parameters:
externalizableId - the externalizableId
Returns:
number of reruned build

getBuildViewTitle

public String getBuildViewTitle()

setBuildViewTitle

public void setBuildViewTitle(String buildViewTitle)

getNoOfDisplayedBuilds

public String getNoOfDisplayedBuilds()

setNoOfDisplayedBuilds

public void setNoOfDisplayedBuilds(String noOfDisplayedBuilds)

getSelectedJob

public String getSelectedJob()

setSelectedJob

public void setSelectedJob(String selectedJob)

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()

getRefreshFrequency

public int getRefreshFrequency()

setRefreshFrequency

public void setRefreshFrequency(int refreshFrequency)

getRefreshFrequencyInMillis

public int getRefreshFrequencyInMillis()

setShowPipelineParameters

public void setShowPipelineParameters(boolean showPipelineParameters)
Parameters:
showPipelineParameters - showPipelineParameters

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.

Specified by:
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


Copyright © 2004-2012. All Rights Reserved.