com.sonyericsson.jenkins.plugins.bfa
Class CauseManagement

java.lang.Object
  extended by com.sonyericsson.jenkins.plugins.bfa.BfaGraphAction
      extended by com.sonyericsson.jenkins.plugins.bfa.CauseManagement
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Action, hudson.model.ModelObject, hudson.model.RootAction
Direct Known Subclasses:
TransientCauseManagement

@Extension
public class CauseManagement
extends BfaGraphAction

Page for managing the failure causes.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static String GRAPH_PAGE_TITLE
          Title for the page displaying the graphs.
static String NEW_CAUSE_DESCRIPTION
          The pre-filled description that a new cause gets.
static String NEW_CAUSE_DYNAMIC_ID
          The reserved id for getting a new FailureCause from getDynamic(String, org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse).
static String NEW_CAUSE_NAME
          The pre-filled name that a new cause gets.
static String REQUEST_CAUSE_MANAGEMENT_ERROR
          The request attribute key where error messages are added.
static String SESSION_REMOVED_FAILURE_CAUSE
          Session key for the last removed FailureCause by the user.
static String URL_NAME
          Where in the Jenkins name space this action will be.
 
Fields inherited from class com.sonyericsson.jenkins.plugins.bfa.BfaGraphAction
DEFAULT_GRAPH_HEIGHT, DEFAULT_GRAPH_WIDTH, EXCLUDE_ABORTED, ID_SEPARATOR, URL_PARAM_ALL_MASTERS, URL_PARAM_SHOW_ABORTED, URL_PARAM_TIME_PERIOD, URL_PARAM_VALUE_MAX, URL_PARAM_VALUE_MONTH, URL_PARAM_VALUE_TODAY, URL_PARAM_WHICH_GRAPH
 
Constructor Summary
CauseManagement()
           
 
Method Summary
 void doRemoveConfirm(String id, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Web call to remove a FailureCause.
 String getDisplayName()
           
 FailureCause getDynamic(String id, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Dynamic Stapler URL binding.
 String getErrorMessage(org.kohsuke.stapler.StaplerRequest request)
          Used for getting the error message to show on the page.
protected  hudson.util.Graph getGraph(GraphType which, Date timePeriod, boolean hideManAborted, boolean forAllMasters, Map<String,String> rawReqParams)
          Get the graph corresponding to the specified arguments.
protected  String getGraphCacheId(GraphType whichGraph, String reqTimePeriod, boolean hideAborted, boolean forAllMasters)
          Get a unique id used in the caching of the graph.
 String getGraphsPageTitle()
          Get the title to display in the top of the detailed graphs page.
 GraphType[] getGraphTypes()
          Returns an array of GraphTypes, where each element represents a graph.
 String getIconFileName()
           
 String getImageUrl(String size, String name)
          Convenience method for calling PluginImpl.getImageUrl(String, String) from jelly.
 hudson.ExtensionList<Indication.IndicationDescriptor> getIndicationDescriptors()
          Provides a list of all IndicationDescriptors.
static CauseManagement getInstance()
          Provides the singleton instance of this class that Jenkins has loaded.
 hudson.model.ModelObject getOwner()
          The "owner" of this Action.
protected  String getOwnerUrl()
          Where to redirect after the form has been saved, probably to the owner.
 hudson.security.Permission getPermission()
          The permission related to this action.
 hudson.security.Permission getRemovePermission()
          The permission related to this action.
 Iterable<FailureCause> getShallowCauses()
          Convenience method for KnowledgeBase.getShallowCauses().
 String getUrlName()
           
 boolean isError(org.kohsuke.stapler.StaplerRequest request)
          Convenience method for jelly.
 boolean isUnderTest()
          Checks if Jenkins is run from inside a HudsonTestCase.
 boolean showGraphDelayText()
          Helper for the groovy-views; show/hide info text for graph delay.
 boolean showMasterSwitch()
          Helper for the groovy-views; show/hide Masters-switch.
 
Methods inherited from class com.sonyericsson.jenkins.plugins.bfa.BfaGraphAction
getDefaultGraphHeight, getDefaultGraphWidth, getGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_NAME

public static final String URL_NAME
Where in the Jenkins name space this action will be.

See Also:
getUrlName(), Constant Field Values

NEW_CAUSE_DYNAMIC_ID

public static final String NEW_CAUSE_DYNAMIC_ID
The reserved id for getting a new FailureCause from getDynamic(String, org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse).

See Also:
Constant Field Values

NEW_CAUSE_NAME

public static final String NEW_CAUSE_NAME
The pre-filled name that a new cause gets.

See Also:
Constant Field Values

NEW_CAUSE_DESCRIPTION

public static final String NEW_CAUSE_DESCRIPTION
The pre-filled description that a new cause gets.

See Also:
Constant Field Values

REQUEST_CAUSE_MANAGEMENT_ERROR

public static final String REQUEST_CAUSE_MANAGEMENT_ERROR
The request attribute key where error messages are added.

See Also:
Constant Field Values

SESSION_REMOVED_FAILURE_CAUSE

public static final String SESSION_REMOVED_FAILURE_CAUSE
Session key for the last removed FailureCause by the user. Will be removed by the index page when it displays it.

See Also:
Constant Field Values

GRAPH_PAGE_TITLE

public static final String GRAPH_PAGE_TITLE
Title for the page displaying the graphs.

See Also:
Constant Field Values
Constructor Detail

CauseManagement

public CauseManagement()
Method Detail

getIconFileName

public String getIconFileName()

getDisplayName

public String getDisplayName()

getUrlName

public String getUrlName()

getImageUrl

public String getImageUrl(String size,
                          String name)
Convenience method for calling PluginImpl.getImageUrl(String, String) from jelly.

Parameters:
size - the size
name - the name
Returns:
the url.
See Also:
PluginImpl.getImageUrl(String, String)

getShallowCauses

public Iterable<FailureCause> getShallowCauses()
                                        throws Exception
Convenience method for KnowledgeBase.getShallowCauses().

Returns:
the collection of causes.
Throws:
Exception - if communication fails.

isError

public boolean isError(org.kohsuke.stapler.StaplerRequest request)
Convenience method for jelly.

Parameters:
request - the request where the message might be.
Returns:
true if there is an error message to display.

getErrorMessage

public String getErrorMessage(org.kohsuke.stapler.StaplerRequest request)
Used for getting the error message to show on the page.

Parameters:
request - the request where the message might be.
Returns:
the error message to show.

getDynamic

public FailureCause getDynamic(String id,
                               org.kohsuke.stapler.StaplerRequest request,
                               org.kohsuke.stapler.StaplerResponse response)
                        throws Exception
Dynamic Stapler URL binding. Provides the ability to navigate to a cause via for example: /jenkins/failure-cause-management/abf123

Parameters:
id - the id of the cause of "new" to create a new cause.
request - the request
response - the response
Returns:
the cause if found or null.
Throws:
Exception - if communication with the knowledge base failed.

doRemoveConfirm

public void doRemoveConfirm(@QueryParameter
                            String id,
                            org.kohsuke.stapler.StaplerRequest request,
                            org.kohsuke.stapler.StaplerResponse response)
                     throws IOException
Web call to remove a FailureCause. Does a permission check for PluginImpl.REMOVE_PERMISSION.

Parameters:
id - the id of the cause to remove.
request - the stapler request.
response - the stapler response.
Throws:
IOException - if so during redirect.

getOwner

public hudson.model.ModelObject getOwner()
The "owner" of this Action. Default this would be Hudson.getInstance() but if the class is included in some build or something we might want to be able to easier change the side panel for example.

Specified by:
getOwner in class BfaGraphAction
Returns:
the holder of the beer.

getOwnerUrl

protected String getOwnerUrl()
Where to redirect after the form has been saved, probably to the owner.

Returns:
the owner's URL or some place else to redirect the user after save.

getIndicationDescriptors

public hudson.ExtensionList<Indication.IndicationDescriptor> getIndicationDescriptors()
Provides a list of all IndicationDescriptors. For Jelly convenience.

Returns:
a list of descriptors.
See Also:
Indication.IndicationDescriptor.getAll()

getPermission

public hudson.security.Permission getPermission()
The permission related to this action. For Jelly convenience.

Returns:
the permission.
See Also:
PluginImpl.UPDATE_PERMISSION

getRemovePermission

public hudson.security.Permission getRemovePermission()
The permission related to this action. For Jelly convenience.

Returns:
the permission.
See Also:
PluginImpl.UPDATE_PERMISSION

isUnderTest

public boolean isUnderTest()
Checks if Jenkins is run from inside a HudsonTestCase. For some reason the buildQueue fails to render when run under test but works fine when run with hpi:run. So the jelly file skips the inclusion of the sidepanel if we are running under test to work around this problem. The check is done via looking at the class name of Jenkins.getPluginManager().

Returns:
true if we are running under test.

getInstance

public static CauseManagement getInstance()
Provides the singleton instance of this class that Jenkins has loaded. Throws an IllegalStateException if for some reason the action can't be found.

Returns:
the instance.

getGraphTypes

public GraphType[] getGraphTypes()
Description copied from class: BfaGraphAction
Returns an array of GraphTypes, where each element represents a graph. These are the types used to display the graphs/images on the detailed graphs page, that is, they will be the 'which'-parameter to getGraph(GraphType which, Date ...). The graphs are displayed in the same order as the numbers in the array.

Specified by:
getGraphTypes in class BfaGraphAction
Returns:
An array of GraphTypes where each element represents a graph to display

getGraphsPageTitle

public String getGraphsPageTitle()
Description copied from class: BfaGraphAction
Get the title to display in the top of the detailed graphs page.

Specified by:
getGraphsPageTitle in class BfaGraphAction
Returns:
The title as a String

showMasterSwitch

public boolean showMasterSwitch()
Description copied from class: BfaGraphAction
Helper for the groovy-views; show/hide Masters-switch. Whether to show links for switching between all masters and the own master.

Overrides:
showMasterSwitch in class BfaGraphAction
Returns:
True to show the switch, otherwise false

showGraphDelayText

public boolean showGraphDelayText()
Description copied from class: BfaGraphAction
Helper for the groovy-views; show/hide info text for graph delay. The info text will inform the user about the delay for graphs because of caching.

Overrides:
showGraphDelayText in class BfaGraphAction
Returns:
True to show the text, otherwise false

getGraph

protected hudson.util.Graph getGraph(GraphType which,
                                     Date timePeriod,
                                     boolean hideManAborted,
                                     boolean forAllMasters,
                                     Map<String,String> rawReqParams)
Description copied from class: BfaGraphAction
Get the graph corresponding to the specified arguments.

Specified by:
getGraph in class BfaGraphAction
Parameters:
which - Which graph to display
timePeriod - How old statistics should be included in the graph
hideManAborted - Hide manually aborted causes
forAllMasters - Show for all masters
rawReqParams - The url parameters that came with the request
Returns:
A Graph

getGraphCacheId

protected String getGraphCacheId(GraphType whichGraph,
                                 String reqTimePeriod,
                                 boolean hideAborted,
                                 boolean forAllMasters)
Description copied from class: BfaGraphAction
Get a unique id used in the caching of the graph.

Specified by:
getGraphCacheId in class BfaGraphAction
Parameters:
whichGraph - Which graph
reqTimePeriod - The selected time period
hideAborted - Hide aborted builds
forAllMasters - For all masters
Returns:
An id corresponding to the specified arguments


Copyright © 2004-2014. All Rights Reserved.