hudson.plugins.findbugs
Class FindBugsResult

java.lang.Object
  extended by hudson.plugins.findbugs.FindBugsResult
All Implemented Interfaces:
hudson.model.ModelObject, AnnotationProvider, java.io.Serializable

public class FindBugsResult
extends java.lang.Object
implements hudson.model.ModelObject, java.io.Serializable, AnnotationProvider

Represents the results of the FindBugs analysis. One instance of this class is persisted for each build via an XML file.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
FindBugsResult(hudson.model.AbstractBuild<?,?> build, JavaProject project)
          Creates a new instance of FindBugsResult.
FindBugsResult(hudson.model.AbstractBuild<?,?> build, JavaProject project, JavaProject previousProject, long highScore)
          Creates a new instance of FindBugsResult.
 
Method Summary
 void doModuleStatistics(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates a PNG image for high/normal/low distribution of a maven module.
 void doPackageStatistics(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates a PNG image for high/normal/low distribution of a Java package.
 FileAnnotation getAnnotation(long key)
          Returns the annotation with the specified key.
 FileAnnotation getAnnotation(java.lang.String key)
          Returns the annotation with the specified key.
 java.util.Collection<FileAnnotation> getAnnotations()
          Returns the annotations for this object.
 java.util.Collection<FileAnnotation> getAnnotations(Priority priority)
          Returns the annotations of the specified priority for this object.
 java.util.Collection<FileAnnotation> getAnnotations(java.lang.String priority)
          Returns the annotations of the specified priority for this object.
 int getDelta()
          Returns the delta.
 java.lang.String getDetails()
          Returns the detail messages for the summary.jelly file.
 java.lang.String getDisplayName()
          
 java.lang.Object getDynamic(java.lang.String link, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Returns the dynamic result of the FindBugs analysis (a detail page for a module, package or warnings file or a detail object for new or fixed warnings).
 java.util.Set<FileAnnotation> getFixedWarnings()
          Returns the fixed warnings of this build.
 java.util.Collection<MavenModule> getModules()
          Returns the modules of this project.
 java.util.Set<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 getNumberOfAnnotations(java.lang.String priority)
          Returns the annotations 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.
 hudson.model.AbstractBuild<?,?> getOwner()
          Returns the build as owner of this action.
 java.util.Collection<JavaPackage> getPackages()
          Returns the packages of this project.
 int getPreviousNumberOfWarnings(java.lang.String packageName)
          Returns the number of warnings of the specified package in the previous build.
 JavaProject getPreviousResult()
          Returns the results of the previous build.
 Priority[] getPriorities()
          Returns all possible priorities.
 JavaProject getProject()
          Returns the associated project of this result.
 java.lang.String getSummary()
          Returns a summary message for the summary.jelly file.
 java.lang.String getToolTip(java.lang.String name)
          Returns a tooltip showing the distribution of priorities for the selected package.
 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 hasAnnotations()
          Returns whether this objects has annotations.
 boolean hasAnnotations(Priority priority)
          Returns whether this objects has annotations with the specified priority.
 boolean hasAnnotations(java.lang.String priority)
          Returns whether this objects has annotations with the specified priority.
 boolean hasError()
          Returns whether a module with an error is part of this project.
 boolean hasPreviousResult()
          Returns whether a previous build result exists.
 boolean isCurrent()
          Returns whether this result belongs to the last build.
 boolean isSingleModuleProject()
          Returns whether this project contains just one maven module.
 boolean isSinglePackageProject()
          Returns whether we only have a single package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindBugsResult

public FindBugsResult(hudson.model.AbstractBuild<?,?> build,
                      JavaProject project)
Creates a new instance of FindBugsResult.

Parameters:
build - the current build as owner of this action
project - the parsed FindBugs result

FindBugsResult

public FindBugsResult(hudson.model.AbstractBuild<?,?> build,
                      JavaProject project,
                      JavaProject previousProject,
                      long highScore)
Creates a new instance of FindBugsResult.

Parameters:
build - the current build as owner of this action
project - the parsed FindBugs result
previousProject - the parsed FindBugs result of the previous build
highScore - the maximum period with zero warnings in a build
Method Detail

getSummary

public java.lang.String getSummary()
Returns a summary message for the summary.jelly file.

Returns:
the summary message

getDetails

public java.lang.String getDetails()
Returns the detail messages for the summary.jelly file.

Returns:
the summary message

isCurrent

public final boolean isCurrent()
Returns whether this result belongs to the last build.

Returns:
true if this result belongs to the last build

getOwner

public final hudson.model.AbstractBuild<?,?> getOwner()
Returns the build as owner of this action.

Returns:
the owner

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

getDisplayName

public java.lang.String getDisplayName()

Specified by:
getDisplayName in interface hudson.model.ModelObject

getNumberOfAnnotations

public int getNumberOfAnnotations()
Gets the number of warnings.

Specified by:
getNumberOfAnnotations in interface AnnotationProvider
Returns:
the number of warnings

getNumberOfAnnotations

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

Specified by:
getNumberOfAnnotations in interface AnnotationProvider
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.Set<FileAnnotation> getNewWarnings()
Returns the new warnings of this build.

Returns:
the new warnings of this build.

getFixedWarnings

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

Returns:
the fixed warnings of this build.

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 FindBugs analysis (a detail page for a module, package or warnings file or a detail object for new or fixed warnings).

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

getPackages

public java.util.Collection<JavaPackage> getPackages()
Returns the packages of this project.

Returns:
the packages of this project

getModules

public java.util.Collection<MavenModule> getModules()
Returns the modules of this project.

Returns:
the modules of this project

isSingleModuleProject

public boolean isSingleModuleProject()
Returns whether this project contains just one maven module. In this case we show package statistics instead of module statistics.

Returns:
true if this project contains just one maven module

isSinglePackageProject

public boolean isSinglePackageProject()
Returns whether we only have a single package. In this case the module and package statistics are suppressed and only the tasks are shown.

Returns:
true for single module projects

getPreviousNumberOfWarnings

public int getPreviousNumberOfWarnings(java.lang.String packageName)
Returns the number of warnings of the specified package in the previous build.

Parameters:
packageName - the package to return the warnings for
Returns:
number of warnings of the specified package.

getPreviousResult

public JavaProject getPreviousResult()
Returns the results of the previous build.

Returns:
the result of the previous build, or null if no such build exists

hasPreviousResult

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

Returns:
true if a previous build result exists.

doModuleStatistics

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

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

doPackageStatistics

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

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

getToolTip

public java.lang.String getToolTip(java.lang.String name)
Returns a tooltip showing the distribution of priorities for the selected package.

Parameters:
name - the package to show the distribution for
Returns:
a tooltip showing the distribution of priorities

getPriorities

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

Returns:
all priorities

getAnnotation

public FileAnnotation getAnnotation(long key)
Returns the annotation with the specified key.

Specified by:
getAnnotation in interface AnnotationProvider
Parameters:
key - the key of the annotation
Returns:
the annotation with the specified key

getAnnotation

public FileAnnotation getAnnotation(java.lang.String key)
Returns the annotation with the specified key.

Specified by:
getAnnotation in interface AnnotationProvider
Parameters:
key - the key of the annotation as a long value in string representation
Returns:
the annotation with the specified key

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations(Priority priority)
Returns the annotations of the specified priority for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Parameters:
priority - the priority
Returns:
annotations of the specified priority for this object

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations(java.lang.String priority)
Returns the annotations of the specified priority for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
annotations of the specified priority for this object

hasAnnotations

public boolean hasAnnotations(Priority priority)
Returns whether this objects has annotations with the specified priority.

Specified by:
hasAnnotations in interface AnnotationProvider
Parameters:
priority - the priority
Returns:
true if this objects has annotations.

hasAnnotations

public boolean hasAnnotations(java.lang.String priority)
Returns whether this objects has annotations with the specified priority.

Specified by:
hasAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
true if this objects has annotations.

hasAnnotations

public final boolean hasAnnotations()
Returns whether this objects has annotations.

Specified by:
hasAnnotations in interface AnnotationProvider
Returns:
true if this objects has annotations.

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations()
Returns the annotations for this object.

Specified by:
getAnnotations in interface AnnotationProvider
Returns:
annotations for this object

getNumberOfAnnotations

public int getNumberOfAnnotations(java.lang.String priority)
Returns the annotations of the specified priority for this object.

Specified by:
getNumberOfAnnotations in interface AnnotationProvider
Parameters:
priority - the priority as a string object
Returns:
annotations of the specified priority for this object


Copyright © 2008. All Rights Reserved.