Package net.sf.basedb.util.overview
Class ValidationOptions
java.lang.Object
net.sf.basedb.util.overview.ValidationOptions
Stores all validation options (ie. validator -- severity) combinations.
Note that all rules are always validated. Use object of this class to
keep track of which validators that should be ignored, generate warnings or errors.
- Version:
- 2.2
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2019-03-12 07:53:27 +0100 (tis, 12 mars 2019) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new ValidationOptions object.ValidationOptions
(Presets.Preset preset) Create a new ValidationOptions object and load settings from a preset. -
Method Summary
Modifier and TypeMethodDescriptiongetOption
(ValidationRuleAction rule, String key, String defaultValue) Get the configured option for a validator rule.Get the severity level for the specified validator rule.void
loadFromPreset
(Presets.Preset preset, boolean clearFirst) Load validation options from aPresets.Preset
.void
saveToPreset
(Presets.Preset preset) Save the current settings to a preset.void
setOption
(ValidationRuleAction rule, String key, String value) Set an option for a validator rule.void
setSeverity
(ValidationRuleAction rule, Severity severity) Set a severity level for the specified validation rule.
-
Field Details
-
severities
Maps Validator ID to severity. -
options
Other options. Key is validator ID + key
-
-
Constructor Details
-
ValidationOptions
public ValidationOptions()Create a new ValidationOptions object. -
ValidationOptions
Create a new ValidationOptions object and load settings from a preset.- Parameters:
preset
- The preset to load settings from, or null to not load any settings
-
-
Method Details
-
getSeverity
Get the severity level for the specified validator rule. If no option exists the validators default severity level is returned.- Parameters:
rule
- The validation rule to get the severity level for- Returns:
- A severity level object
- Since:
- 3.2
- See Also:
-
setSeverity
Set a severity level for the specified validation rule.- Parameters:
rule
- The validation ruleseverity
- The severity level or null to use the default severity level- Since:
- 3.2
-
getOption
Get the configured option for a validator rule.- Parameters:
rule
- The validation rulekey
- The key (name) of the optiondefaultValue
- The default value in case there is no configured value- Returns:
- The value of the option
- Since:
- 3.2
-
setOption
Set an option for a validator rule.- Parameters:
rule
- The validation rulekey
- The key (name) of the optionvalue
- The value to set or null to remove the value- Since:
- 3.2
-
loadFromPreset
Load validation options from aPresets.Preset
. The preset should contain settings where the ID of the aValidator
is used as keys and the names ofSeverity
values are used as values.- Parameters:
preset
- The preset to load the options fromclearFirst
- If the current settings should be cleared before the new ones are loaded from the preset- See Also:
-
saveToPreset
Save the current settings to a preset. TheValidator.getId()
is used as key and theEnum.name()
is used as value.- Parameters:
preset
- The preset to save the settings to
-