hudson.plugins.analysis.core
Class BuildHistory

java.lang.Object
  extended by hudson.plugins.analysis.core.BuildHistory
Direct Known Subclasses:
NullBuildHistory

public class BuildHistory
extends Object

History of build results of a specific plug-in. The plug-in is identified by the corresponding ResultAction type.

Author:
Ulli Hafner

Constructor Summary
BuildHistory(hudson.model.AbstractBuild<?,?> baseline, Class<? extends ResultAction<? extends BuildResult>> type)
          Creates a new instance of BuildHistory.
 
Method Summary
 ResultAction<? extends BuildResult> getBaseline()
          Returns the baseline action.
 Collection<FileAnnotation> getFixedWarnings(Set<FileAnnotation> annotations)
          Returns the fixed warnings as a difference between the warnings of the reference build and the specified collection of warnings.
 AbstractHealthDescriptor getHealthDescriptor()
          Returns the health descriptor used for the builds.
 Collection<FileAnnotation> getNewWarnings(Set<FileAnnotation> annotations)
          Returns the new warnings as a difference between the specified collection of warnings and the warnings of the reference build.
 BuildResult getPreviousResult()
          Returns the previous build result.
 AnnotationContainer getReferenceAnnotations()
          Returns the annotations of the reference build.
 hudson.model.AbstractBuild<?,?> getReferenceBuild()
          Returns the reference build or null if there is no such build.
 ResultAction<? extends BuildResult> getResultAction(hudson.model.AbstractBuild<?,?> build)
          Returns the result action of the specified build that should be used to compute the history.
 Calendar getTimestamp()
          Returns the time of the baseline build.
 boolean hasPreviousResult()
          Returns whether a previous build result exists.
 boolean hasReferenceBuild()
          Returns whether a reference build is available to compare the results with.
 boolean isEmpty()
          Returns whether there is no history available, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildHistory

public BuildHistory(hudson.model.AbstractBuild<?,?> baseline,
                    Class<? extends ResultAction<? extends BuildResult>> type)
Creates a new instance of BuildHistory.

Parameters:
baseline - the build to start the history from
type - type of the action that contains the build results
Method Detail

getTimestamp

public Calendar getTimestamp()
Returns the time of the baseline build.

Returns:
the time

getReferenceAnnotations

public AnnotationContainer getReferenceAnnotations()
Returns the annotations of the reference build.

Returns:
the annotations of the reference build

getResultAction

@CheckForNull
public ResultAction<? extends BuildResult> getResultAction(hudson.model.AbstractBuild<?,?> build)
Returns the result action of the specified build that should be used to compute the history.

Parameters:
build - the build
Returns:
the result action

getReferenceBuild

@CheckForNull
public hudson.model.AbstractBuild<?,?> getReferenceBuild()
Returns the reference build or null if there is no such build.

Returns:
the reference build
Since:
1.20
See Also:
hasReferenceBuild()

hasReferenceBuild

public boolean hasReferenceBuild()
Returns whether a reference build is available to compare the results with.

Returns:
true if a reference build exists, false otherwise
Since:
1.20

hasPreviousResult

public boolean hasPreviousResult()
Returns whether a previous build result exists.

Returns:
true if a previous build result exists.
See Also:
isEmpty()

isEmpty

public boolean isEmpty()
Returns whether there is no history available, i.e. the current build is the first valid one.

Returns:
true if there is no previous build available
See Also:
hasPreviousResult()

getBaseline

public ResultAction<? extends BuildResult> getBaseline()
Returns the baseline action.

Returns:
the baseline action
Throws:
NoSuchElementException - if there is no previous result
See Also:
hasPreviousResult()

getPreviousResult

public BuildResult getPreviousResult()
Returns the previous build result.

Returns:
the previous build result
Throws:
NoSuchElementException - if there is no previous result
See Also:
hasPreviousResult()

getNewWarnings

public Collection<FileAnnotation> getNewWarnings(Set<FileAnnotation> annotations)
Returns the new warnings as a difference between the specified collection of warnings and the warnings of the reference build.

Parameters:
annotations - the warnings in the current build
Returns:
the difference "current build" - "reference build"

getFixedWarnings

public Collection<FileAnnotation> getFixedWarnings(Set<FileAnnotation> annotations)
Returns the fixed warnings as a difference between the warnings of the reference build and the specified collection of warnings.

Parameters:
annotations - the warnings in the current build
Returns:
the difference "reference build" - "current build"

getHealthDescriptor

public AbstractHealthDescriptor getHealthDescriptor()
Returns the health descriptor used for the builds.

Returns:
the health descriptor


Copyright © 2004-2012 Hudson. All Rights Reserved.