The validation processor contains two main data structures. Each one is a HashMap of ArrayLists that hold Validations. The first one, featureLookup, holds per-feature validation tests (tests that operate on one feature at a time with no knowledge of any other features. The second one, integrityLookup, holds integrity validations (validations that span multiple features and/or multiple feature types).
Each HashMap of validations is hashed with a key whose value is a FeatureTypeName. This key provides access to an ArrayList of validations that are to be performed on this FeatureTypeInfo.
Validations are added via the two addValidation() methods.
The validations are run when runFeatureTests() and runIntegrityTests() are called. It is recommended that the user call runFeatureTests() before runIntegrityTests() as it is usually the case that integrity tests are much more time consuming. If a Feature is incorrect, it can probably be detected early on, and quickly, in the feature validation tests.
For validations that are performed on every FeatureTypeInfo, a value called ANYTYPENAME has been created and can be stored in the validationLookup tables if a validation specifies that it is run against all FeatureTypes. The value that causes a validation to be run against all FeatureTypes is null. Or Validation.ALL
Results of the validation tests are handled using a Visitor pattern. This visitor is a ValidationResults object that is passed into the runFeatureTests() and runIntegrityTests() methods. Each individual validation will record error messages in the ValidationResults visitor.
Example Use:
ValidationProcessor processor = new ValidationProcessor();
processor.addValidation(FeatureValidation1);
processor.addValidation(FeatureValidation2);
processor.addValidation(IntegrityValidation1);
processor.addValidation(FeatureValidation3);
processor.runFeatureTests(FeatureTypeInfo, Feature, ValidationResults);
processor.runIntegrityTests(layers, Envelope, ValidationResults);
@author bowens, Refractions Research, Inc.
@author $Author: jive $ (last modification)
@source $URL$
@version $Id$
|
|
|
|
|
|
|
|
|
|
|
|