| org.geotools.data.jdbc.fidmapper.FIDMapper
All known Subclasses: org.geotools.data.postgis.fidmapper.PostGISAutoIncrementFIDMapper, org.geotools.data.jdbc.fidmapper.AbstractFIDMapper,
FIDMapper | public interface FIDMapper extends Serializable(Code) | |
The FIDMapper interface manages the mapping of feature id to the identifiers
provided in a database.
Basically a FIDMapper must:
-
generate the FID (a String) given the set of values that compose the primary
key in the database
-
turn the FID into the primary key values, or generate them should the FID be
null
-
provide notice wheter the identifier values should be included as attributes
in the feature or not (this is necessary when reverse engineering the
feature type from the database metadata)
-
describe the primary key columns, if any (this is necessary when creating
the table that describes the feature type in a table)
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 author: aaime Andrea Aime |
createID | public String createID(Connection conn, Feature feature, Statement statement) throws IOException(Code) | | 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 Parameters: feature - - the feature that needs the new FID Parameters: statement - - the statement used to insert the feature into thedatabase throws: IOException - |
getColumnCount | public int getColumnCount()(Code) | | Returns the number of columns in the primary keys handled by this mapper
|
getColumnDecimalDigits | public int getColumnDecimalDigits(int colIndex)(Code) | | 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 - |
getColumnName | public String getColumnName(int colIndex)(Code) | | Returns the name of the specified column in the primary key
Parameters: colIndex - |
getColumnSize | public int getColumnSize(int colIndex)(Code) | | 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 - |
getColumnType | public int getColumnType(int colIndex)(Code) | | Returns the column type by using a constant available in the
java.sql.Types interface
Parameters: colIndex - |
getID | public String getID(Object[] attributes)(Code) | | Returns the FID given the values of the prymary key attributes
Parameters: attributes - DOCUMENT ME! |
getPKAttributes | public Object[] getPKAttributes(String FID) throws IOException(Code) | | 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: IOException - |
hasAutoIncrementColumns | public boolean hasAutoIncrementColumns()(Code) | | Returns true if at least one column is of auto-increment type
|
initSupportStructures | public void initSupportStructures()(Code) | | 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.
|
isAutoIncrement | public boolean isAutoIncrement(int colIndex)(Code) | | 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 - |
isVolatile | public boolean isVolatile()(Code) | | 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
|
returnFIDColumnsAsAttributes | public boolean returnFIDColumnsAsAttributes()(Code) | | If true the primary key columns will be returned as attributes. This is
fundamental for primary key with businnes meaning.
|
|
|