hudson.plugins.pmd.util
Class AbstractProjectAction<T extends ResultAction<?>>

java.lang.Object
  extended by hudson.plugins.pmd.util.AbstractProjectAction<T>
Type Parameters:
T - result action type
All Implemented Interfaces:
hudson.model.Action, hudson.model.ModelObject, java.io.Serializable
Direct Known Subclasses:
PmdProjectAction

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

A project action displays a link on the side panel of a project.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
AbstractProjectAction(hudson.model.AbstractProject<?,?> project, java.lang.Class<T> resultActionType, java.lang.String iconUrl, java.lang.String resultsUrl)
          Creates a new instance of AbstractProjectAction.
 
Method Summary
 void doFlipTrend(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Changes the trend graph display mode.
 void doIndex(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Redirects the index page to the last result.
 void doTrend(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Display the trend graph.
 void doTrendMap(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Display the trend map.
protected abstract  java.lang.String getCookieName()
          Returns the flip trend cookie name.
 java.lang.String getIconFileName()
          Returns the icon URL for the side-panel in the project screen.
 ResultAction<?> getLastAction()
          Returns the last valid result action.
 hudson.model.AbstractProject<?,?> getProject()
          Returns the project.
 boolean hasValidResults(hudson.model.AbstractBuild<?,?> build)
          Returns whether we have enough valid results in order to draw a meaningful graph.
 boolean isHealthinessEnabled()
          Returns whether we should display the toggle graph type links.
 
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, getUrlName
 

Constructor Detail

AbstractProjectAction

public AbstractProjectAction(hudson.model.AbstractProject<?,?> project,
                             java.lang.Class<T> resultActionType,
                             java.lang.String iconUrl,
                             java.lang.String resultsUrl)
Creates a new instance of AbstractProjectAction.

Parameters:
project - the project that owns this action
resultActionType - the type of the result action
iconUrl - the icon URL of this action: it will be shown as soon as a result is available.
resultsUrl - URL to the results of the last build.
Method Detail

isHealthinessEnabled

public final boolean isHealthinessEnabled()
Returns whether we should display the toggle graph type links.

Returns:
true if we should display the toggle graph type links

getProject

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

Returns:
the project

hasValidResults

public final boolean hasValidResults(hudson.model.AbstractBuild<?,?> build)
Returns whether we have enough valid results in order to draw a meaningful graph.

Parameters:
build - the build to look backward from
Returns:
true if the results are valid in order to draw a graph

getIconFileName

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

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

getLastAction

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

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

doTrend

public void doTrend(org.kohsuke.stapler.StaplerRequest request,
                    org.kohsuke.stapler.StaplerResponse response)
             throws java.io.IOException
Display the trend graph. Delegates to the the associated ResultAction.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error in ResultAction.doGraph(StaplerRequest, StaplerResponse)

doTrendMap

public void doTrendMap(org.kohsuke.stapler.StaplerRequest request,
                       org.kohsuke.stapler.StaplerResponse response)
                throws java.io.IOException
Display the trend map. Delegates to the the associated ResultAction.

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

doIndex

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

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

doFlipTrend

public void doFlipTrend(org.kohsuke.stapler.StaplerRequest request,
                        org.kohsuke.stapler.StaplerResponse response)
                 throws java.io.IOException
Changes the trend graph display mode.

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

getCookieName

protected abstract java.lang.String getCookieName()
Returns the flip trend cookie name.

Returns:
the flip trend cookie name.


Copyright © 2008. All Rights Reserved.