org.geotools.data.jdbc.fidmapper
Interface FIDMapper

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
VersionedFIDMapper
All Known Implementing Classes:
AbstractFIDMapper, AutoIncrementFIDMapper, BasicFIDMapper, MaxIncFIDMapper, MultiColumnFIDMapper, NullFIDMapper, OIDFidMapper, PostGISAutoIncrementFIDMapper, TypedFIDMapper, UUIDFIDMapper

Deprecated. scheduled for removal in 2.7, use classes in org.geotools.jdbc

public interface FIDMapper
extends java.io.Serializable

The FIDMapper interface manages the mapping of feature id to the identifiers provided in a database.

Basically a FIDMapper must:

Concrete instances of this class should provide support for the most common primary key mapping and generation strategis, such as pk with business meaning, serials, sequences, and so on

Classes that implement this interface should ovveride equals to provide a state based comparison.

Author:
Dani Daniele Franzoni, aaime Andrea Aime

Method Summary
 java.lang.String createID(java.sql.Connection conn, org.opengis.feature.simple.SimpleFeature feature, java.sql.Statement statement)
          Deprecated. Creates a new ID for a feature.
 int getColumnCount()
          Deprecated. Returns the number of columns in the primary keys handled by this mapper
 int getColumnDecimalDigits(int colIndex)
          Deprecated. Provides the number of decimal digits for this column.
 java.lang.String getColumnName(int colIndex)
          Deprecated. Returns the name of the specified column in the primary key
 int getColumnSize(int colIndex)
          Deprecated. Returns the size of a primary key column as it would be provided by the database metadata.
 int getColumnType(int colIndex)
          Deprecated. Returns the column type by using a constant available in the java.sql.Types interface
 java.lang.String getID(java.lang.Object[] attributes)
          Deprecated. Returns the FID given the values of the prymary key attributes
 java.lang.Object[] getPKAttributes(java.lang.String FID)
          Deprecated. Creates the value for the PK attributes given the feature.
 boolean hasAutoIncrementColumns()
          Deprecated. Returns true if at least one column is of auto-increment type
 void initSupportStructures()
          Deprecated. This method will be called by JDBCDataStore when creating new tables to give the FID mapper an opportunity to initialize needed data structures, such as support tables, sequences, and so on.
 boolean isAutoIncrement(int colIndex)
          Deprecated. Returns true if the column is of serial type, that is, its value is automatically generated by the database if the user does not provide one
 boolean isValid(java.lang.String fid)
          Deprecated. Provides a simple means of assessing if a feature id is structurally valid with respect to the fids this FIDMapper creates.
 boolean isVolatile()
          Deprecated. Returns true it the FID generated by this mapper are volatile, that is, if asking twice for the same Feature will not provide the same FID.
 boolean returnFIDColumnsAsAttributes()
          Deprecated. If true the primary key columns will be returned as attributes.
 

Method Detail

initSupportStructures

void initSupportStructures()
Deprecated. 
This method will be called by JDBCDataStore when creating new tables to give the FID mapper an opportunity to initialize needed data structures, such as support tables, sequences, and so on.


getID

java.lang.String getID(java.lang.Object[] attributes)
Deprecated. 
Returns the FID given the values of the prymary key attributes

Parameters:
attributes - DOCUMENT ME!

getPKAttributes

java.lang.Object[] getPKAttributes(java.lang.String FID)
                                   throws java.io.IOException
Deprecated. 
Creates the value for the PK attributes given the feature. If the FID is null, will throw an IOException if not possible. If null is returned, no primary key value needs to be specified, which is what we want for auto-increment fields.

Parameters:
FID - The feature ID is going to be parsed
Throws:
java.io.IOException

createID

java.lang.String createID(java.sql.Connection conn,
                          org.opengis.feature.simple.SimpleFeature feature,
                          java.sql.Statement statement)
                          throws java.io.IOException
Deprecated. 
Creates a new ID for a feature.
This is done either by querying the database (for auto-increment like types, for example sequences) or by inspecting the Feature (for example, for primary keys with business meaning that whose attributes are included in the Feature ones).

Parameters:
conn - - the database connection
feature - - the feature that needs the new FID
statement - - the statement used to insert the feature into the database
Throws:
java.io.IOException

returnFIDColumnsAsAttributes

boolean returnFIDColumnsAsAttributes()
Deprecated. 
If true the primary key columns will be returned as attributes. This is fundamental for primary key with businnes meaning.


getColumnCount

int getColumnCount()
Deprecated. 
Returns the number of columns in the primary keys handled by this mapper


getColumnName

java.lang.String getColumnName(int colIndex)
Deprecated. 
Returns the name of the specified column in the primary key

Parameters:
colIndex -

getColumnType

int getColumnType(int colIndex)
Deprecated. 
Returns the column type by using a constant available in the java.sql.Types interface

Parameters:
colIndex -

getColumnSize

int getColumnSize(int colIndex)
Deprecated. 
Returns the size of a primary key column as it would be provided by the database metadata. Some fields requires a size specification, such as VARCHAR or NUMBER, whilst other don't have or don't need it (for example, an INTEGER or a TEXT field).

Parameters:
colIndex -

getColumnDecimalDigits

int getColumnDecimalDigits(int colIndex)
Deprecated. 
Provides the number of decimal digits for this column. This is relevant in particular when the column is a scaled integer such as a NUMBER column

Parameters:
colIndex -

isAutoIncrement

boolean isAutoIncrement(int colIndex)
Deprecated. 
Returns true if the column is of serial type, that is, its value is automatically generated by the database if the user does not provide one

Parameters:
colIndex -

hasAutoIncrementColumns

boolean hasAutoIncrementColumns()
Deprecated. 
Returns true if at least one column is of auto-increment type


isVolatile

boolean isVolatile()
Deprecated. 
Returns true it the FID generated by this mapper are volatile, that is, if asking twice for the same Feature will not provide the same FID.

This is usually true for mappers that try to generate a FID for tables without primary keys.

When this method returns true, it's up to the datastore to decide what to do, but a sane policy may be to prevent Feature writing


isValid

boolean isValid(java.lang.String fid)
Deprecated. 
Provides a simple means of assessing if a feature id is structurally valid with respect to the fids this FIDMapper creates.

The primary purpose of this method is to help in filtering out fids from filters that are not appropriate for a given FeatureType but that may otherwise being treated as valid if they get down to the actual SQL query.

The validity check may be as strict or as loose as the concrete FIDMapper wishes, since there may be cases where whether a fid in a filter is valid or not is not that important, or where it may result in deleting a Feature that was not expected to be deleted.

An example of such a need for validation may be a feature id composed like <featureTypeName>.<number>, where the actual table PK is just the <number> part. If a request over the FeatureType "ft1" is made with a fid filter like ft2.1, this method can ensure the number 1 is not send out in the SQL query at all.

Parameters:
fid - a feature id to check for structural validity
Returns:
true if the structure fid indicates it is a valid feature id for the FeatureType this FIDMapper works for, false otherwise.


Copyright © 1996-2010 Geotools. All Rights Reserved.