Class CauseManagement

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

@Extension public class CauseManagement extends Object implements RootAction
Page for managing the failure causes.
Author:
Robert Sandell <robert.sandell@sonyericsson.com>
  • Field Details

  • Constructor Details

    • CauseManagement

      public CauseManagement()
  • Method Details

    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • 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:
    • 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.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

      public String getErrorMessage(org.kohsuke.stapler.StaplerRequest2 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.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 request
      response - 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 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 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.
      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 ExtensionList<Indication.IndicationDescriptor> getIndicationDescriptors()
      Provides a list of all IndicationDescriptors. For Jelly convenience.
      Returns:
      a list of descriptors.
      See Also:
    • getPermission

      public Permission getPermission()
      The permission related to this action. For Jelly convenience.
      Returns:
      the permission.
      See Also:
    • getRemovePermission

      public Permission 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 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.