Package io.jenkins.plugins.monitoring
Class MonitorConfigurationProperty
- java.lang.Object
-
- hudson.model.UserProperty
-
- io.jenkins.plugins.monitoring.MonitorConfigurationProperty
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<UserProperty>
,ReconfigurableDescribable<UserProperty>
,Saveable
public class MonitorConfigurationProperty extends UserProperty implements Saveable
AUserProperty
to store the json configuration per user as property.- Author:
- Simon Symhoven
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MonitorConfigurationProperty.MonitorConfiguration
The property class to store.static class
MonitorConfigurationProperty.MonitorPropertyDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ID
The id for the default configuration.-
Fields inherited from class hudson.model.UserProperty
user
-
-
Constructor Summary
Constructors Constructor Description MonitorConfigurationProperty(List<MonitorConfigurationProperty.MonitorConfiguration> configurations)
Creates a newMonitorConfigurationProperty
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createOrUpdateConfiguration(String id, String config)
Updates an existingMonitorConfigurationProperty.MonitorConfiguration
.static Optional<MonitorConfigurationProperty>
forCurrentUser()
Gets theMonitorConfigurationProperty
for current user.MonitorConfigurationProperty.MonitorConfiguration
getConfiguration(String id)
Get aMonitorConfigurationProperty.MonitorConfiguration
by its id.Collection<MonitorConfigurationProperty.MonitorConfiguration>
getConfigurations()
void
removeConfiguration(String id)
Removes a configuration from configurations list.void
save()
-
Methods inherited from class hudson.model.UserProperty
all, getDescriptor, reconfigure, setUser
-
-
-
-
Field Detail
-
DEFAULT_ID
public static final String DEFAULT_ID
The id for the default configuration.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MonitorConfigurationProperty
public MonitorConfigurationProperty(List<MonitorConfigurationProperty.MonitorConfiguration> configurations)
Creates a newMonitorConfigurationProperty
.- Parameters:
configurations
- the list of configurations to add to theMonitorConfigurationProperty
.
-
-
Method Detail
-
getConfigurations
public Collection<MonitorConfigurationProperty.MonitorConfiguration> getConfigurations()
-
getConfiguration
public MonitorConfigurationProperty.MonitorConfiguration getConfiguration(String id)
Get aMonitorConfigurationProperty.MonitorConfiguration
by its id.- Parameters:
id
- the id of theMonitorConfigurationProperty.MonitorConfiguration
to get.- Returns:
- the
MonitorConfigurationProperty.MonitorConfiguration
or default if id does not exist onMonitorConfigurationProperty
.
-
createOrUpdateConfiguration
public void createOrUpdateConfiguration(String id, String config)
Updates an existingMonitorConfigurationProperty.MonitorConfiguration
.- Parameters:
id
- the id of theMonitorConfigurationProperty.MonitorConfiguration
to update.config
- the config string to update.
-
removeConfiguration
public void removeConfiguration(String id)
Removes a configuration from configurations list.- Parameters:
id
- the id of configuration to remove.
-
forCurrentUser
public static Optional<MonitorConfigurationProperty> forCurrentUser()
Gets theMonitorConfigurationProperty
for current user.- Returns:
- the
MonitorConfigurationProperty
asOptional
.
-
-