hudson.plugins.tasks.util
Class AbstractResultAction<T extends BuildResult>

java.lang.Object
  extended by hudson.plugins.tasks.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, org.kohsuke.stapler.StaplerProxy
Direct Known Subclasses:
TasksResultAction

public abstract class AbstractResultAction<T extends BuildResult>
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

Constructor Summary
AbstractResultAction(hudson.model.AbstractBuild<?,?> owner, AbstractHealthDescriptor healthDescriptor)
          Creates a new instance of AbstractResultAction.
AbstractResultAction(hudson.model.AbstractBuild<?,?> owner, AbstractHealthDescriptor healthDescriptor, T result)
          Creates a new instance of AbstractResultAction.
 
Method Summary
protected  void addModule(ParserResult aggregatedResult, java.util.List<hudson.maven.MavenBuild> builds)
          Adds a new module to the specified project.
protected  ParserResult createAggregatedResult(java.util.Map<hudson.maven.MavenModule,java.util.List<hudson.maven.MavenBuild>> moduleBuilds)
          Aggregates the results of the specified maven module builds.
protected  ParserResult createResult()
          Factory method to create the result of this action.
 hudson.model.AbstractBuild<?,?> getBuild()
          Returns the associated build of this action.
 hudson.model.HealthReport getBuildHealth()
          
protected abstract  PluginDescriptor getDescriptor()
          Returns the descriptor of the associated plug-in.
 AbstractHealthDescriptor getHealthDescriptor()
          Returns the healthDescriptor.
 java.lang.String getIconFileName()
          
protected abstract  java.lang.String getMultipleItemsTooltip(int numberOfItems)
          Returns the tooltip for several items.
 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.
protected abstract  java.lang.String getSingleItemTooltip()
          Returns the tooltip for exactly one item.
 java.lang.Object getTarget()
          
 java.lang.String getTooltip(int numberOfItems)
          Returns the tooltip for the specified number of items.
 ToolTipProvider getToolTipProvider()
          Returns the associated tool tip provider.
 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.
protected  void updateBuildHealth(hudson.maven.MavenBuild build, BuildResult buildResult)
          Updates the build status if the number of annotations exceeds one of the thresholds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.plugins.tasks.util.ResultAction
getPreviousResultAction
 
Methods inherited from interface hudson.model.Action
getDisplayName
 

Constructor Detail

AbstractResultAction

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

Parameters:
owner - the associated build of this action
healthDescriptor - health descriptor
result - the result of the action

AbstractResultAction

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

Parameters:
owner - the associated build of this action
healthDescriptor - health descriptor
Method Detail

getHealthDescriptor

public AbstractHealthDescriptor getHealthDescriptor()
Returns the healthDescriptor.

Specified by:
getHealthDescriptor in interface ResultAction<T extends BuildResult>
Returns:
the healthDescriptor

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

getBuildHealth

public final hudson.model.HealthReport getBuildHealth()

Specified by:
getBuildHealth in interface hudson.model.HealthReportingAction

getToolTipProvider

public ToolTipProvider getToolTipProvider()
Returns the associated tool tip provider.

Specified by:
getToolTipProvider in interface ResultAction<T extends BuildResult>
Returns:
the tool tip provider

getOwner

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

Returns:
the associated build of this action

getBuild

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

Specified by:
getBuild in interface ResultAction<T extends BuildResult>
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 BuildResult>
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 BuildResult>
Parameters:
result - the result to set

getIconFileName

public java.lang.String getIconFileName()

Specified by:
getIconFileName in interface hudson.model.Action

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 BuildResult>
Returns:
true a previous build already has a result action of this type attached

createAggregatedResult

protected ParserResult createAggregatedResult(java.util.Map<hudson.maven.MavenModule,java.util.List<hudson.maven.MavenBuild>> moduleBuilds)
Aggregates the results of the specified maven module builds.

Parameters:
moduleBuilds - the module builds to aggregate
Returns:
the aggregated result

createResult

protected ParserResult createResult()
Factory method to create the result of this action.

Returns:
the result of this action

addModule

protected void addModule(ParserResult aggregatedResult,
                         java.util.List<hudson.maven.MavenBuild> builds)
Adds a new module to the specified project. The new module is obtained from the specified list of builds.

Parameters:
aggregatedResult - the result to add the module to
builds - the builds for a module

updateBuildHealth

protected void updateBuildHealth(hudson.maven.MavenBuild build,
                                 BuildResult buildResult)
Updates the build status if the number of annotations exceeds one of the thresholds.

Parameters:
build - the build to change the status from
buildResult - the build result

getTooltip

public java.lang.String getTooltip(int numberOfItems)
Returns the tooltip for the specified number of items.

Specified by:
getTooltip in interface ToolTipProvider
Parameters:
numberOfItems - the number of items to display the tooltip for
Returns:
the tooltip for the specified items

getMultipleItemsTooltip

protected abstract java.lang.String getMultipleItemsTooltip(int numberOfItems)
Returns the tooltip for several items.

Parameters:
numberOfItems - the number of items to display the tooltip for
Returns:
the tooltip for several items

getSingleItemTooltip

protected abstract java.lang.String getSingleItemTooltip()
Returns the tooltip for exactly one item.

Returns:
the tooltip for exactly one item


Copyright © 2009. All Rights Reserved.