Class MaintenanceAction
- java.lang.Object
-
- com.sap.prd.jenkins.plugins.agent_maintenance.MaintenanceAction
-
- All Implemented Interfaces:
Action
,ModelObject
public class MaintenanceAction extends Object implements Action
Action to display link to maintenance window configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static Permission[]
CONFIGURE_AND_DISCONNECT
-
Constructor Summary
Constructors Constructor Description MaintenanceAction(SlaveComputer computer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
deleteMaintenance(String id)
UI method to delete a maintenance window.String[]
deleteMultiple(String[] ids)
UI method to delete multiple maintenance windows.String[]
deleteMultipleRecurring(String[] ids)
UI method to delete multiple recurring maintenance windows.boolean
deleteRecurringMaintenance(String id)
UI method to delete a recurring maintenance window.org.kohsuke.stapler.HttpResponse
doAdd(org.kohsuke.stapler.StaplerRequest req)
UI method to add a maintenance window.void
doAddRecurring(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
UI method to add a recurring maintenance window.org.kohsuke.stapler.HttpResponse
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req)
UI method to submit the configuration.void
doDisable(org.kohsuke.stapler.StaplerResponse rsp)
UI method to remove the retention strategy.void
doEnable(org.kohsuke.stapler.StaplerResponse rsp)
UI method to enable the retention strategy.Computer
getComputer()
static String
getDefaultEndTime()
The default end time shown in the UI when adding a new maintenance windows.static String
getDefaultStartTime()
The default start time shown in the UI when adding a new maintenance windows.String
getDisplayName()
String
getIconFileName()
Map<String,Boolean>
getMaintenanceStatus()
UI method to fetch status about maintenance windows.Class<MaintenanceWindow>
getMaintenanceWindowClass()
SortedSet<MaintenanceWindow>
getMaintenanceWindows()
Returns a list of maintenance windows.Class<RecurringMaintenanceWindow>
getRecurringMaintenanceWindowClass()
Set<RecurringMaintenanceWindow>
getRecurringMaintenanceWindows()
Returns a list of recurring maintenance windows.String
getUrlName()
boolean
hasActiveMaintenanceWindows()
Return whether there are active maintenance windows.boolean
hasMaintenanceWindows()
Return whether there are maintenance windows defined.boolean
isEnabled()
-
-
-
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()
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
getMaintenanceWindowClass
public Class<MaintenanceWindow> getMaintenanceWindowClass()
-
getRecurringMaintenanceWindowClass
public Class<RecurringMaintenanceWindow> getRecurringMaintenanceWindowClass()
-
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 failsjavax.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 Requestrsp
- Stapler Response- Throws:
IOException
- when writing failsjavax.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 failsjavax.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
-
-