org.geotools.data.postgis.fidmapper
Class PostGISAutoIncrementFIDMapper

Object
  extended by AbstractFIDMapper
      extended by AutoIncrementFIDMapper
          extended by PostGISAutoIncrementFIDMapper
All Implemented Interfaces:
Serializable, FIDMapper

public class PostGISAutoIncrementFIDMapper
extends AutoIncrementFIDMapper
implements FIDMapper

Generate FID based on an auto increment function, the most stable approach for use with editing.

Author:
Jesse Eichar, Refractions Research, Inc., Cory Horner, Refractions Research, Inc.
See Also:
Serialized Form
Module:
modules/plugin/postgis (gt-postgis.jar)

Field Summary
 
Fields inherited from class AbstractFIDMapper
autoIncrement, colDecimalDigits, colNames, colSizes, colTypes, returnFIDColumnsAsAttributes, tableName, tableSchemaName
 
Constructor Summary
PostGISAutoIncrementFIDMapper(String tableName, String colName, int dataType, boolean returnFIDColumnsAsAttributes)
           
PostGISAutoIncrementFIDMapper(String tableSchemaName, String tableName, String colName, int dataType)
           
 
Method Summary
 String createID(Connection conn, SimpleFeature feature, Statement statement)
          Creates a new ID for a feature.
 String retriveId(Connection conn, SimpleFeature feature, Statement statement)
          Attempts to determine the FID after it was inserted, using four techniques: 1.
 
Methods inherited from class AutoIncrementFIDMapper
getID, getPKAttributes, isValid
 
Methods inherited from class AbstractFIDMapper
getColumnCount, getColumnDecimalDigits, getColumnDecimalDigits, getColumnName, getColumnName, getColumnSize, getColumnSize, getColumnType, getColumnType, getTableName, getTableSchemaName, hasAutoIncrementColumns, initSupportStructures, isAutoIncrement, isAutoIncrement, isVolatile, returnFIDColumnsAsAttributes, setInfo, toString
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface FIDMapper
getColumnCount, getColumnDecimalDigits, getColumnName, getColumnSize, getColumnType, getID, getPKAttributes, hasAutoIncrementColumns, initSupportStructures, isAutoIncrement, isValid, isVolatile, returnFIDColumnsAsAttributes
 

Constructor Detail

PostGISAutoIncrementFIDMapper

public PostGISAutoIncrementFIDMapper(String tableSchemaName,
                                     String tableName,
                                     String colName,
                                     int dataType)

PostGISAutoIncrementFIDMapper

public PostGISAutoIncrementFIDMapper(String tableName,
                                     String colName,
                                     int dataType,
                                     boolean returnFIDColumnsAsAttributes)
Method Detail

createID

public String createID(Connection conn,
                       SimpleFeature feature,
                       Statement statement)
                throws IOException
Description copied from interface: FIDMapper
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).

Specified by:
createID in interface FIDMapper
Overrides:
createID in class AutoIncrementFIDMapper
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:
IOException
See Also:
org.geotools.data.jdbc.fidmapper.FIDMapper#createID(java.sql.Connection, org.geotools.feature.Feature, Statement)

retriveId

public String retriveId(Connection conn,
                        SimpleFeature feature,
                        Statement statement)
                 throws IOException
Attempts to determine the FID after it was inserted, using four techniques: 1. SELECT currval(pg_get_serial_sequence(...)) 2. SELECT currval(sequence name) <-- using other methods to get name 3. SELECT fid ... ORDER BY fid DESC LIMIT 1

Throws:
IOException


Copyright © 1996-2010 Geotools. All Rights Reserved.