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

java.lang.Object
  extended by au.com.centrumsystems.hudson.plugin.buildpipeline.PipelineBuild

public class PipelineBuild
extends Object

Author:
Centrum Systems

Constructor Summary
PipelineBuild()
          Default constructor
PipelineBuild(hudson.model.AbstractBuild<?,?> build)
          Convenience method to create PipelineBuild from a build.
PipelineBuild(hudson.model.AbstractBuild<?,?> build, hudson.model.AbstractProject<?,?> project, hudson.model.AbstractBuild<?,?> previousBuild)
          Creates a new PipelineBuild with currentBuild, project and upstreamBuild set.
PipelineBuild(hudson.model.FreeStyleProject project)
           
 
Method Summary
protected  long calculatePercentage(long duration, long estimatedDuration)
          Calculates percentage of the current duration to the estimated duration.
 String getBuildDescription()
          Returns the current build description.
 String getBuildDuration()
          Returns the current build duration.
 Map<String,String> getBuildParameters()
           
 long getBuildProgress()
          Returns the estimated percentage complete of the current build.
 String getBuildResultURL()
          Build a URL of the currentBuild
 hudson.model.AbstractBuild<?,?> getCurrentBuild()
           
 String getCurrentBuildNumber()
          Returns the current build number.
 String getCurrentBuildResult()
          Determines the result of the current build.
 List<PipelineBuild> getDownstreamPipeline()
          Constructs a List of downstream PipelineBuild objects that make up the current pipeline.
 String getFormattedStartDate()
           
 String getFormattedStartTime()
           
 String getPipelineVersion()
          Return pipeline version which is simply the first build's number
 hudson.model.AbstractProject<?,?> getProject()
          Returns the project name.
 String getProjectHealth()
           
 String getProjectURL()
          Builds a URL of the current project
 Date getStartTime()
          Start time of build
 hudson.model.AbstractBuild<?,?> getUpstreamBuild()
           
 String getUpstreamBuildResult()
          Determines the result of the upstream build.
 PipelineBuild getUpstreamPipelineBuild()
          Returns the upstream PipelineBuild object from the current PipelineBuild object.
 boolean hasBuildPermission()
          Checks whether the user has Build permission for the current project.
 boolean isManualTrigger()
          Determine if the project is triggered manually, regardless of the state of its upstream builds
 boolean isProjectDisabled()
           
 boolean isReadyToBeManuallyBuilt()
           
 boolean isRerunnable()
           
 void setCurrentBuild(hudson.model.AbstractBuild<?,?> currentBuild)
           
 void setProject(hudson.model.AbstractProject<?,?> currentProject)
           
 void setUpstreamBuild(hudson.model.AbstractBuild<?,?> upstreamBuild)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PipelineBuild

public PipelineBuild()
Default constructor


PipelineBuild

public PipelineBuild(hudson.model.AbstractBuild<?,?> build,
                     hudson.model.AbstractProject<?,?> project,
                     hudson.model.AbstractBuild<?,?> previousBuild)
Creates a new PipelineBuild with currentBuild, project and upstreamBuild set.

Parameters:
build - - current build
project - - current project
previousBuild - - upstream build

PipelineBuild

public PipelineBuild(hudson.model.AbstractBuild<?,?> build)
Convenience method to create PipelineBuild from a build.

Parameters:
build - The object to be wrapped.

PipelineBuild

public PipelineBuild(hudson.model.FreeStyleProject project)
Parameters:
project - project
Method Detail

getCurrentBuild

public hudson.model.AbstractBuild<?,?> getCurrentBuild()

setCurrentBuild

public void setCurrentBuild(hudson.model.AbstractBuild<?,?> currentBuild)

getUpstreamBuild

public hudson.model.AbstractBuild<?,?> getUpstreamBuild()

setUpstreamBuild

public void setUpstreamBuild(hudson.model.AbstractBuild<?,?> upstreamBuild)

setProject

public void setProject(hudson.model.AbstractProject<?,?> currentProject)

getProject

public hudson.model.AbstractProject<?,?> getProject()
Returns the project name. If the current project is null the project name is determined using the current build.

Returns:
- Project name

getCurrentBuildNumber

public String getCurrentBuildNumber()
Returns the current build number.

Returns:
- Current build number or empty String is the current build is null.

getDownstreamPipeline

public List<PipelineBuild> getDownstreamPipeline()
Constructs a List of downstream PipelineBuild objects that make up the current pipeline.

Returns:
- List of downstream PipelineBuild objects that make up the current pipeline.

getBuildResultURL

public String getBuildResultURL()
Build a URL of the currentBuild

Returns:
URL of the currentBuild

getProjectURL

public String getProjectURL()
Builds a URL of the current project

Returns:
URL - of the project

getCurrentBuildResult

public String getCurrentBuildResult()
Determines the result of the current build.

Returns:
- String representing the build result
See Also:
getBuildResult(AbstractBuild)

getUpstreamBuildResult

public String getUpstreamBuildResult()
Determines the result of the upstream build.

Returns:
- String representing the build result
See Also:
getBuildResult(AbstractBuild)

getUpstreamPipelineBuild

public PipelineBuild getUpstreamPipelineBuild()
Returns the upstream PipelineBuild object from the current PipelineBuild object.

Returns:
- Upstream PipelineBuild object from the current PipelineBuild object

getBuildDuration

public String getBuildDuration()
Returns the current build duration.

Returns:
- Current build duration or an empty String if the current build is null.

toString

public String toString()

Overrides:
toString in class Object

getBuildDescription

public String getBuildDescription()
Returns the current build description.

Returns:
- Current build description or the project name if the current build is null.

getBuildProgress

public long getBuildProgress()
Returns the estimated percentage complete of the current build.

Returns:
- Estimated percentage complete of the current build.

calculatePercentage

protected long calculatePercentage(long duration,
                                   long estimatedDuration)
Calculates percentage of the current duration to the estimated duration. Caters for the possibility that current duration will be longer than estimated duration

Parameters:
duration - - Current running time in milliseconds
estimatedDuration - - Estimated running time in milliseconds
Returns:
- Percentage of current duration to estimated duration

getPipelineVersion

public String getPipelineVersion()
Return pipeline version which is simply the first build's number

Returns:
pipeline verison

hasBuildPermission

public boolean hasBuildPermission()
Checks whether the user has Build permission for the current project.

Returns:
- true: Has Build permission; false: Does not have Build permission
See Also:
Item

isReadyToBeManuallyBuilt

public boolean isReadyToBeManuallyBuilt()
Returns:
is ready to be manually built.

isRerunnable

public boolean isRerunnable()

isManualTrigger

public boolean isManualTrigger()
Determine if the project is triggered manually, regardless of the state of its upstream builds

Returns:
true if it is manual

getStartTime

public Date getStartTime()
Start time of build

Returns:
start time

getFormattedStartTime

public String getFormattedStartTime()
Returns:
Formatted start time

getFormattedStartDate

public String getFormattedStartDate()
Returns:
Formatted start date

getBuildParameters

public Map<String,String> getBuildParameters()
Returns:
a map including build parameters

isProjectDisabled

public boolean isProjectDisabled()

getProjectHealth

public String getProjectHealth()


Copyright © 2004-2015. All Rights Reserved.