Class MaintenanceAction

  • All Implemented Interfaces:
    Action, ModelObject

    public class MaintenanceAction
    extends Object
    implements Action
    Action to display link to maintenance window configuration.
    • Field Detail

      • CONFIGURE_AND_DISCONNECT

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static final Permission[] CONFIGURE_AND_DISCONNECT
    • Constructor Detail

      • MaintenanceAction

        public MaintenanceAction​(SlaveComputer computer)
    • Method Detail

      • getComputer

        public Computer getComputer()
      • isEnabled

        public boolean isEnabled()
      • getDefaultStartTime

        public static String getDefaultStartTime()
        The default start time shown in the UI when adding a new maintenance windows. Current time.
        Returns:
        end time
      • getDefaultEndTime

        public static String getDefaultEndTime()
        The default end time shown in the UI when adding a new maintenance windows. Current time + 1 day.
        Returns:
        end time
      • hasMaintenanceWindows

        public boolean hasMaintenanceWindows()
        Return whether there are maintenance windows defined.
        Returns:
        true when there are maintenance windows defined.
      • hasActiveMaintenanceWindows

        public boolean hasActiveMaintenanceWindows()
        Return whether there are active maintenance windows.
        Returns:
        true when there are active maintenance windows defined.
      • getMaintenanceWindows

        public SortedSet<MaintenanceWindow> getMaintenanceWindows()
        Returns a list of maintenance windows.
        Returns:
        A list of maintenance windows
      • getRecurringMaintenanceWindows

        public Set<RecurringMaintenanceWindow> getRecurringMaintenanceWindows()
        Returns a list of recurring maintenance windows.
        Returns:
        A list of recurring maintenance windows
      • doAdd

        @POST
        public org.kohsuke.stapler.HttpResponse doAdd​(org.kohsuke.stapler.StaplerRequest req)
                                               throws IOException,
                                                      javax.servlet.ServletException
        UI method to add a maintenance window.
        Parameters:
        req - Stapler Request
        Returns:
        Response containing the result of the add
        Throws:
        IOException - when writing fails
        javax.servlet.ServletException - if an error occurs reading the form
      • doAddRecurring

        @POST
        public void doAddRecurring​(org.kohsuke.stapler.StaplerRequest req,
                                   org.kohsuke.stapler.StaplerResponse rsp)
                            throws IOException,
                                   javax.servlet.ServletException
        UI method to add a recurring maintenance window.
        Parameters:
        req - Stapler Request
        rsp - Stapler Response
        Throws:
        IOException - when writing fails
        javax.servlet.ServletException - if an error occurs reading the form
      • deleteMultiple

        @JavaScriptMethod
        public String[] deleteMultiple​(String[] ids)
        UI method to delete multiple maintenance windows.
        Parameters:
        ids - A list of maintenance window ids to delete
      • getMaintenanceStatus

        @JavaScriptMethod
        public Map<String,​Boolean> getMaintenanceStatus()
        UI method to fetch status about maintenance windows.
        Returns:
        A Map containing for each maintenance window whether it is active or not.
      • deleteMultipleRecurring

        @JavaScriptMethod
        public String[] deleteMultipleRecurring​(String[] ids)
        UI method to delete multiple recurring maintenance windows.
        Parameters:
        ids - A list of recurring maintenance window ids to delete
      • deleteMaintenance

        @JavaScriptMethod
        public boolean deleteMaintenance​(String id)
        UI method to delete a maintenance window.
        Parameters:
        id - The id of the maintenance to delete
      • deleteRecurringMaintenance

        @JavaScriptMethod
        public boolean deleteRecurringMaintenance​(String id)
        UI method to delete a recurring maintenance window.
        Parameters:
        id - The id of the maintenance to delete
      • doConfigSubmit

        @POST
        public org.kohsuke.stapler.HttpResponse doConfigSubmit​(org.kohsuke.stapler.StaplerRequest req)
                                                        throws IOException,
                                                               javax.servlet.ServletException
        UI method to submit the configuration.
        Parameters:
        req - Stapler Request
        Returns:
        Response containing the result of the add
        Throws:
        IOException - when writing fails
        javax.servlet.ServletException - if an error occurs reading the form
      • doEnable

        @POST
        public void doEnable​(org.kohsuke.stapler.StaplerResponse rsp)
                      throws IOException
        UI method to enable the retention strategy.
        Parameters:
        rsp - Stapler Response
        Throws:
        IOException - when something goes wrong
      • doDisable

        @POST
        public void doDisable​(org.kohsuke.stapler.StaplerResponse rsp)
                       throws IOException
        UI method to remove the retention strategy.
        Parameters:
        rsp - Stapler Response
        Throws:
        IOException - when something goes wrong