deegree 2.2 (2008/12/22 11:33 build-3038-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: 8138 $, $Date: 2007-09-12 15:52:14 +0200 (Mi, 12 Sep 2007) $
Author:
Christoph Pollmann, last edited by: $Author: apoth $

Field Summary
protected  Filter filter
           
protected  List<PropertyPath> filterPropertyPaths
           
protected static ILogger LOG
           
protected  QueryTableTree queryTableTree
           
protected  MappedFeatureType rootFeatureType
           
 
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 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

LOG

protected static final ILogger LOG

rootFeatureType

protected MappedFeatureType rootFeatureType

filter

protected Filter filter

queryTableTree

protected QueryTableTree queryTableTree

filterPropertyPaths

protected List<PropertyPath> filterPropertyPaths
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:

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:

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:

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 layers)
                                                         throws DatastoreException
Generates an SQL-fragment for the given object.

Parameters:
filter -
layers -
Returns:
Throws:
DatastoreException

deegree 2.2 (2008/12/22 11:33 build-3038-official)

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