hudson.plugins.pmd
Class PmdResult

java.lang.Object
  extended by hudson.plugins.pmd.PmdResult
All Implemented Interfaces:
hudson.model.ModelObject, java.io.Serializable

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

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

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
PmdResult(hudson.model.AbstractBuild<?,?> build, JavaProject project)
          Creates a new instance of PmdResult.
PmdResult(hudson.model.AbstractBuild<?,?> build, JavaProject project, JavaProject previousProject, long highScore)
          Creates a new instance of PmdResult.
 
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.
 java.util.Collection<FileAnnotation> getAnnotations()
          Returns the annotations of this project.
 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 PMD 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.
 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 we have annotations in this project.
 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

PmdResult

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

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

PmdResult

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

Parameters:
build - the current build as owner of this action
project - the parsed PMD result
previousProject - the parsed PMD 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.

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

hasAnnotations

public final boolean hasAnnotations()
Returns whether we have annotations in this project.

Returns:
true if we have annotations in this project

getAnnotations

public java.util.Collection<FileAnnotation> getAnnotations()
Returns the annotations of this project.

Returns:
the annotations for this project.

getNumberOfAnnotations

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

Parameters:
priority - the priority as a string object
Returns:
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 PMD 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 PMD 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


Copyright © 2008. All Rights Reserved.