hudson.plugins.findbugs.util
Class AbstractResultAction<T extends AnnotationProvider>

java.lang.Object
  extended by hudson.plugins.findbugs.util.AbstractResultAction<T>
Type Parameters:
T - type of the result of this action
All Implemented Interfaces:
hudson.model.Action, hudson.model.HealthReportingAction, hudson.model.ModelObject, ResultAction<T>, ToolTipProvider, java.io.Serializable, org.kohsuke.stapler.StaplerProxy
Direct Known Subclasses:
FindBugsResultAction

public abstract class AbstractResultAction<T extends AnnotationProvider>
extends java.lang.Object
implements org.kohsuke.stapler.StaplerProxy, hudson.model.HealthReportingAction, ToolTipProvider, ResultAction<T>

Controls the live cycle of Hudson results. This action persists the results of a build and displays them on the build page. The actual visualization of the results is defined in the matching summary.jelly file.

Moreover, this class renders the results trend.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
AbstractResultAction(hudson.model.AbstractBuild<?,?> owner, HealthReportBuilder healthReportBuilder)
          Creates a new instance of AbstractResultAction.
AbstractResultAction(hudson.model.AbstractBuild<?,?> owner, HealthReportBuilder healthReportBuilder, T result)
          Creates a new instance of AbstractResultAction.
 
Method Summary
protected  org.jfree.data.category.CategoryDataset buildDataSet(boolean useHealthBuilder)
          Returns the data set that represents the result.
 void doGraph(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, int height)
          Generates a PNG image for the result trend.
 void doGraphMap(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, int height)
          Generates a PNG image for the result trend.
 hudson.model.HealthReport getBuildHealth()
          
protected abstract  PluginDescriptor getDescriptor()
          Returns the descriptor of the associated plug-in.
 HealthReportBuilder getHealthReportBuilder()
          Returns the associated health report builder.
 java.lang.String getIconFileName()
          
 hudson.model.AbstractBuild<?,?> getOwner()
          Returns the associated build of this action.
protected  AbstractResultAction<T> getPreviousBuild()
          Gets the result of a previous build if it's recorded, or null if not.
 T getResult()
          Returns the current result of this action.
 java.lang.Object getTarget()
          
 java.lang.String getUrlName()
          
 boolean hasPreviousResultAction()
          Returns whether a previous build already has a result action of this type attached.
 void setResult(T result)
          Sets the result for this build.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.Action
getDisplayName
 
Methods inherited from interface hudson.plugins.findbugs.util.ToolTipProvider
getMultipleItemsTooltip, getSingleItemTooltip
 
Methods inherited from interface hudson.plugins.findbugs.util.ResultAction
getPreviousResultAction
 
Methods inherited from interface hudson.model.Action
getDisplayName
 

Constructor Detail

AbstractResultAction

public AbstractResultAction(hudson.model.AbstractBuild<?,?> owner,
                            HealthReportBuilder healthReportBuilder,
                            T result)
Creates a new instance of AbstractResultAction.

Parameters:
owner - the associated build of this action
healthReportBuilder - health builder to use
result - the result of the action

AbstractResultAction

public AbstractResultAction(hudson.model.AbstractBuild<?,?> owner,
                            HealthReportBuilder healthReportBuilder)
Creates a new instance of AbstractResultAction.

Parameters:
owner - the associated build of this action
healthReportBuilder - health builder to use
Method Detail

getDescriptor

protected abstract PluginDescriptor getDescriptor()
Returns the descriptor of the associated plug-in.

Returns:
the descriptor of the associated plug-in

getUrlName

public java.lang.String getUrlName()

Specified by:
getUrlName in interface hudson.model.Action

getHealthReportBuilder

public final HealthReportBuilder getHealthReportBuilder()
Returns the associated health report builder.

Specified by:
getHealthReportBuilder in interface ResultAction<T extends AnnotationProvider>
Returns:
the associated health report builder

getBuildHealth

public final hudson.model.HealthReport getBuildHealth()

Specified by:
getBuildHealth in interface hudson.model.HealthReportingAction

getOwner

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

Returns:
the associated build of this action

getTarget

public final java.lang.Object getTarget()

Specified by:
getTarget in interface org.kohsuke.stapler.StaplerProxy

getResult

public final T getResult()
Returns the current result of this action.

Specified by:
getResult in interface ResultAction<T extends AnnotationProvider>
Returns:
the current result

setResult

public final void setResult(T result)
Sets the result for this build.

Specified by:
setResult in interface ResultAction<T extends AnnotationProvider>
Parameters:
result - the result to set

getIconFileName

public java.lang.String getIconFileName()

Specified by:
getIconFileName in interface hudson.model.Action

doGraph

public final void doGraph(org.kohsuke.stapler.StaplerRequest request,
                          org.kohsuke.stapler.StaplerResponse response,
                          int height)
                   throws java.io.IOException
Generates a PNG image for the result trend.

Specified by:
doGraph in interface ResultAction<T extends AnnotationProvider>
Parameters:
request - Stapler request
response - Stapler response
height - the height of the trend graph
Throws:
java.io.IOException - in case of an error

doGraphMap

public final void doGraphMap(org.kohsuke.stapler.StaplerRequest request,
                             org.kohsuke.stapler.StaplerResponse response,
                             int height)
                      throws java.io.IOException
Generates a PNG image for the result trend.

Specified by:
doGraphMap in interface ResultAction<T extends AnnotationProvider>
Parameters:
request - Stapler request
response - Stapler response
height - the height of the trend graph
Throws:
java.io.IOException - in case of an error

buildDataSet

protected org.jfree.data.category.CategoryDataset buildDataSet(boolean useHealthBuilder)
Returns the data set that represents the result. For each build, the number of warnings is used as result value.

Parameters:
useHealthBuilder - determines whether the health builder should be used to create the data set
Returns:
the data set

getPreviousBuild

protected AbstractResultAction<T> getPreviousBuild()
Gets the result of a previous build if it's recorded, or null if not.

Returns:
the result of a previous build, or null

hasPreviousResultAction

public boolean hasPreviousResultAction()
Returns whether a previous build already has a result action of this type attached.

Specified by:
hasPreviousResultAction in interface ResultAction<T extends AnnotationProvider>
Returns:
true a previous build already has a result action of this type attached


Copyright © 2008. All Rights Reserved.