|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.io.datastore.sql.wherebuilder.WhereBuilder
public class WhereBuilder
Creates SQL-WHERE clauses from OGC filter expressions (to restrict SQL statements to all stored features that match a given filter).
Also handles the creation of ORDER-BY clauses.
Field Summary | |
---|---|
protected Filter |
filter
Filter for which the corresponding WHERE-clause will be generated. |
protected java.util.List<PropertyPath> |
filterPropertyPaths
|
protected QueryTableTree |
queryTableTree
|
protected MappedFeatureType[] |
rootFts
Targeted feature types. |
protected SortProperty[] |
sortProperties
|
protected java.util.List<PropertyPath> |
sortPropertyPaths
|
protected static int |
SRS_UNDEFINED
|
protected VirtualContentProvider |
vcProvider
|
Constructor Summary | |
---|---|
WhereBuilder(MappedFeatureType[] rootFts,
java.lang.String[] aliases,
Filter filter,
SortProperty[] sortProperties,
TableAliasGenerator aliasGenerator,
VirtualContentProvider vcProvider)
Creates a new WhereBuilder instance. |
Method Summary | |
---|---|
protected void |
appendArithmeticExpressionAsSQL(StatementBuffer query,
ArithmeticExpression expression,
int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendComparisonOperationAsSQL(StatementBuffer query,
ComparisonOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendComplexFilterAsSQL(StatementBuffer query,
ComplexFilter filter)
Appends an SQL fragment for the given object. |
protected void |
appendExpressionAsSQL(StatementBuffer query,
Expression expression,
int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendFeatureFilterAsSQL(StatementBuffer query,
FeatureFilter filter)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendFunctionAsSQL(StatementBuffer query,
Function function,
int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement. |
void |
appendJoinTableList(StatementBuffer query)
Appends the alias-qualified, comma separated list of all tables to be joined in order to represent the associated filter expression (and possibly feature type joins). |
protected void |
appendLiteralAsSQL(StatementBuffer query,
Literal literal,
int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendLogicalOperationAsSQL(StatementBuffer query,
LogicalOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendOperationAsSQL(StatementBuffer query,
Operation operation)
Appends an SQL fragment for the given object to the given sql statement. |
void |
appendOrderByCondition(StatementBuffer query)
Appends an SQL "ORDER BY"-condition that corresponds to the sort properties of the query to the given SQL statement. |
protected void |
appendPropertyIsBetweenOperationAsSQL(StatementBuffer query,
PropertyIsBetweenOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendPropertyIsCOMPOperationAsSQL(StatementBuffer query,
PropertyIsCOMPOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendPropertyIsLikeOperationAsSQL(StatementBuffer query,
PropertyIsLikeOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendPropertyIsNullOperationAsSQL(StatementBuffer query,
PropertyIsNullOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendPropertyNameAsSQL(StatementBuffer query,
PropertyName propertyName)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendPropertyPathAsSQL(StatementBuffer query,
PropertyPath propertyPath)
Appends an SQL fragment for the given object to the given sql statement. |
protected void |
appendSpatialOperationAsSQL(StatementBuffer query,
SpatialOperation operation)
Appends an SQL fragment for the given object to the given sql statement. |
void |
appendWhereCondition(StatementBuffer query)
Appends an SQL WHERE-condition corresponding to the Filter to the given SQL statement. |
protected void |
buildFilterPropertyNameMap()
|
protected void |
fillFunctionNameMap()
Prepares the function map for functions with implementation specific names, e.g. upper case conversion in ORACLE = UPPER(string); POSTGRES = UPPER(string), and MS Access = UCase(string). |
Filter |
getFilter()
Returns the associated Filter instance. |
protected java.lang.String |
getFunctionName(java.lang.String name)
Get the function with the specified name. |
protected MappedGeometryPropertyType |
getGeometryProperty(PropertyName propName)
|
protected int |
getPropertyNameSQLType(PropertyName propertyName)
|
java.lang.String |
getRootTableAlias(int i)
Returns the table alias used for the specified root feature type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int SRS_UNDEFINED
protected MappedFeatureType[] rootFts
protected Filter filter
Filter
for which the corresponding WHERE-clause will be generated.
protected SortProperty[] sortProperties
protected VirtualContentProvider vcProvider
protected QueryTableTree queryTableTree
protected java.util.List<PropertyPath> filterPropertyPaths
protected java.util.List<PropertyPath> sortPropertyPaths
Constructor Detail |
---|
public WhereBuilder(MappedFeatureType[] rootFts, java.lang.String[] aliases, Filter filter, SortProperty[] sortProperties, TableAliasGenerator aliasGenerator, VirtualContentProvider vcProvider) throws DatastoreException
WhereBuilder
instance.
rootFts
- selected feature types, more than one type means that the types are joinedaliases
- aliases for the feature types, may be null (must have same length as rootFts otherwise)filter
- sortProperties
- aliasGenerator
- aliasGenerator to be used to generate table aliases, may be nullvcProvider
-
DatastoreException
Method Detail |
---|
public java.lang.String getRootTableAlias(int i)
i
- index of the requested root feature type
public Filter getFilter()
Filter
instance.
Filter
instanceprotected MappedGeometryPropertyType getGeometryProperty(PropertyName propName)
protected int getPropertyNameSQLType(PropertyName propertyName)
protected void buildFilterPropertyNameMap() throws PropertyPathResolvingException
PropertyPathResolvingException
public void appendJoinTableList(StatementBuffer query)
The list consist of left outer joins ("x LEFT OUTER JOIN y") and cross-product joins ("x,y"):
query
- the list is appended to this SQLStatement
public final void appendWhereCondition(StatementBuffer query) throws DatastoreException
Filter
to the given SQL statement.
query
-
DatastoreException
public void appendOrderByCondition(StatementBuffer query) throws DatastoreException
query
-
DatastoreException
protected void appendComplexFilterAsSQL(StatementBuffer query, ComplexFilter filter) throws DatastoreException
query
- filter
-
DatastoreException
protected void appendOperationAsSQL(StatementBuffer query, Operation operation) throws DatastoreException
query
- operation
-
DatastoreException
protected void appendComparisonOperationAsSQL(StatementBuffer query, ComparisonOperation operation) throws FilterEvaluationException
query
- operation
-
FilterEvaluationException
protected void appendPropertyIsCOMPOperationAsSQL(StatementBuffer query, PropertyIsCOMPOperation operation) throws FilterEvaluationException
query
- operation
-
FilterEvaluationException
protected void appendPropertyIsLikeOperationAsSQL(StatementBuffer query, PropertyIsLikeOperation operation) throws FilterEvaluationException
query
- operation
-
FilterEvaluationException
protected void appendPropertyIsNullOperationAsSQL(StatementBuffer query, PropertyIsNullOperation operation)
query
- operation
- protected void appendPropertyIsBetweenOperationAsSQL(StatementBuffer query, PropertyIsBetweenOperation operation) throws FilterEvaluationException
query
- operation
-
FilterEvaluationException
protected void appendExpressionAsSQL(StatementBuffer query, Expression expression, int targetSqlType) throws FilterEvaluationException
query
- expression
- targetSqlType
- sql type code to be used for literals at the bottom of the expression tree
FilterEvaluationException
protected void appendLiteralAsSQL(StatementBuffer query, Literal literal, int targetSqlType)
query
- literal
- targetSqlType
- protected void appendPropertyNameAsSQL(StatementBuffer query, PropertyName propertyName)
query
- propertyName
- protected void appendPropertyPathAsSQL(StatementBuffer query, PropertyPath propertyPath)
query
- propertyPath
- protected void appendArithmeticExpressionAsSQL(StatementBuffer query, ArithmeticExpression expression, int targetSqlType) throws FilterEvaluationException
query
- expression
- targetSqlType
-
FilterEvaluationException
protected void appendFunctionAsSQL(StatementBuffer query, Function function, int targetSqlType) throws FilterEvaluationException
query
- function
- targetSqlType
-
FilterEvaluationException
protected void appendLogicalOperationAsSQL(StatementBuffer query, LogicalOperation operation) throws DatastoreException
query
- operation
-
DatastoreException
protected void appendFeatureFilterAsSQL(StatementBuffer query, FeatureFilter filter) throws DatastoreException
query
- filter
-
DatastoreException
protected void appendSpatialOperationAsSQL(StatementBuffer query, SpatialOperation operation) throws DatastoreException
query
- operation
-
DatastoreException
protected void fillFunctionNameMap()
protected java.lang.String getFunctionName(java.lang.String name)
name
- the function name
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org