org.geotools.data.postgis.fidmapper
Class PostGISAutoIncrementFIDMapper

java.lang.Object
  extended by org.geotools.data.jdbc.fidmapper.AbstractFIDMapper
      extended by org.geotools.data.jdbc.fidmapper.AutoIncrementFIDMapper
          extended by org.geotools.data.postgis.fidmapper.PostGISAutoIncrementFIDMapper
All Implemented Interfaces:
java.io.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

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

Constructor Detail

PostGISAutoIncrementFIDMapper

public PostGISAutoIncrementFIDMapper(java.lang.String tableSchemaName,
                                     java.lang.String tableName,
                                     java.lang.String colName,
                                     int dataType)

PostGISAutoIncrementFIDMapper

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

createID

public java.lang.String createID(java.sql.Connection conn,
                                 org.opengis.feature.simple.SimpleFeature feature,
                                 java.sql.Statement statement)
                          throws java.io.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:
java.io.IOException
See Also:
org.geotools.data.jdbc.fidmapper.FIDMapper#createID(java.sql.Connection, org.geotools.feature.Feature, Statement)

retriveId

public java.lang.String retriveId(java.sql.Connection conn,
                                  org.opengis.feature.simple.SimpleFeature feature,
                                  java.sql.Statement statement)
                           throws java.io.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:
java.io.IOException


Copyright © 1996-2010 Geotools. All Rights Reserved.