public class JoiningJDBCFeatureSource extends JDBCFeatureSource
Modifier and Type | Class and Description |
---|---|
static class |
JoiningJDBCFeatureSource.JoiningFieldEncoder
Field Encoder for converting Filters/Expressions to SQL, will encode table name with field.
|
Modifier and Type | Field and Description |
---|---|
static String |
FOREIGN_ID |
static String |
PRIMARY_KEY |
entry, hints, lock, query, queryCapabilities, schema, transaction
Constructor and Description |
---|
JoiningJDBCFeatureSource(JDBCFeatureSource featureSource) |
JoiningJDBCFeatureSource(JDBCFeatureStore featureStore) |
Modifier and Type | Method and Description |
---|---|
protected void |
addMultiValuedSort(String tableName,
Set<String> orderByFields,
JoiningQuery.QueryJoin join,
StringBuffer sql) |
protected Filter |
aliasFilter(Filter filter,
SimpleFeatureType featureType,
String alias) |
protected static String |
createAlias(String typeName,
Set<String> tableNames) |
protected FilterToSQL |
createFilterToSQL(SimpleFeatureType ft)
Craete the filter to sql converter
|
protected FilterToSQL |
createFilterToSQL(SimpleFeatureType ft,
boolean usePreparedStatementParameters)
Craete the filter to sql converter
|
void |
encodeColumnName(String colName,
String typeName,
StringBuffer sql,
Hints hints)
Encode column name with table name included.
|
void |
encodeColumnName2(String colName,
String typeName,
StringBuffer sql,
Hints hints)
Encode column name with table name included, but do not include schema name (for aliases)
|
protected void |
encodeGeometryColumn(GeometryDescriptor gatt,
String typeName,
StringBuffer sql,
Hints hints)
Encoding a geometry column with respect to hints Supported Hints are provided by
SQLDialect.addSupportedHints(Set) |
protected int |
getCountInternal(Query query)
Calculates the number of features of a specified query.
|
protected SimpleFeatureType |
getFeatureType(SimpleFeatureType origType,
JoiningQuery query) |
FeatureReader<SimpleFeatureType,SimpleFeature> |
getJoiningReaderInternal(JdbcMultipleValue mv,
JoiningQuery query)
Gets a feature reader for a JDBC multivalued mapping.
|
protected FeatureReader<SimpleFeatureType,SimpleFeature> |
getJoiningReaderInternal(JoiningQuery query) |
protected FeatureReader<SimpleFeatureType,SimpleFeature> |
getReaderInternal(Query query)
Subclass method for returning a native reader from the datastore.
|
protected boolean |
isOrUnionReplacementEnabled() |
protected boolean |
isPostgisDialect() |
protected Query |
joinQuery(Query query)
Convenience method for joining a query with the definining query of the feature source.
|
protected Query |
resolvePropertyNames(Query query)
This method changes the query object so that all propertyName references are resolved to
simple attribute names against the schema of the feature source.
|
String |
selectSQL(SimpleFeatureType featureType,
JoiningQuery query,
AtomicReference<PreparedFilterToSQL> toSQLref)
Generates a 'SELECT p1, p2, ...
|
String |
selectSQL(SimpleFeatureType featureType,
JoiningQuery query,
AtomicReference<PreparedFilterToSQL> toSQLref,
boolean isCount)
Generates a 'SELECT p1, p2, ...
|
protected PreparedStatement |
selectSQLPS(SimpleFeatureType featureType,
JoiningQuery query,
Connection cx)
Generates a 'SELECT p1, p2, ...
|
protected void |
sort(JoiningQuery query,
StringBuffer sql,
String[] aliases,
Set<String> pkColumnNames)
Creates ORDER BY for joining query, based on all the sortby's that are specified per joining
table
|
protected void |
sort(String typeName,
String alias,
SortBy[] sort,
Set<String> orderByFields,
StringBuffer sql)
Create order by field for specific table name
|
addHints, buildFeatureType, buildQueryCapabilities, canFilter, canLimit, canOffset, canRetype, canSort, canTransact, getBoundsInternal, getDataStore, getPrimaryKey, getState, handleVisitor, isExposePrimaryKeyColumns, setExposePrimaryKeyColumns
accepts, addFeatureListener, canEvent, canLock, canReproject, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getEntry, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getReader, getReader, getReader, getSchema, getSupportedHints, getTransaction, getView, getView, isView, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, resolvePropertyNames, setFeatureLock, setTransaction, unLockFeatures, unLockFeatures, unLockFeatures
public static final String FOREIGN_ID
public static final String PRIMARY_KEY
public JoiningJDBCFeatureSource(JDBCFeatureSource featureSource) throws IOException
IOException
public JoiningJDBCFeatureSource(JDBCFeatureStore featureStore) throws IOException
IOException
protected void encodeGeometryColumn(GeometryDescriptor gatt, String typeName, StringBuffer sql, Hints hints) throws SQLException
SQLDialect.addSupportedHints(Set)
hints
- , may be nullSQLException
protected void sort(String typeName, String alias, SortBy[] sort, Set<String> orderByFields, StringBuffer sql) throws IOException, SQLException
IOException
SQLException
protected void addMultiValuedSort(String tableName, Set<String> orderByFields, JoiningQuery.QueryJoin join, StringBuffer sql) throws IOException, FilterToSQLException, SQLException
protected void sort(JoiningQuery query, StringBuffer sql, String[] aliases, Set<String> pkColumnNames) throws IOException, SQLException, FilterToSQLException
public void encodeColumnName(String colName, String typeName, StringBuffer sql, Hints hints) throws SQLException
SQLException
public void encodeColumnName2(String colName, String typeName, StringBuffer sql, Hints hints) throws SQLException
SQLException
protected FilterToSQL createFilterToSQL(SimpleFeatureType ft)
protected FilterToSQL createFilterToSQL(SimpleFeatureType ft, boolean usePreparedStatementParameters)
public String selectSQL(SimpleFeatureType featureType, JoiningQuery query, AtomicReference<PreparedFilterToSQL> toSQLref) throws SQLException, IOException, FilterToSQLException
featureType
- the feature type that the query must return (may contain less attributes
than the native one)query
- the query to be run. The type name and property will be ignored, as they are
supposed to have been already embedded into the provided feature typetoSQLref
- atomic reference to a FilterToSQL able to works with PreparedStament
parametersSQLException
IOException
FilterToSQLException
public String selectSQL(SimpleFeatureType featureType, JoiningQuery query, AtomicReference<PreparedFilterToSQL> toSQLref, boolean isCount) throws IOException, SQLException, FilterToSQLException
featureType
- the feature type that the query must return (may contain less attributes
than the native one)query
- the query to be run. The type name and property will be ignored, as they are
supposed to have been already embedded into the provided feature typetoSQLref
- atomic reference to a FilterToSQL able to works with PreparedStament
parametersisCount
- avoid the encoding of unnecessary SQL pieces when a count query is neededIOException
SQLException
FilterToSQLException
protected PreparedStatement selectSQLPS(SimpleFeatureType featureType, JoiningQuery query, Connection cx) throws SQLException, IOException, FilterToSQLException
featureType
- the feature type that the query must return (may contain less attributes
than the native one)query
- the query to be run. The type name and property will be ignored, as they are
supposed to have been already embedded into the provided feature typecx
- The database connection to be used to create the prepared statementSQLException
IOException
FilterToSQLException
protected SimpleFeatureType getFeatureType(SimpleFeatureType origType, JoiningQuery query) throws IOException
IOException
protected FeatureReader<SimpleFeatureType,SimpleFeature> getJoiningReaderInternal(JoiningQuery query) throws IOException
IOException
public FeatureReader<SimpleFeatureType,SimpleFeature> getJoiningReaderInternal(JdbcMultipleValue mv, JoiningQuery query) throws IOException
IOException
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
ContentFeatureSource
It is important to note that if the native reader intends to handle any of the following natively:
true
:
ContentFeatureSource.canReproject()
- handles Query.getCoordinateSystemReproject()
internally.
Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter()
- handles Query#getFilter() internally.getReaderInternal
in class JDBCFeatureSource
IOException
protected Query resolvePropertyNames(Query query)
ContentFeatureSource
For example, this method ensures that propertyName's such as "gml:name" are rewritten as simply "name".
resolvePropertyNames
in class ContentFeatureSource
protected Query joinQuery(Query query)
ContentFeatureSource
joinQuery
in class ContentFeatureSource
protected Filter aliasFilter(Filter filter, SimpleFeatureType featureType, String alias)
protected boolean isPostgisDialect()
protected boolean isOrUnionReplacementEnabled()
protected int getCountInternal(Query query) throws IOException
ContentFeatureSource
getCountInternal
in class JDBCFeatureSource
IOException
Copyright © 1996–2021 Geotools. All rights reserved.