2.10.0: 2009-02-24

net.sf.basedb.util.overview
Class ValidationOptions

java.lang.Object
  extended by net.sf.basedb.util.overview.ValidationOptions

public class ValidationOptions
extends Object

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:
GenericOverview.getValidationOptions(), Failure
Last modified
$Date: 2009-02-24 09:40:59 +0100 (Tue, 24 Feb 2009) $

Field Summary
private  Map<String,Severity> options
          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
 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 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

options

private Map<String,Severity> options
Maps Validator ID to severity.

Constructor Detail

ValidationOptions

public ValidationOptions()
Create a new ValidationOptions object.


ValidationOptions

public ValidationOptions(Presets.Preset preset)
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 Detail

getSeverity

public Severity getSeverity(Validator validator)
Get the severity level for the specified validator rule. If no option exists the validators default severity level is returned.

Parameters:
validator - The validator to get the severity level for
Returns:
A severity level object
See Also:
Validator.getDefaultSeverity()

setSeverity

public void setSeverity(Validator validator,
                        Severity severity)
Set a severity level for the specified validation rule.

Parameters:
validator - The validation rule
severity - The severity level or null to use the default severity level

loadFromPreset

public void loadFromPreset(Presets.Preset preset,
                           boolean clearFirst)
Load validation options from a 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.

Parameters:
preset - The preset to load the options from
clearFirst - If the current settings should be cleared before the new ones are loaded from the preset
See Also:
saveToPreset(net.sf.basedb.core.Presets.Preset)

saveToPreset

public void saveToPreset(Presets.Preset preset)
Save the current settings to a preset. The Validator.getId() is used as key and the Enum.name() is used as value.

Parameters:
preset - The preset to save the settings to

2.10.0: 2009-02-24