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, HasWidgets
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
  • Constructor Details

    • 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, 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 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.
      columnHeaders - see columnHeaders
      rowHeaders - see rowHeaders
      buildCard - see buildCard
  • Method Details

    • readResolve

      protected Object readResolve()
      Migrate old data, set new fields
      Returns:
      must be always 'this'
      See Also:
    • submit

      protected void submit(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException, Descriptor.FormException
      Handles the configuration submission
      Overrides:
      submit in class View
      Parameters:
      req - Stapler Request
      Throws:
      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:
    • 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 number
      triggerProjectName - project that is triggered
      upstreamProjectName - 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 completed Run so that the new run will appear in the same pipeline.
      Parameters:
      externalizableId - the externalizableId of the Run. See Run.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()
      Specified by:
      getItems in class View
    • contains

      public boolean contains(TopLevelItem item)
      Specified by:
      contains in class View
    • 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 class 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 Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
      Overrides:
      doCreateItem in class View
      Throws:
      IOException
      javax.servlet.ServletException
    • hasPermission

      public boolean hasPermission(Permission p)