Class CauseManagement

    • Constructor Detail

      • CauseManagement

        public CauseManagement()
    • Method Detail

      • 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

        @POST
        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 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.
      • 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.