|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.overview.ValidationOptions
public class 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.
GenericOverview.getValidationOptions()
,
Failure
Field Summary | |
---|---|
private Map<String,String> |
options
Other options. |
private Map<String,Severity> |
severities
Maps Validator ID to severity. |
Constructor Summary | |
---|---|
ValidationOptions()
Create a new ValidationOptions object. |
|
ValidationOptions(Presets.Preset preset)
Create a new ValidationOptions object and load settings from a preset. |
Method Summary | |
---|---|
String |
getOption(Validator validator,
String key,
String defaultValue)
Get the configured option for a validator rule. |
Severity |
getSeverity(Validator validator)
Get the severity level for the specified validator rule. |
void |
loadFromPreset(Presets.Preset preset,
boolean clearFirst)
Load validation options from a Presets.Preset . |
void |
saveToPreset(Presets.Preset preset)
Save the current settings to a preset. |
void |
setOption(Validator validator,
String key,
String value)
Set an option for a validator rule. |
void |
setSeverity(Validator validator,
Severity severity)
Set a severity level for the specified validation rule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Map<String,Severity> severities
private Map<String,String> options
Constructor Detail |
---|
public ValidationOptions()
public ValidationOptions(Presets.Preset preset)
preset
- The preset to load settings from, or null to not
load any settingsMethod Detail |
---|
public Severity getSeverity(Validator validator)
validator
- The validator to get the severity level for
Validator.getDefaultSeverity()
public void setSeverity(Validator validator, Severity severity)
validator
- The validation ruleseverity
- The severity level or null to use the default severity levelpublic String getOption(Validator validator, String key, String defaultValue)
validator
- The validatorkey
- The key (name) of the optiondefaultValue
- The default value in case there is no configured value
public void setOption(Validator validator, String key, String value)
validator
- The validatorkey
- The key (name) of the optionvalue
- The value to set or null to remove the valuepublic void loadFromPreset(Presets.Preset preset, boolean clearFirst)
Presets.Preset
. The preset
should contain settings where the ID of the a Validator
is used as keys and the names of Severity
values are used
as values.
preset
- The preset to load the options fromclearFirst
- If the current settings should be cleared
before the new ones are loaded from the presetsaveToPreset(net.sf.basedb.core.Presets.Preset)
public void saveToPreset(Presets.Preset preset)
Validator.getId()
is used as key and the Enum.name()
is used as value.
preset
- The preset to save the settings to
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |