org.geotools.validation.attributes
Class UniqueFIDValidation

java.lang.Object
  extended byorg.geotools.validation.attributes.UniqueFIDValidation
All Implemented Interfaces:
IntegrityValidation, Validation

public class UniqueFIDValidation
extends java.lang.Object
implements IntegrityValidation

Ensure every feature has a unique Feature Id specified by uniqueID.

Please note that featureIDs are not attributes. Attributes may be checked with the UniquityValidation class.

The FeatureTypes it checks against are defined by typeNames[]. If a duplicate ID is detected, an error message returned via a Validation Result used as a visitor in the validation() method.

Example Use:


 UniqueFIDIntegrityValidation x = new UniqueFIDIntegrityValidation("uniqueFID_road", "Checks if each feature has a unique ID", new String[] {"road", "river"}, "FID");
 x.validate();
 


Field Summary
 
Fields inherited from interface org.geotools.validation.Validation
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL
 
Constructor Summary
UniqueFIDValidation()
          UniqueFIDIntegrityValidation constructor.
UniqueFIDValidation(java.lang.String name, java.lang.String description, java.lang.String[] typeNames, java.lang.String uniqueID)
          UniqueFIDIntegrityValidation constructor.
 
Method Summary
 java.lang.String getDescription()
          Override getDescription.
 java.lang.String getName()
          Override getName.
 int getPriority()
          Override getPriority.
 java.lang.String[] getTypeRefs()
          Override getTypeNames.
 void setDescription(java.lang.String description)
          Override setDescription.
 void setName(java.lang.String name)
          Override setName.
 void setTypeNames(java.lang.String[] names)
          Override setTypeNames.
 boolean validate(java.util.Map layers, com.vividsolutions.jts.geom.Envelope envelope, ValidationResults results)
          Override validate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniqueFIDValidation

public UniqueFIDValidation()
UniqueFIDIntegrityValidation constructor.

An empty constructor placed here for Java Beans


UniqueFIDValidation

public UniqueFIDValidation(java.lang.String name,
                           java.lang.String description,
                           java.lang.String[] typeNames,
                           java.lang.String uniqueID)
UniqueFIDIntegrityValidation constructor.

Initializes allinformation needed to perform the validation.

Parameters:
name - The name of this validation.
description - The description of this validation.
typeNames - The TypeNames that this validation is tested on.
uniqueID - The column name that this validation checks to see if it is unique.
Method Detail

setName

public void setName(java.lang.String name)
Override setName.

Sets the name of this validation.

Specified by:
setName in interface Validation
Parameters:
name - The name of this validation.
Returns:
returns the name of this validation.
See Also:
Validation.setName(java.lang.String)

getName

public java.lang.String getName()
Override getName.

Returns the name of this particular validation.

Specified by:
getName in interface Validation
Returns:
The name of this particular validation.
See Also:
Validation.getName()

setDescription

public void setDescription(java.lang.String description)
Override setDescription.

Sets the description of this validation.

Specified by:
setDescription in interface Validation
Parameters:
description - The description of the validation.
See Also:
Validation.setDescription(java.lang.String)

getDescription

public java.lang.String getDescription()
Override getDescription.

Returns the description of this validation as a string.

Specified by:
getDescription in interface Validation
Returns:
The description of this validation.
See Also:
Validation.getDescription()

getPriority

public int getPriority()
Override getPriority.

Sets the priority level of this validation.

Specified by:
getPriority in interface Validation
Returns:
A made up priority for this validation.
See Also:
Validation.getPriority()

setTypeNames

public void setTypeNames(java.lang.String[] names)
Override setTypeNames.

Sets the TypeNames of the FeatureTypes used in this particular validation.

Parameters:
names - The TypeNames of the FeatureTypes used in this particular validation.
See Also:
org.geotools.validation.Validation#setTypeNames(java.lang.String[])

getTypeRefs

public java.lang.String[] getTypeRefs()
Override getTypeNames.

Returns the TypeNames of the FeatureTypes used in this particular validation.

Specified by:
getTypeRefs in interface Validation
Returns:
An array of TypeNames
See Also:
Validation.getTypeRefs()

validate

public boolean validate(java.util.Map layers,
                        com.vividsolutions.jts.geom.Envelope envelope,
                        ValidationResults results)
                 throws java.lang.Exception
Override validate.

Description ... This is supposed to go off and grab the necesary features from the database using the envelope with the typeNames. But it doesn't yet. It just uses the ones passed in through parameter layers.

Specified by:
validate in interface IntegrityValidation
Parameters:
layers - a HashMap of key="TypeName" value="FeatureSource"
envelope - The bounding box of modified features
results - Storage for the error and warning messages
Returns:
True if there were no errors. False if there were errors.
Throws:
java.lang.Exception
See Also:
IntegrityValidation.validate(java.util.Map, com.vividsolutions.jts.geom.Envelope, org.geotools.validation.ValidationResults)