net.refractions.udig.validation
Class ValidationProcessor

java.lang.Object
  extended by org.geotools.validation.ValidationProcessor
      extended by net.refractions.udig.validation.ValidationProcessor

public class ValidationProcessor
extends org.geotools.validation.ValidationProcessor

Subclass for the geotools ValidationProcessor, with added methods which allow for tree navigation, etc. For the most part, this adds more baggage to the class so the Validation Dialog can get information out of it.

Since:
1.0.1
Author:
chorner
See Also:
org.geotools.validation.ValidationProcessor

Constructor Summary
ValidationProcessor(java.io.File pluginsDir, java.io.File testSuiteFile)
          Constructor for the udig ValidationProcessor subclass.
 
Method Summary
 void addValidation(Validation validation, PlugInDTO plugin, java.lang.Object testSuiteDTOKey)
          Adds a testDTO validation to the testSuiteDTO, and calls addValidation from the superclass.
 Validation createValidation(PlugInDTO dto)
          Creates a new validation test of the correct type when passed the plugInDTO.
 java.util.Map getPluginDTOs()
           
 java.util.Set getPlugins()
          Returns a Set (HashSet) of plugins (validation tests) available.
 java.util.Map getTests()
          Returns a complete list of available tests (all testSuites are merged)
 java.lang.Object[] getTests(java.lang.Object plugin)
          Returns an array of tests relevant to the plugin
 java.util.Map<java.lang.String,TestSuiteDTO> getTestSuiteDTOs()
           
 java.lang.String getUniqueName(java.util.Map allItems, java.lang.String labelPrefix)
          Returns a unique name for an automatically generated Test (Test1, Test2, etc), or where labelPrefix is typically "Test"
 TestSuiteDTO moveTests(TestSuiteDTO suite, java.util.Map<java.lang.String,TestDTO> tests, boolean allowDupes)
          Places a Map of tests one-by-one into a TestSuiteDTO.
 void removeValidation(TestDTO test)
          Removes a validation from its testSuiteDTO and from the FV/IV Lookups
 boolean renameValidation(java.lang.String oldKey, java.lang.String newKey, java.lang.Object testSuiteDTOKey)
           
 void runAllFeatureTests(ILayer[] layers, ValidationResults results, IProgressMonitor monitor)
          Runs all feature tests by iterating through the list of layers, and calling runFeatureTests() on each layer.
 void runAllIntegrityTests(ILayer[] layers, ValidationResults results, IProgressMonitor monitor)
          Runs all integrity tests (prepares and calls runIntegrityTests)
 void runFeatureTest(java.lang.Object testName, ILayer[] layers, ValidationResults results, IProgressMonitor monitor)
          Runs a single feature validation test
 void runIntegrityTest(java.lang.Object testName, ILayer[] layers, ValidationResults results, IProgressMonitor monitor)
          Runs a single integrity validation test
 void setArg(TestDTO test, ArgumentDTO arg)
           
 void setPluginDTOs(java.util.Map<java.lang.String,PlugInDTO> pluginDTOs)
           
 void setTestSuiteDTOs(java.util.Map<java.lang.String,TestSuiteDTO> testSuiteDTOs)
           
 boolean testsExist(java.lang.Object testSuiteKey)
          Determines if a given testSuite contains any tests or not.
 void updateFVLookup()
          Regenerates the FV Lookup Map based on the contents of the testSuite
 void updateIVLookup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationProcessor

public ValidationProcessor(java.io.File pluginsDir,
                           java.io.File testSuiteFile)
                    throws java.lang.Exception
Constructor for the udig ValidationProcessor subclass. The plugins parameter is required, but the testSuites var may be a null File object (a blank testSuite will be created).

Parameters:
pluginsDir - (directory containing pluginSchema xml files)
testSuites - (testSuite file or a directory)
Throws:
java.lang.Exception
Method Detail

addValidation

public void addValidation(Validation validation,
                          PlugInDTO plugin,
                          java.lang.Object testSuiteDTOKey)
Adds a testDTO validation to the testSuiteDTO, and calls addValidation from the superclass.

Parameters:
validation - FeatureValidation object
testSuiteDTOKey - ID object (the key of the testSuiteDTO as referenced in testSuiteDTOs)
See Also:
org.geotools.validation.ValidationProcessor.addValidation

renameValidation

public boolean renameValidation(java.lang.String oldKey,
                                java.lang.String newKey,
                                java.lang.Object testSuiteDTOKey)

removeValidation

public void removeValidation(TestDTO test)
Removes a validation from its testSuiteDTO and from the FV/IV Lookups

Parameters:
validation -

runFeatureTest

public void runFeatureTest(java.lang.Object testName,
                           ILayer[] layers,
                           ValidationResults results,
                           IProgressMonitor monitor)
                    throws java.lang.Exception
Runs a single feature validation test

Parameters:
testName -
layers -
results -
monitor -
Throws:
java.lang.Exception

runIntegrityTest

public void runIntegrityTest(java.lang.Object testName,
                             ILayer[] layers,
                             ValidationResults results,
                             IProgressMonitor monitor)
                      throws java.lang.Exception
Runs a single integrity validation test

Parameters:
testName -
layers -
results -
monitor -
Throws:
java.lang.Exception

runAllFeatureTests

public void runAllFeatureTests(ILayer[] layers,
                               ValidationResults results,
                               IProgressMonitor monitor)
                        throws java.lang.Exception
Runs all feature tests by iterating through the list of layers, and calling runFeatureTests() on each layer.

Parameters:
layers -
results -
monitor -
Throws:
java.lang.Exception
See Also:
runFeatureTests()

runAllIntegrityTests

public void runAllIntegrityTests(ILayer[] layers,
                                 ValidationResults results,
                                 IProgressMonitor monitor)
                          throws java.lang.Exception
Runs all integrity tests (prepares and calls runIntegrityTests)

Parameters:
layers -
results -
monitor -
Throws:
java.lang.Exception
See Also:
runIntegrityTests()

createValidation

public Validation createValidation(PlugInDTO dto)
                            throws ValidationException,
                                   java.lang.ClassNotFoundException
Creates a new validation test of the correct type when passed the plugInDTO.

Parameters:
plugin -
Returns:
Throws:
ValidationException
java.lang.ClassNotFoundException

updateFVLookup

public void updateFVLookup()
Regenerates the FV Lookup Map based on the contents of the testSuite


updateIVLookup

public void updateIVLookup()

getUniqueName

public java.lang.String getUniqueName(java.util.Map allItems,
                                      java.lang.String labelPrefix)
Returns a unique name for an automatically generated Test (Test1, Test2, etc), or where labelPrefix is typically "Test"

Parameters:
allItems -
labelPrefix -
Returns:

moveTests

public TestSuiteDTO moveTests(TestSuiteDTO suite,
                              java.util.Map<java.lang.String,TestDTO> tests,
                              boolean allowDupes)
Places a Map of tests one-by-one into a TestSuiteDTO. If an equal test already exists in the testSuite, it is ignored.

Parameters:
suite -
tests -
allDupes -
Returns:

getPlugins

public java.util.Set getPlugins()
Returns a Set (HashSet) of plugins (validation tests) available.


getTests

public java.util.Map getTests()
Returns a complete list of available tests (all testSuites are merged)

Returns:
Map of tests

getTests

public java.lang.Object[] getTests(java.lang.Object plugin)
Returns an array of tests relevant to the plugin

Parameters:
plugin -
Returns:

testsExist

public boolean testsExist(java.lang.Object testSuiteKey)
Determines if a given testSuite contains any tests or not.

Parameters:
testSuiteKey -
Returns:

setArg

public void setArg(TestDTO test,
                   ArgumentDTO arg)
            throws ValidationException,
                   java.beans.IntrospectionException
Throws:
ValidationException
java.beans.IntrospectionException

getPluginDTOs

public java.util.Map getPluginDTOs()

setPluginDTOs

public void setPluginDTOs(java.util.Map<java.lang.String,PlugInDTO> pluginDTOs)

getTestSuiteDTOs

public java.util.Map<java.lang.String,TestSuiteDTO> getTestSuiteDTOs()

setTestSuiteDTOs

public void setTestSuiteDTOs(java.util.Map<java.lang.String,TestSuiteDTO> testSuiteDTOs)