org.geotools.validation
Class DefaultFeatureValidation

Object
  extended by DefaultFeatureValidation
All Implemented Interfaces:
FeatureValidation, Validation
Direct Known Subclasses:
AttributeValidation, DomainValidation, EqualityValidation, GazetteerNameValidation, IsValidGeometryValidation, LineMustBeASinglePartValidation, LineNoSelfIntersectValidation, LineNoSelfOverlappingValidation, NullZeroValidation, PolygonNoGapsValidation, RangeValidation, SingleValueValidation, SQLValidation

public class DefaultFeatureValidation
extends Object
implements FeatureValidation

Tests to see if a Feature ...

The geometry is first tested to see if it is null, and if it is null, then it is tested to see if it is allowed to be null by calling isNillable().

Author:
Jody Garnett, Refractions Research, Inc., $Author: jive $ (last modification)
Module:

Field Summary
 
Fields inherited from interface Validation
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL
 
Constructor Summary
DefaultFeatureValidation()
          No argument constructor, required by the Java Bean Specification.
 
Method Summary
protected  LineString getDefaultLineString(SimpleFeature feature)
          Retrives a single LineString from feature.getDefaultGeometry.
 String getDescription()
          Override getDescription.
 String getName()
          Access the user's name for this test.
 int getPriority()
          The priority level used to schedule this Validation.
 String getTypeRef()
          Access typeRef property.
 String[] getTypeRefs()
          Implementation of getTypeNames.
 void setDescription(String description)
          Sets the description of this validation.
 void setName(String name)
          Sets the name of this validation.
 void setTypeRef(String typeRef)
          Set typeRef to typeRef.
 boolean validate(SimpleFeature feature, SimpleFeatureType type, ValidationResults results)
          Validation test for feature.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFeatureValidation

public DefaultFeatureValidation()
No argument constructor, required by the Java Bean Specification.

Method Detail

setName

public final void setName(String name)
Sets the name of this validation.

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

getName

public final String getName()
Access the user's name for this test.

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

setDescription

public final void setDescription(String description)
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 final 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()
The priority level used to schedule this Validation.

Specified by:
getPriority in interface Validation
Returns:
PRORITY_SIMPLE
See Also:
Validation.getPriority()

getTypeRefs

public String[] getTypeRefs()
Implementation of getTypeNames.

Specified by:
getTypeRefs in interface Validation
Returns:
Array of typeNames, or empty array for all, null for disabled
See Also:
Validation.getTypeRefs()

getTypeRef

public String getTypeRef()
Access typeRef property.

Returns:
Returns the typeRef in the format dataStoreId:typeName.

setTypeRef

public void setTypeRef(String typeRef)
Set typeRef to typeRef.

Parameters:
typeRef - The typeRef in the format dataStoreId:typeName

validate

public boolean validate(SimpleFeature feature,
                        SimpleFeatureType type,
                        ValidationResults results)
Validation test for feature.

Description of test ...

Specified by:
validate in interface FeatureValidation
Parameters:
feature - The Feature to be validated
type - The FeatureType of the feature
results - The storage for error messages.
Returns:
true if the feature is a valid geometry.
See Also:
FeatureValidation.validate(org.opengis.feature.simple.SimpleFeature, org.opengis.feature.simple.SimpleFeatureType, org.geotools.validation.ValidationResults)

getDefaultLineString

protected LineString getDefaultLineString(SimpleFeature feature)
                                   throws ClassCastException
Retrives a single LineString from feature.getDefaultGeometry.

If feature contains MultiLineString (or GeometryCollection ) of length 1 it will be deemed sufficient. Shapefiles are determined to work with MultiLineStrings of length 1 forcing the creation of this method.

If feature.getDefaultGeometry returns null this method will return null. For most cases the validation should just be abandoned with a warning; the user can separately specify a NullZero check. This will prevent the same error (a null value) being reproted by each and every SpatialValidation test.

Parameters:
feature - Feature
Returns:
feature.getDefaultGeomertry as a LineString, or null
Throws:
ClassCastException - If feature.getDefaultGeometry is the wrong type


Copyright © 1996-2009 Geotools. All Rights Reserved.