deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.io.datastore.sde
Class SDEWhereBuilder

java.lang.Object
  extended by org.deegree.io.datastore.sde.SDEWhereBuilder

public class SDEWhereBuilder
extends Object

WhereBuilder implementation for ArcSDE.

Version:
$Revision: 12183 $, $Date: 2008-06-05 11:17:23 +0200 (Do, 05. Jun 2008) $
Author:
Christoph Pollmann, last edited by: $Author: rbezema $

Field Summary
protected  Filter filter
          The filter to apply
protected  List<PropertyPath> filterPropertyPaths
          The filter property paths
protected  QueryTableTree queryTableTree
          The query
protected  MappedFeatureType rootFeatureType
          the root feature type
 
Constructor Summary
SDEWhereBuilder(MappedFeatureType[] rootFts, String[] aliases, Filter filter, TableAliasGenerator aliasGenerator)
          Creates a new instance of SDEWhereBuilder for the given parameters.
 
Method Summary
protected  void appendArithmeticExpressionAsSQL(StringBuffer query, ArithmeticExpression expression, int targetSqlType)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendComparisonOperationAsSQL(StringBuffer query, ComparisonOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendComplexFilterAsSQL(StringBuffer query, ComplexFilter filter)
          Appends an SQL fragment for the given object.
protected  void appendExpressionAsSQL(StringBuffer query, Expression expression, int targetSqlType)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendFeatureFilterAsSQL(StringBuffer query, FeatureFilter filter)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendFunctionAsSQL(StringBuffer query, Function function, int targetSqlType)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendLiteralAsSQL(StringBuffer query, Literal literal, int targetSqlType)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendLogicalOperationAsSQL(StringBuffer query, LogicalOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendOperationAsSQL(StringBuffer query, Operation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendPropertyIsBetweenOperationAsSQL(StringBuffer query, PropertyIsBetweenOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendPropertyIsCOMPOperationAsSQL(StringBuffer query, PropertyIsCOMPOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendPropertyIsLikeOperationAsSQL(StringBuffer query, PropertyIsLikeOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendPropertyIsNullOperationAsSQL(StringBuffer query, PropertyIsNullOperation operation)
          Appends an SQL fragment for the given object to the given sql statement.
protected  void appendPropertyNameAsSQL(StringBuffer query, PropertyName propertyName)
          Appends an SQL fragment for the given object to the given sql statement.
 void appendWhereCondition(StringBuffer whereCondition)
          Appends the SQL condition from the Filter to the given sql statement.
protected  void buildFilterPropertyNameMap()
           
protected  com.esri.sde.sdk.client.SeFilter[] buildSpatialFilter(ComplexFilter filter, List<com.esri.sde.sdk.client.SeLayer> layers)
          Generates an SQL-fragment for the given object.
 Filter getFilter()
           
protected  int getInternalSRS(SpatialOperation operation)
          Returns the internal (database specific) SRS code used in the geometry field of the given SpatialOperation.
protected  MappingField getPropertyNameMapping(PropertyName propertyName)
          Appends an SQL fragment for the given object to the given sql statement.
protected  int getPropertyNameSQLType(PropertyName propertyName)
           
 String getRootTableAlias()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootFeatureType

protected MappedFeatureType rootFeatureType
the root feature type


filter

protected Filter filter
The filter to apply


queryTableTree

protected QueryTableTree queryTableTree
The query


filterPropertyPaths

protected List<PropertyPath> filterPropertyPaths
The filter property paths

Constructor Detail

SDEWhereBuilder

public SDEWhereBuilder(MappedFeatureType[] rootFts,
                       String[] aliases,
                       Filter filter,
                       TableAliasGenerator aliasGenerator)
                throws DatastoreException
Creates a new instance of SDEWhereBuilder for the given parameters.

Parameters:
rootFts - selected feature types, more than one type means that the types are joined
aliases - aliases for the feature types, may be null (must have same length as rootFts otherwise)
filter -
aliasGenerator -
Throws:
DatastoreException
Method Detail

getRootTableAlias

public String getRootTableAlias()
Returns:
the alias

getFilter

public Filter getFilter()
Returns:
filter

getInternalSRS

protected int getInternalSRS(SpatialOperation operation)
Returns the internal (database specific) SRS code used in the geometry field of the given SpatialOperation.

Parameters:
operation - SpatialOperation for which the internal SRS is needed
Returns:
the internal (database specific) SRS code.

getPropertyNameSQLType

protected int getPropertyNameSQLType(PropertyName propertyName)
Parameters:
propertyName -
Returns:
the type of the property name as an int

buildFilterPropertyNameMap

protected void buildFilterPropertyNameMap()
                                   throws PropertyPathResolvingException
Throws:
PropertyPathResolvingException

appendWhereCondition

public final void appendWhereCondition(StringBuffer whereCondition)
Appends the SQL condition from the Filter to the given sql statement.

Parameters:
whereCondition -

appendComplexFilterAsSQL

protected void appendComplexFilterAsSQL(StringBuffer query,
                                        ComplexFilter filter)
Appends an SQL fragment for the given object.

Parameters:
query -
filter -

appendOperationAsSQL

protected void appendOperationAsSQL(StringBuffer query,
                                    Operation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendComparisonOperationAsSQL

protected void appendComparisonOperationAsSQL(StringBuffer query,
                                              ComparisonOperation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendPropertyIsCOMPOperationAsSQL

protected void appendPropertyIsCOMPOperationAsSQL(StringBuffer query,
                                                  PropertyIsCOMPOperation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendPropertyIsLikeOperationAsSQL

protected void appendPropertyIsLikeOperationAsSQL(StringBuffer query,
                                                  PropertyIsLikeOperation operation)
Appends an SQL fragment for the given object to the given sql statement. Replacing and escape handling is based on a finite automaton with 2 states:

(escapeMode)

NOTE: Currently, the method uses a quirk and appends the generated argument inline, i.e. not using query.addArgument(). This is because of a problem that occurred for example in Postgresql; the execution of the inline version is *much* faster (at least with version 8.0).

Parameters:
query -
operation -

appendPropertyIsNullOperationAsSQL

protected void appendPropertyIsNullOperationAsSQL(StringBuffer query,
                                                  PropertyIsNullOperation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendPropertyIsBetweenOperationAsSQL

protected void appendPropertyIsBetweenOperationAsSQL(StringBuffer query,
                                                     PropertyIsBetweenOperation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendExpressionAsSQL

protected void appendExpressionAsSQL(StringBuffer query,
                                     Expression expression,
                                     int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
expression -
targetSqlType - sql type code to be used for literals at the bottom of the expression tree

appendLiteralAsSQL

protected void appendLiteralAsSQL(StringBuffer query,
                                  Literal literal,
                                  int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
literal -
targetSqlType -

getPropertyNameMapping

protected MappingField getPropertyNameMapping(PropertyName propertyName)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
propertyName -
Returns:
the field mapped from the propertyname

appendPropertyNameAsSQL

protected void appendPropertyNameAsSQL(StringBuffer query,
                                       PropertyName propertyName)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
propertyName -

appendArithmeticExpressionAsSQL

protected void appendArithmeticExpressionAsSQL(StringBuffer query,
                                               ArithmeticExpression expression,
                                               int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
expression -
targetSqlType -

appendFunctionAsSQL

protected void appendFunctionAsSQL(StringBuffer query,
                                   Function function,
                                   int targetSqlType)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
function -
targetSqlType -

appendLogicalOperationAsSQL

protected void appendLogicalOperationAsSQL(StringBuffer query,
                                           LogicalOperation operation)
Appends an SQL fragment for the given object to the given sql statement.

Parameters:
query -
operation -

appendFeatureFilterAsSQL

protected void appendFeatureFilterAsSQL(StringBuffer query,
                                        FeatureFilter filter)
Appends an SQL fragment for the given object to the given sql statement. TODO Handle compound primary keys correctly.

Parameters:
query -
filter -

buildSpatialFilter

protected com.esri.sde.sdk.client.SeFilter[] buildSpatialFilter(ComplexFilter filter,
                                                                List<com.esri.sde.sdk.client.SeLayer> layers)
                                                         throws DatastoreException
Generates an SQL-fragment for the given object.

Parameters:
filter -
layers -
Returns:
the complex filters as se filters.
Throws:
DatastoreException

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org