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 PostGISDialectpgDialect-
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 Stringcast(String encodedProperty, Class target)Gives the opportunity to subclasses to force the property to the desired type.protected FilterCapabilitiescreateFilterCapabilities()Sets the capabilities of this filter.doublegetDistanceInNativeUnits(DistanceBufferOperator operator)Rough evaluation of distance in the units of the current SRID, assuming that the SRID maps to a known EPSG code.protected StringgetFunctionName(Function function)Maps the function to the native database function namebooleanisEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)booleanisLooseBBOXEnabled()protected voidprocessLikeLeftOperand(Object extraData, boolean matchCase, Expression att, Class attributeType)voidsetEncodeBBOXFilterAsEnvelope(boolean encodeBBOXFilterAsEnvelope)voidsetFunctionEncodingEnabled(boolean functionEncodingEnabled)voidsetLooseBBOXEnabled(boolean looseBBOXEnabled)Objectvisit(Function function, Object extraData)Writes sql for a function expression.Objectvisit(Literal literal, Object extraData)Export the contents of a Literal ExpresionObjectvisit(PropertyIsBetween filter, Object extraData)Writes the SQL for the PropertyIsBetween Filter.Objectvisit(PropertyIsEqualTo filter, Object extraData)Write the SQL for this kind of filterprotected voidvisitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData)Overrides base behavior to handler arraysprotected ObjectvisitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData)Handles the more general case of two generic expressions.protected ObjectvisitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData)Handles the common case of a PropertyName,Literal geometry binary spatial operator.protected voidvisitLiteralGeometry(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:FilterToSQLSubclasses must implement this method in order to encode geometry filters according to the specific database implementation- Overrides:
visitLiteralGeometryin classFilterToSQL- Throws:
IOException
-
createFilterCapabilities
protected FilterCapabilities createFilterCapabilities()
Description copied from class:FilterToSQLSets the capabilities of this filter.- Overrides:
createFilterCapabilitiesin classFilterToSQL- Returns:
- FilterCapabilities for this Filter
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData)
Description copied from class:FilterToSQLHandles the common case of a PropertyName,Literal geometry binary spatial operator.- Overrides:
visitBinarySpatialOperatorin classFilterToSQL
-
visitBinarySpatialOperator
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData)
Description copied from class:FilterToSQLHandles the more general case of two generic expressions.The most common case is two PropertyName expressions, which happens during a spatial join.
- Overrides:
visitBinarySpatialOperatorin classFilterToSQL
-
visit
public Object visit(Function function, Object extraData) throws RuntimeException
Description copied from class:FilterToSQLWrites 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:
visitin interfaceExpressionVisitor- Overrides:
visitin 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:FilterToSQLExport the contents of a Literal Expresion- Specified by:
visitin interfaceExpressionVisitor- Overrides:
visitin classFilterToSQL- Parameters:
literal- the Literal to export
-
getFunctionName
protected String getFunctionName(Function function)
Description copied from class:FilterToSQLMaps the function to the native database function name- Overrides:
getFunctionNamein classFilterToSQL
-
cast
protected String cast(String encodedProperty, Class target) throws IOException
Description copied from class:FilterToSQLGives 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:
castin classFilterToSQL- Throws:
IOException
-
setFunctionEncodingEnabled
public void setFunctionEncodingEnabled(boolean functionEncodingEnabled)
-
getDistanceInNativeUnits
public double getDistanceInNativeUnits(DistanceBufferOperator operator)
Description copied from class:FilterToSQLRough 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:
getDistanceInNativeUnitsin classFilterToSQL
-
visitBinaryComparisonOperator
protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData) throws RuntimeException
Overrides base behavior to handler arrays- Overrides:
visitBinaryComparisonOperatorin 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:
visitin interfaceFilterVisitor- Overrides:
visitin 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:FilterToSQLWrite the SQL for this kind of filter- Specified by:
visitin interfaceFilterVisitor- Overrides:
visitin classFilterToSQL- Parameters:
filter- the filter to visitextraData- extra data (unused by this method)
-
processLikeLeftOperand
protected void processLikeLeftOperand(Object extraData, boolean matchCase, Expression att, Class attributeType) throws IOException
- Overrides:
processLikeLeftOperandin classFilterToSQL- Throws:
IOException
-
-