Class CauseManagement
java.lang.Object
com.sonyericsson.jenkins.plugins.bfa.CauseManagement
- All Implemented Interfaces:
ExtensionPoint
,Action
,ModelObject
,RootAction
- Direct Known Subclasses:
TransientCauseManagement
Page for managing the failure causes.
- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Title for the page displaying the graphs.static final String
The pre-filled description that a new cause gets.static final String
The reserved id for getting a newFailureCause
fromgetDynamic(String, org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)
.static final String
The pre-filled name that a new cause gets.static final String
The request attribute key where error messages are added.static final String
Session key for the last removedFailureCause
by the user.static final String
Where in the Jenkins name space this action will be. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doRemoveConfirm
(String id, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Web call to remove aFailureCause
.getDynamic
(String id, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Dynamic Stapler URL binding.getErrorMessage
(org.kohsuke.stapler.StaplerRequest2 request) Used for getting the error message to show on the page.getImageUrl
(String size, String name) Convenience method for callingPluginImpl.getImageUrl(String, String)
from jelly.Provides a list of all IndicationDescriptors.static CauseManagement
Provides the singleton instance of this class that Jenkins has loaded.getOwner()
The "owner" of this Action.protected String
Where to redirect after the form has been saved, probably to the owner.The permission related to this action.The permission related to this action.Convenience method forKnowledgeBase.getShallowCauses()
.boolean
isError
(org.kohsuke.stapler.StaplerRequest2 request) Convenience method for jelly.boolean
Checks if Jenkins is run from inside a HudsonTestCase.
-
Field Details
-
URL_NAME
Where in the Jenkins name space this action will be.- See Also:
-
NEW_CAUSE_DYNAMIC_ID
The reserved id for getting a newFailureCause
fromgetDynamic(String, org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)
.- See Also:
-
NEW_CAUSE_NAME
The pre-filled name that a new cause gets.- See Also:
-
NEW_CAUSE_DESCRIPTION
The pre-filled description that a new cause gets.- See Also:
-
REQUEST_CAUSE_MANAGEMENT_ERROR
The request attribute key where error messages are added.- See Also:
-
SESSION_REMOVED_FAILURE_CAUSE
Session key for the last removedFailureCause
by the user. Will be removed by the index page when it displays it.- See Also:
-
GRAPH_PAGE_TITLE
Title for the page displaying the graphs.- See Also:
-
-
Constructor Details
-
CauseManagement
public CauseManagement()
-
-
Method Details
-
getIconFileName
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
-
getImageUrl
Convenience method for callingPluginImpl.getImageUrl(String, String)
from jelly.- Parameters:
size
- the sizename
- the name- Returns:
- the url.
- See Also:
-
getShallowCauses
Convenience method forKnowledgeBase.getShallowCauses()
.- Returns:
- the collection of causes.
- Throws:
Exception
- if communication fails.
-
isError
public boolean isError(org.kohsuke.stapler.StaplerRequest2 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
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.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 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 requestresponse
- the response- Returns:
- the cause if found or null.
- Throws:
Exception
- if communication with the knowledge base failed.
-
doRemoveConfirm
@POST public void doRemoveConfirm(@QueryParameter String id, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws IOException Web call to remove aFailureCause
. Does a permission check forPluginImpl.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
The "owner" of this Action. Default this would beHudson.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.- Returns:
- the holder of the beer.
-
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
Provides a list of all IndicationDescriptors. For Jelly convenience.- Returns:
- a list of descriptors.
- See Also:
-
getPermission
The permission related to this action. For Jelly convenience.- Returns:
- the permission.
- See Also:
-
getRemovePermission
The permission related to this action. For Jelly convenience.- Returns:
- the permission.
- See Also:
-
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 ofJenkins.getPluginManager()
.- Returns:
- true if we are running under test.
-
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.
-