Package hudson.plugins.jobConfigHistory
Class JobConfigHistory
java.lang.Object
hudson.model.Descriptor<GlobalConfiguration>
jenkins.model.GlobalConfiguration
hudson.plugins.jobConfigHistory.JobConfigHistory
- All Implemented Interfaces:
ExtensionPoint,Describable<GlobalConfiguration>,Saveable,Loadable,OnMaster
Class supporting global configuration settings, along with methods associated
with the plugin itself.
- Author:
- John Borghi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.SelfNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsFields inherited from class hudson.model.Descriptor
clazz -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanconfigure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData) doCheckExcludePattern(String value) Validates the user entry for the regular expression of system file names to exclude from saving.Validates the user entry for the maximum number of days to keep history items.doCheckMaxEntriesPerPage(String value) Validates the user entry for the maximum number of history items to show per page.doCheckMaxHistoryEntries(String value) Validates the user entry for the maximum number of history items to keep.booleanGets whether a change reason comment is mandatory.protected XmlFilegetConfigFile(File historyDir) Returns the File object representing the configured root history directory.Gets the default root directory for storing histories.Gets usernames whose changes should not get detected.Gets the regular expression pattern for 'system' configuration files to exclude from saving.Gets the regular expression pattern used by this class.protected HistoryDaoFor tests.Gets the root directory for storing histories.Deprecated.protected FileFor tests.Gets the maximum number of days to keep history entries.Gets the maximum number of history entries to show per page.Gets the maximum number of history entries to keep.booleanDeprecated.since version 2.9booleanGets whether to save the config history of Maven modules.Gets whether build badges should appear when the config of a job has changed since the last build.booleanGets whether a change reason comment window should be shown on a jobs' configure page.booleanGets whether to skip saving history when it is a duplication of the previous saved configuration.booleanisPositiveInteger(String numberString) Checks if a string evaluates to a positive integer number.booleanisSaveable(Saveable item, XmlFile xmlFile) Returns true if configuration for this item should be saved, based on the plugin settings, the type of item and the configuration file specified.voidsetChangeReasonCommentIsMandatory(boolean changeReasonCommentIsMandatory) Sets whether the change reason comment is mandatory.voidsetExcludedUsers(String excludedUsers) Sets usernames whose changes should not get detected.voidsetExcludePattern(String excludePattern) Sets the regular expression pattern for 'system' configuration files to exclude from saving.voidsetHistoryRootDir(String historyRootDir) Sets the root directory for storing histories.voidsetMaxDaysToKeepEntries(String maxDaysInput) Sets the maximum number of days to keep history entries.voidsetMaxEntriesPerPage(String maxEntryInput) Sets the maximum number of history entries to show per page.voidsetMaxHistoryEntries(String maxEntryInput) Sets the maximum number of history entries to keep.voidsetSaveModuleConfiguration(boolean saveModuleConfiguration) Sets whether to save the config history of Maven modules.voidsetShowBuildBadges(String showBuildBadges) Sets whether build badges should appear when the config of a job has changed since the last build.voidsetShowChangeReasonCommentWindow(boolean showChangeReasonCommentWindow) Sets whether a change reason comment window should be shown on a jobs' configure page.voidsetSkipDuplicateHistory(boolean skipDuplicateHistory) Sets whether to skip saving history when it is a duplication of the previous saved configuration.booleanshowBuildBadges(Job<?, ?> project) Whether build badges should appear for the builds of this project.booleanshowBuildBadgesLink(Job<?, ?> project) Whether build badges link should appear for the builds of this project.Methods inherited from class jenkins.model.GlobalConfiguration
all, configure, getDescriptor, getGlobalConfigPageMethods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getStaticHelpUrl, getStaticHelpUrl, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
Field Details
-
DELETEENTRY_PERMISSION
-
-
Constructor Details
-
JobConfigHistory
@DataBoundConstructor @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public JobConfigHistory()
-
-
Method Details
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData) throws Descriptor.FormException - Overrides:
configurein classGlobalConfiguration- Throws:
Descriptor.FormException
-
getConfigFile
- Overrides:
getConfigFilein classDescriptor<GlobalConfiguration>
-
getDefaultRootDir
Gets the default root directory for storing histories.- Returns:
- The default root directory.
-
getHistoryRootDir
Gets the root directory for storing histories.- Returns:
- The root directory.
-
setHistoryRootDir
Sets the root directory for storing histories.- Parameters:
historyRootDir- The root directory.
-
getMaxHistoryEntries
Gets the maximum number of history entries to keep.- Returns:
- The maximum number of history entries to keep.
-
setMaxHistoryEntries
Sets the maximum number of history entries to keep.- Parameters:
maxEntryInput- The maximum number of history entries to keep.
-
getMaxEntriesPerPage
Gets the maximum number of history entries to show per page.- Returns:
- The maximum number of history entries to show per page.
-
setMaxEntriesPerPage
Sets the maximum number of history entries to show per page.- Parameters:
maxEntryInput- The maximum number of history entries to show per page.
-
getMaxDaysToKeepEntries
Gets the maximum number of days to keep history entries.- Returns:
- The maximum number of days to keep history entries.
-
setMaxDaysToKeepEntries
Sets the maximum number of days to keep history entries.- Parameters:
maxDaysInput- The maximum number of days to keep history entries.
-
isPositiveInteger
Checks if a string evaluates to a positive integer number.- Parameters:
numberString- The number in question (as String)- Returns:
- Whether the number is a positive integer
-
getSaveItemGroupConfiguration
Deprecated.since version 2.9- Returns:
- True if item group configurations should be saved.
-
getSkipDuplicateHistory
public boolean getSkipDuplicateHistory()Gets whether to skip saving history when it is a duplication of the previous saved configuration.- Returns:
- Whether to skip saving history when it is a duplication of the previous saved configuration.
-
setSkipDuplicateHistory
@DataBoundSetter public void setSkipDuplicateHistory(boolean skipDuplicateHistory) Sets whether to skip saving history when it is a duplication of the previous saved configuration.- Parameters:
skipDuplicateHistory- Whether to skip saving history when it is a duplication of the previous saved configuration.
-
getExcludePattern
Gets the regular expression pattern for 'system' configuration files to exclude from saving.- Returns:
- The regular expression pattern.
-
setExcludePattern
Sets the regular expression pattern for 'system' configuration files to exclude from saving.- Parameters:
excludePattern- The regular expression pattern.
-
getSaveModuleConfiguration
public boolean getSaveModuleConfiguration()Gets whether to save the config history of Maven modules.- Returns:
- Whether to save the config history of Maven modules.
-
setSaveModuleConfiguration
@DataBoundSetter public void setSaveModuleConfiguration(boolean saveModuleConfiguration) Sets whether to save the config history of Maven modules.- Parameters:
saveModuleConfiguration- Whether to save the config history of Maven modules.
-
getShowBuildBadges
Gets whether build badges should appear when the config of a job has changed since the last build.- Returns:
- Possible value: "never", "always", "userWithConfigPermission", "adminUser"
-
setShowBuildBadges
Sets whether build badges should appear when the config of a job has changed since the last build.- Parameters:
showBuildBadges- Possible values: "never", "always", "userWithConfigPermission", "adminUser"
-
getShowChangeReasonCommentWindow
public boolean getShowChangeReasonCommentWindow()Gets whether a change reason comment window should be shown on a jobs' configure page.- Returns:
- Whether a comment window should be shown.
-
getChangeReasonCommentIsMandatory
public boolean getChangeReasonCommentIsMandatory()Gets whether a change reason comment is mandatory.- Returns:
- Whether the change reason comment is mandatory
-
setShowChangeReasonCommentWindow
@DataBoundSetter public void setShowChangeReasonCommentWindow(boolean showChangeReasonCommentWindow) Sets whether a change reason comment window should be shown on a jobs' configure page.- Parameters:
showChangeReasonCommentWindow- Whether a comment window should be shown.
-
setChangeReasonCommentIsMandatory
@DataBoundSetter public void setChangeReasonCommentIsMandatory(boolean changeReasonCommentIsMandatory) Sets whether the change reason comment is mandatory.- Parameters:
changeReasonCommentIsMandatory- Whether the change reason comment is mandatory.
-
showBuildBadges
Whether build badges should appear for the builds of this project.- Parameters:
project- The project to which the build history belongs.- Returns:
- False if the option is set to 'never' or the user doesn't have the required permissions.
-
showBuildBadgesLink
Whether build badges link should appear for the builds of this project.- Parameters:
project- The project to which the build history belongs.- Returns:
- False if the option is set to 'never', 'always' or the user doesn't have the required permissions.
-
getExcludeRegexpPattern
Gets the regular expression pattern used by this class.- Returns:
- The loaded regexp pattern, or null if pattern was invalid.
-
getConfiguredHistoryRootDir
Returns the File object representing the configured root history directory.- Returns:
- The configured root history File object. from the URI.
-
getConfigFile
- Parameters:
historyDir- The history directory to look under.- Returns:
- The configuration file or null if no file is found.
- See Also:
-
getExcludedUsers
Gets usernames whose changes should not get detected.- Returns:
- Comma separated list of usernames.
-
setExcludedUsers
Sets usernames whose changes should not get detected.- Parameters:
excludedUsers- Comma separated list of usernames.
-
isSaveable
Returns true if configuration for this item should be saved, based on the plugin settings, the type of item and the configuration file specified.If the item is an instance of
AbstractProjector the configuration file is stored directly in JENKINS_ROOT, it is considered for saving.If the plugin is configured to skip saving duplicated history, we also evaluate if this configuration duplicates the previous saved history (if such history exists).
- Parameters:
item- The item whose configuration is under consideration.xmlFile- The configuration file for the above item.- Returns:
- true if the item configuration should be saved.
-
doCheckMaxHistoryEntries
Validates the user entry for the maximum number of history items to keep. Must be blank or a non-negative integer.- Parameters:
value- The form input entered by the user.- Returns:
- ok if the entry is blank or a non-negative integer.
-
doCheckMaxEntriesPerPage
Validates the user entry for the maximum number of history items to show per page. Must be blank or a non-negative integer.- Parameters:
value- The form input entered by the user.- Returns:
- ok if the entry is blank or a non-negative integer.
-
doCheckMaxDaysToKeepEntries
Validates the user entry for the maximum number of days to keep history items. Must be blank or a non-negative integer.- Parameters:
value- The form input entered by the user.- Returns:
- ok if the entry is blank or a non-negative integer.
-
doCheckExcludePattern
Validates the user entry for the regular expression of system file names to exclude from saving.- Parameters:
value- The form input entered by the user.- Returns:
- ok if the entry is a valid regular expression.
-
getHistoryDao
For tests.- Returns:
- The history DAO.
-
getJenkinsHome
For tests.- Returns:
- JENKINS_HOME
-
getJenkins
Deprecated.For tests.- Returns:
- The Jenkins instance.
-