hudson.plugins.analysis.core
Class AbstractProjectAction<T extends ResultAction<?>>

java.lang.Object
  extended by hudson.plugins.analysis.core.AbstractProjectAction<T>
Type Parameters:
T - result action type
All Implemented Interfaces:
hudson.model.Action, hudson.model.ModelObject

public abstract class AbstractProjectAction<T extends ResultAction<?>>
extends Object
implements hudson.model.Action

A project action displays a link on the side panel of a project. This action also is responsible to render the historical trend via its associated 'floatingBox.jelly' view.

Author:
Ulli Hafner

Constructor Summary
AbstractProjectAction(hudson.model.AbstractProject<?,?> project, Class<? extends T> resultActionType, org.jvnet.localizer.Localizable name, org.jvnet.localizer.Localizable trendName, String pluginUrl, String iconUrl, String resultUrl)
          Creates a new instance of AbstractProjectAction.
AbstractProjectAction(hudson.model.AbstractProject<?,?> project, Class<? extends T> resultActionType, PluginDescriptor plugin)
          Deprecated. use AbstractProjectAction(AbstractProject, Class, Localizable, Localizable, String, String, String)
 
Method Summary
 boolean canShowEnableTrendLink(org.kohsuke.stapler.StaplerRequest request)
          Returns whether the enable trend graph link should be shown.
protected  BuildHistory createBuildHistory()
          Creates the build history.
protected  GraphConfiguration createConfiguration(List<BuildResultGraph> availableGraphs)
          Creates the graph configuration.
protected  GraphConfigurationView createDefaultConfiguration()
          Creates a view to configure the trend graph defaults.
protected  GraphConfigurationView createUserConfiguration(org.kohsuke.stapler.StaplerRequest request)
          Creates a view to configure the trend graph for the current user.
 void doIndex(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Redirects the index page to the last result.
protected  List<BuildResultGraph> getAvailableGraphs()
          Returns the sorted list of available graphs.
 String getDisplayName()
          
 Object getDynamic(String link, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Returns the graph configuration view for this project.
 String getIconFileName()
          Returns the icon URL for the side-panel in the project screen.
 ResultAction<?> getLastAction()
          Returns the last valid result action.
 hudson.model.AbstractBuild<?,?> getLastFinishedBuild()
          Returns the last finished build.
 hudson.model.AbstractProject<?,?> getProject()
          Returns the project this action belongs to.
protected  T getResultAction(hudson.model.AbstractBuild<?,?> lastBuild)
          Returns the result action for the specified build.
 Object getTrendDetails()
          Returns the trend graph details.
 Object getTrendDetails(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Returns the trend graph details.
 Object getTrendGraph()
          Returns the trend graph.
 hudson.util.Graph getTrendGraph(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Returns the configured trend graph.
 String getTrendName()
          Returns the title of the trend graph.
 String getUrlName()
          
 boolean hasValidResults()
          Returns whether this project has a valid result action attached.
 boolean isTrendDeactivated(org.kohsuke.stapler.StaplerRequest request)
          Returns whether the trend graph is deactivated.
 boolean isTrendVisible(org.kohsuke.stapler.StaplerRequest request)
          Returns whether the trend graph is visible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProjectAction

public AbstractProjectAction(hudson.model.AbstractProject<?,?> project,
                             Class<? extends T> resultActionType,
                             org.jvnet.localizer.Localizable name,
                             org.jvnet.localizer.Localizable trendName,
                             String pluginUrl,
                             String iconUrl,
                             String resultUrl)
Creates a new instance of AbstractProjectAction.

Parameters:
project - the project that owns this action
resultActionType - the type of the result action
name - the human readable name of this action
trendName - the human readable name of the trend graph
pluginUrl - the URL of the associated plug-in
iconUrl - the icon to show
resultUrl - the URL of the associated build results

AbstractProjectAction

@Deprecated
public AbstractProjectAction(hudson.model.AbstractProject<?,?> project,
                                        Class<? extends T> resultActionType,
                                        PluginDescriptor plugin)
Deprecated. use AbstractProjectAction(AbstractProject, Class, Localizable, Localizable, String, String, String)

Creates a new instance of AbstractProjectAction.

Parameters:
project - the project that owns this action
resultActionType - the type of the result action
plugin - the plug-in that owns this action
Method Detail

getDisplayName

public String getDisplayName()

Specified by:
getDisplayName in interface hudson.model.Action
Specified by:
getDisplayName in interface hudson.model.ModelObject

getTrendName

public String getTrendName()
Returns the title of the trend graph.

Returns:
the title of the trend graph.

getProject

public final hudson.model.AbstractProject<?,?> getProject()
Returns the project this action belongs to.

Returns:
the project

getDynamic

public Object getDynamic(String link,
                         org.kohsuke.stapler.StaplerRequest request,
                         org.kohsuke.stapler.StaplerResponse response)
Returns the graph configuration view for this project. If the requested link is neither the user graph configuration nor the default configuration then null is returned.

Parameters:
link - the requested link
request - Stapler request
response - Stapler response
Returns:
the dynamic result of the analysis (detail page).

getTrendDetails

public Object getTrendDetails()
Returns the trend graph details.

Returns:
the details

getTrendDetails

public Object getTrendDetails(org.kohsuke.stapler.StaplerRequest request,
                              org.kohsuke.stapler.StaplerResponse response)
Returns the trend graph details.

Parameters:
request - Stapler request
response - Stapler response
Returns:
the details

getTrendGraph

public Object getTrendGraph()
Returns the trend graph.

Returns:
the current trend graph

getTrendGraph

public hudson.util.Graph getTrendGraph(org.kohsuke.stapler.StaplerRequest request,
                                       org.kohsuke.stapler.StaplerResponse response)
Returns the configured trend graph.

Parameters:
request - Stapler request
response - Stapler response
Returns:
the trend graph

isTrendVisible

public boolean isTrendVisible(org.kohsuke.stapler.StaplerRequest request)
Returns whether the trend graph is visible.

Parameters:
request - the request to get the cookie from
Returns:
true if the trend is visible

isTrendDeactivated

public boolean isTrendDeactivated(org.kohsuke.stapler.StaplerRequest request)
Returns whether the trend graph is deactivated.

Parameters:
request - the request to get the cookie from
Returns:
true if the trend is deactivated

canShowEnableTrendLink

public boolean canShowEnableTrendLink(org.kohsuke.stapler.StaplerRequest request)
Returns whether the enable trend graph link should be shown.

Parameters:
request - the request to get the cookie from
Returns:
the graph configuration

createUserConfiguration

protected GraphConfigurationView createUserConfiguration(org.kohsuke.stapler.StaplerRequest request)
Creates a view to configure the trend graph for the current user.

Parameters:
request - Stapler request
Returns:
a view to configure the trend graph for the current user

createDefaultConfiguration

protected GraphConfigurationView createDefaultConfiguration()
Creates a view to configure the trend graph defaults.

Returns:
a view to configure the trend graph defaults

createBuildHistory

protected BuildHistory createBuildHistory()
Creates the build history.

Returns:
build history

getAvailableGraphs

protected List<BuildResultGraph> getAvailableGraphs()
Returns the sorted list of available graphs.

Returns:
the available graphs

createConfiguration

protected GraphConfiguration createConfiguration(List<BuildResultGraph> availableGraphs)
Creates the graph configuration.

Parameters:
availableGraphs - the available graphs
Returns:
the graph configuration.

getIconFileName

public String getIconFileName()
Returns the icon URL for the side-panel in the project screen. If there is no valid result yet, then null is returned.

Specified by:
getIconFileName in interface hudson.model.Action
Returns:
the icon URL for the side-panel in the project screen

getUrlName

public final String getUrlName()

Specified by:
getUrlName in interface hudson.model.Action

hasValidResults

public final boolean hasValidResults()
Returns whether this project has a valid result action attached.

Returns:
true if the results are valid

getLastAction

@CheckForNull
public ResultAction<?> getLastAction()
Returns the last valid result action.

Returns:
the last valid result action, or null if no such action is found

getResultAction

@CheckForNull
protected T getResultAction(hudson.model.AbstractBuild<?,?> lastBuild)
Returns the result action for the specified build.

Parameters:
lastBuild - the build to get the action for
Returns:
the action or null if there is no such action

getLastFinishedBuild

@CheckForNull
public hudson.model.AbstractBuild<?,?> getLastFinishedBuild()
Returns the last finished build.

Returns:
the last finished build or null if there is no such build

doIndex

public void doIndex(org.kohsuke.stapler.StaplerRequest request,
                    org.kohsuke.stapler.StaplerResponse response)
             throws IOException
Redirects the index page to the last result.

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


Copyright © 2004-2012 Hudson. All Rights Reserved.