Package org.geotools.data.postgis
Class PostgisFilterToSQL
- Object
-
- FilterToSQL
-
- PostgisFilterToSQL
-
- All Implemented Interfaces:
ExpressionVisitor
,FilterVisitor
public class PostgisFilterToSQL extends FilterToSQL
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class FilterToSQL
FilterToSQL.FieldEncoder
-
-
Field Summary
Fields Modifier and Type Field Description protected PostGISDialect
pgDialect
-
Fields inherited from class FilterToSQL
capabilities, currentDimension, currentGeometry, currentSRID, databaseSchema, encodingFunction, escapeBackslash, featureType, fieldEncoder, filterFactory, inEncodingEnabled, inline, IO_ERROR, LOGGER, out, primaryKey, sqlNameEscape
-
-
Constructor Summary
Constructors Constructor Description PostgisFilterToSQL(PostGISDialect dialect)
PostgisFilterToSQL(PostGISDialect dialect, Version pgVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
cast(String encodedProperty, Class target)
Gives the opportunity to subclasses to force the property to the desired type.protected FilterCapabilities
createFilterCapabilities()
Sets the capabilities of this filter.double
getDistanceInNativeUnits(DistanceBufferOperator operator)
Rough evaluation of distance in the units of the current SRID, assuming that the SRID maps to a known EPSG code.protected String
getFunctionName(Function function)
Maps the function to the native database function nameboolean
isEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)
boolean
isLooseBBOXEnabled()
void
setEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)
void
setFunctionEncodingEnabled(boolean functionEncodingEnabled)
void
setLooseBBOXEnabled(boolean looseBBOXEnabled)
Object
visit(Function function, Object extraData)
Writes sql for a function expression.Object
visit(Literal literal, Object extraData)
Export the contents of a Literal ExpresionObject
visit(PropertyIsBetween filter, Object extraData)
Writes the SQL for the PropertyIsBetween Filter.Object
visit(PropertyIsEqualTo filter, Object extraData)
Write the SQL for this kind of filterprotected void
visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData)
Overrides base behavior to handler arraysprotected Object
visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData)
Handles the more general case of two generic expressions.protected Object
visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData)
Handles the common case of a PropertyName,Literal geometry binary spatial operator.protected void
visitLiteralGeometry(Literal expression)
Subclasses must implement this method in order to encode geometry filters according to the specific database implementation-
Methods inherited from class FilterToSQL
encode, encode, encodeBinaryComparisonOperator, encodeToString, encodeToString, escapeLiteral, escapeName, evaluateLiteral, getCapabilities, getDatabaseSchema, getExpressionType, getFeatureType, getFunctionReturnType, getParameter, getPrimaryKey, getSqlNameEscape, isBinaryExpression, isEscapeBackslash, isInEncodingEnabled, setCapabilities, setDatabaseSchema, setEscapeBackslash, setFeatureType, setFieldEncoder, setInEncodingEnabled, setInline, setPrimaryKey, setSqlNameEscape, setWriter, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitBinarySpatialOperator, visitBinaryTemporalOperator, visitBinaryTemporalOperator, visitBinaryTemporalOperator, visitInFunction, visitLiteralTimePeriod, visitNullFilter, writeBinaryExpression, writeBinaryExpressionMember, writeLiteral
-
-
-
-
Field Detail
-
pgDialect
protected PostGISDialect pgDialect
-
-
Constructor Detail
-
PostgisFilterToSQL
public PostgisFilterToSQL(PostGISDialect dialect)
-
PostgisFilterToSQL
public PostgisFilterToSQL(PostGISDialect dialect, Version pgVersion)
-
-
Method Detail
-
isLooseBBOXEnabled
public boolean isLooseBBOXEnabled()
-
setLooseBBOXEnabled
public void setLooseBBOXEnabled(boolean looseBBOXEnabled)
-
isEncodeBBOXFilterAsEnvelope
public boolean isEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)
-
setEncodeBBOXFilterAsEnvelope
public void setEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)
-
visitLiteralGeometry
protected void visitLiteralGeometry(Literal expression) throws IOException
Description copied from class:FilterToSQL
Subclasses must implement this method in order to encode geometry filters according to the specific database implementation- Overrides:
visitLiteralGeometry
in classFilterToSQL
- Throws:
IOException
-
createFilterCapabilities
protected FilterCapabilities createFilterCapabilities()
Description copied from class:FilterToSQL
Sets the capabilities of this filter.- Overrides:
createFilterCapabilities
in classFilterToSQL
- Returns:
- FilterCapabilities for this Filter
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData)
Description copied from class:FilterToSQL
Handles the common case of a PropertyName,Literal geometry binary spatial operator.- Overrides:
visitBinarySpatialOperator
in classFilterToSQL
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData)
Description copied from class:FilterToSQL
Handles the more general case of two generic expressions.The most common case is two PropertyName expressions, which happens during a spatial join.
- Overrides:
visitBinarySpatialOperator
in classFilterToSQL
-
visit
public Object visit(Function function, Object extraData) throws RuntimeException
Description copied from class:FilterToSQL
Writes sql for a function expression. By default it will write the call by using the same arguments provided to the GeoTools function, subclasses should override on a case by case basis if this behavior is not the desired one.- Specified by:
visit
in interfaceExpressionVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
function
- a function expression- Throws:
RuntimeException
- If an IO error occurs.- See Also:
FilterToSQL.getFunctionName(Function)
-
visit
public Object visit(Literal literal, Object extraData)
Description copied from class:FilterToSQL
Export the contents of a Literal Expresion- Specified by:
visit
in interfaceExpressionVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
literal
- the Literal to export
-
getFunctionName
protected String getFunctionName(Function function)
Description copied from class:FilterToSQL
Maps the function to the native database function name- Overrides:
getFunctionName
in classFilterToSQL
-
cast
protected String cast(String encodedProperty, Class target) throws IOException
Description copied from class:FilterToSQL
Gives the opportunity to subclasses to force the property to the desired type. By default it simply writes out the property as-is (the property must be already escaped).- Overrides:
cast
in classFilterToSQL
- Throws:
IOException
-
setFunctionEncodingEnabled
public void setFunctionEncodingEnabled(boolean functionEncodingEnabled)
-
getDistanceInNativeUnits
public double getDistanceInNativeUnits(DistanceBufferOperator operator)
Description copied from class:FilterToSQL
Rough evaluation of distance in the units of the current SRID, assuming that the SRID maps to a known EPSG code. Will use a rather imprecise transformation for distances over degrees, but better than nothing.- Overrides:
getDistanceInNativeUnits
in classFilterToSQL
-
visitBinaryComparisonOperator
protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData) throws RuntimeException
Overrides base behavior to handler arrays- Overrides:
visitBinaryComparisonOperator
in classFilterToSQL
- Parameters:
filter
- the comparison to be turned into SQL.- Throws:
RuntimeException
- for io exception with writer
-
visit
public Object visit(PropertyIsBetween filter, Object extraData) throws RuntimeException
Writes the SQL for the PropertyIsBetween Filter.- Specified by:
visit
in interfaceFilterVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
filter
- the Filter to be visited.- Throws:
RuntimeException
- for io exception with writer
-
visit
public Object visit(PropertyIsEqualTo filter, Object extraData)
Description copied from class:FilterToSQL
Write the SQL for this kind of filter- Specified by:
visit
in interfaceFilterVisitor
- Overrides:
visit
in classFilterToSQL
- Parameters:
filter
- the filter to visitextraData
- extra data (unused by this method)
-
-