hudson.plugins.findbugs.util
Class AnnotationsBuildResult

java.lang.Object
  extended by hudson.plugins.findbugs.util.BuildResult
      extended by hudson.plugins.findbugs.util.AnnotationsBuildResult
All Implemented Interfaces:
hudson.model.ModelObject, AnnotationProvider, java.io.Serializable
Direct Known Subclasses:
FindBugsResult

public abstract class AnnotationsBuildResult
extends BuildResult

Common base class for build results that persist annotations. Provides loading and saving of annotations (all, new, and fixed) and delta computation.

Author:
Ulli Hafner
See Also:
Serialized Form

Field Summary
 
Fields inherited from class hudson.plugins.findbugs.util.BuildResult
XSTREAM
 
Constructor Summary
AnnotationsBuildResult(hudson.model.AbstractBuild<?,?> build, ParserResult result)
          Creates a new instance of AnnotationsBuildResult.
AnnotationsBuildResult(hudson.model.AbstractBuild<?,?> build, ParserResult result, AnnotationsBuildResult previous)
          Creates a new instance of AnnotationsBuildResult.
 
Method Summary
 void doStatistics(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates a PNG image for high/normal/low distribution of the specified object.
 AnnotationContainer getContainer()
          Gets the annotation container.
 int getDelta()
          Returns the delta.
 java.lang.Object getDynamic(java.lang.String link, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Returns the dynamic result of the selection element.
 java.util.Collection<FileAnnotation> getFixedWarnings()
          Returns the fixed warnings of this build.
 java.util.Collection<java.lang.String> getModules()
          Returns the modules of this build result.
 java.util.Collection<FileAnnotation> getNewWarnings()
          Returns the new warnings of this build.
 int getNumberOfAnnotations()
          Gets the number of warnings.
 int getNumberOfAnnotations(Priority priority)
          Returns the total number of warnings of the specified priority for this object.
 int getNumberOfFixedWarnings()
          Gets the number of fixed warnings.
 int getNumberOfModules()
          Returns the number of modules in this project.
 int getNumberOfNewWarnings()
          Gets the number of new warnings.
protected abstract  JavaProject getPreviousResult()
          Returns the results of the previous build.
 Priority[] getPriorities()
          Returns all possible priorities.
 JavaProject getProject()
          Returns the associated project of this result.
 long getZeroWarningsHighScore()
          Returns the maximum period with zero warnings in a build.
 int getZeroWarningsSinceBuild()
          Returns the build since we have zero warnings.
 long getZeroWarningsSinceDate()
          Returns the time since we have zero warnings.
 boolean hasError()
          Returns whether a module with an error is part of this project.
protected abstract  boolean hasPreviousResult()
          Returns whether a previous build result exists.
 
Methods inherited from class hudson.plugins.findbugs.util.BuildResult
getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getDataFile, getNumberOfAnnotations, getOwner, getSerializationFileName, hasAnnotations, hasAnnotations, hasAnnotations, hasNoAnnotations, hasNoAnnotations, hasNoAnnotations, isCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 

Constructor Detail

AnnotationsBuildResult

public AnnotationsBuildResult(hudson.model.AbstractBuild<?,?> build,
                              ParserResult result)
Creates a new instance of AnnotationsBuildResult.

Parameters:
build - the current build as owner of this action
result - the parsed result with all annotations

AnnotationsBuildResult

public AnnotationsBuildResult(hudson.model.AbstractBuild<?,?> build,
                              ParserResult result,
                              AnnotationsBuildResult previous)
Creates a new instance of AnnotationsBuildResult.

Parameters:
build - the current build as owner of this action
result - the parsed result with all annotations
previous - the result of the previous build
Method Detail

getModules

public java.util.Collection<java.lang.String> getModules()
Returns the modules of this build result.

Returns:
the modules

hasError

public boolean hasError()
Returns whether a module with an error is part of this project.

Returns:
true if at least one module has an error.

getNumberOfModules

public int getNumberOfModules()
Returns the number of modules in this project.

Returns:
the number of modules

getZeroWarningsSinceBuild

public int getZeroWarningsSinceBuild()
Returns the build since we have zero warnings.

Returns:
the build since we have zero warnings

getZeroWarningsSinceDate

public long getZeroWarningsSinceDate()
Returns the time since we have zero warnings.

Returns:
the time since we have zero warnings

getZeroWarningsHighScore

public long getZeroWarningsHighScore()
Returns the maximum period with zero warnings in a build.

Returns:
the time since we have zero warnings

getNumberOfAnnotations

public int getNumberOfAnnotations()
Gets the number of warnings.

Returns:
the number of warnings

getNumberOfAnnotations

public int getNumberOfAnnotations(Priority priority)
Returns the total number of warnings of the specified priority for this object.

Parameters:
priority - the priority
Returns:
total number of annotations of the specified priority for this object

getNumberOfFixedWarnings

public int getNumberOfFixedWarnings()
Gets the number of fixed warnings.

Returns:
the number of fixed warnings

getNumberOfNewWarnings

public int getNumberOfNewWarnings()
Gets the number of new warnings.

Returns:
the number of new warnings

getDelta

public int getDelta()
Returns the delta.

Returns:
the delta

getProject

public JavaProject getProject()
Returns the associated project of this result.

Returns:
the associated project of this result.

getNewWarnings

public java.util.Collection<FileAnnotation> getNewWarnings()
Returns the new warnings of this build.

Returns:
the new warnings of this build.

getFixedWarnings

public java.util.Collection<FileAnnotation> getFixedWarnings()
Returns the fixed warnings of this build.

Returns:
the fixed warnings of this build.

hasPreviousResult

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

Returns:
true if a previous build result exists.

getPreviousResult

protected abstract JavaProject getPreviousResult()
Returns the results of the previous build.

Returns:
the result of the previous build, or an empty project if no such build exists

getDynamic

public java.lang.Object getDynamic(java.lang.String link,
                                   org.kohsuke.stapler.StaplerRequest request,
                                   org.kohsuke.stapler.StaplerResponse response)
Returns the dynamic result of the selection element.

Parameters:
link - the link to identify the sub page to show
request - Stapler request
response - Stapler response
Returns:
the dynamic result of the analysis (detail page).

doStatistics

public final void doStatistics(org.kohsuke.stapler.StaplerRequest request,
                               org.kohsuke.stapler.StaplerResponse response)
                        throws java.io.IOException
Generates a PNG image for high/normal/low distribution of the specified object.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error

getPriorities

public Priority[] getPriorities()
Returns all possible priorities.

Returns:
all priorities

getContainer

public AnnotationContainer getContainer()
Gets the annotation container.

Specified by:
getContainer in class BuildResult
Returns:
the container


Copyright © 2008. All Rights Reserved.