hudson.plugins.analysis.dashboard
Class AbstractWarningsTablePortlet

java.lang.Object
  extended by hudson.plugins.view.dashboard.DashboardPortlet
      extended by hudson.plugins.analysis.dashboard.AbstractPortlet
          extended by hudson.plugins.analysis.dashboard.AbstractWarningsTablePortlet
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.plugins.view.dashboard.DashboardPortlet>, hudson.model.ModelObject

public abstract class AbstractWarningsTablePortlet
extends AbstractPortlet

A portlet that shows a table with the number of warnings in the selected jobs.

Author:
Ulli Hafner

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
AbstractWarningsTablePortlet(String name)
          Creates a new instance of AbstractWarningsTablePortlet.
AbstractWarningsTablePortlet(String name, boolean canHideZeroWarningsProjects)
          Creates a new instance of AbstractWarningsTablePortlet.
 
Method Summary
protected  Collection<hudson.model.Job<?,?>> filter(Collection<hudson.model.Job<?,?>> jobs)
          Filters the specified collection of jobs using overridable method isVisibleJob(Job).
 Collection<hudson.model.Job<?,?>> filterZeroWarningsJobs(Collection<hudson.model.Job<?,?>> jobs)
          Returns all jobs that have warnings.
 boolean getCanHideZeroWarningsProjects()
          Returns whether zero warnings projects should be hidden in the table.
protected  String getPluginName()
          Deprecated. is not used anymore, the URL is resolved from the actions
 String getWarnings(Collection<hudson.model.Job<?,?>> jobs)
          Returns the number of compiler warnings for the specified jobs.
 String getWarnings(Collection<hudson.model.Job<?,?>> jobs, String priority)
          Returns the number of compiler warnings for the specified jobs.
 String getWarnings(hudson.model.Job<?,?> job)
          Returns the total number of warnings for the specified job.
 String getWarnings(hudson.model.Job<?,?> job, String priority)
          Returns the total number of warnings for the specified job.
protected  boolean isVisibleJob(hudson.model.Job<?,?> job)
          Returns whether the specified job is visible.
protected  AbstractProjectAction<?> selectAction(hudson.model.Job<?,?> job)
          Selects the action to show the results from.
protected  int toInt(String value)
          Converts the string to an integer.
 
Methods inherited from class hudson.plugins.analysis.dashboard.AbstractPortlet
getAction
 
Methods inherited from class hudson.plugins.view.dashboard.DashboardPortlet
all, getComparator, getDashboard, getDescriptor, getDisplayName, getId, getJob, getName, getUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWarningsTablePortlet

public AbstractWarningsTablePortlet(String name)
Creates a new instance of AbstractWarningsTablePortlet.

Parameters:
name - the name of the portlet

AbstractWarningsTablePortlet

public AbstractWarningsTablePortlet(String name,
                                    boolean canHideZeroWarningsProjects)
Creates a new instance of AbstractWarningsTablePortlet.

Parameters:
name - the name of the portlet
canHideZeroWarningsProjects - determines if zero warnings projects should be hidden in the table
Method Detail

getCanHideZeroWarningsProjects

public boolean getCanHideZeroWarningsProjects()
Returns whether zero warnings projects should be hidden in the table.

Returns:
true then only projects that contain warnings are shown, false all projects are shown

filterZeroWarningsJobs

public Collection<hudson.model.Job<?,?>> filterZeroWarningsJobs(Collection<hudson.model.Job<?,?>> jobs)
Returns all jobs that have warnings.

Parameters:
jobs - all jobs
Returns:
the jobs with warnings

filter

protected Collection<hudson.model.Job<?,?>> filter(Collection<hudson.model.Job<?,?>> jobs)
Filters the specified collection of jobs using overridable method isVisibleJob(Job).

Parameters:
jobs - the jobs to filter
Returns:
the filtered jobs
See Also:
filter predicate

isVisibleJob

protected boolean isVisibleJob(hudson.model.Job<?,?> job)
Returns whether the specified job is visible. This default implementation returns true if there is at least one warning for the job.

Parameters:
job - the job to check
Returns:
true if the job is visible, false otherwise

getPluginName

@Deprecated
protected String getPluginName()
Deprecated. is not used anymore, the URL is resolved from the actions

Returns the name of the plug-in this portlet belongs to.

Returns:
the plug-in name

getWarnings

public String getWarnings(Collection<hudson.model.Job<?,?>> jobs)
Returns the number of compiler warnings for the specified jobs.

Parameters:
jobs - the jobs to get the warnings for
Returns:
the number of compiler warnings

getWarnings

public String getWarnings(Collection<hudson.model.Job<?,?>> jobs,
                          String priority)
Returns the number of compiler warnings for the specified jobs.

Parameters:
jobs - the jobs to get the warnings for
priority - the priority
Returns:
the number of compiler warnings

toInt

protected int toInt(String value)
Converts the string to an integer. If the string is not valid then 0 is returned.

Parameters:
value - the value to convert
Returns:
the integer value or 0

getWarnings

public String getWarnings(hudson.model.Job<?,?> job)
Returns the total number of warnings for the specified job.

Parameters:
job - the job to get the warnings for
Returns:
the number of compiler warnings

getWarnings

public String getWarnings(hudson.model.Job<?,?> job,
                          String priority)
Returns the total number of warnings for the specified job.

Parameters:
job - the job to get the warnings for
priority - the priority
Returns:
the number of compiler warnings

selectAction

@CheckForNull
protected AbstractProjectAction<?> selectAction(hudson.model.Job<?,?> job)
Selects the action to show the results from. This default implementation simply returns the first action that matches the given type.

Parameters:
job - the job to get the action from
Returns:
the action


Copyright © 2004-2012 Hudson. All Rights Reserved.