org.geotools.data.jdbc.fidmapper
Class AbstractFIDMapper

Object
  extended by AbstractFIDMapper
All Implemented Interfaces:
Serializable, FIDMapper
Direct Known Subclasses:
AutoIncrementFIDMapper, BasicFIDMapper, MaxIncFIDMapper, MultiColumnFIDMapper, NullFIDMapper, OIDFidMapper, TypedFIDMapper

public abstract class AbstractFIDMapper
extends Object
implements FIDMapper

Abstract implementation providing common methods that usually are coded the same way in all fid mappers.

Author:
wolf
See Also:
Serialized Form
Module:

Field Summary
protected  boolean[] autoIncrement
           
protected  int[] colDecimalDigits
           
protected  String[] colNames
           
protected  int[] colSizes
           
protected  int[] colTypes
           
protected  boolean returnFIDColumnsAsAttributes
          Set if table FID columns are to be returned as business attributes.
protected  String tableName
           
protected  String tableSchemaName
           
 
Constructor Summary
AbstractFIDMapper()
          Default constructor for AbstractFIDMapper
AbstractFIDMapper(String tableSchemaName, String tableName)
          Set common values for all FID mappers.
 
Method Summary
 int getColumnCount()
          Returns the number of columns in the primary keys handled by this mapper
protected  int getColumnDecimalDigits()
           
 int getColumnDecimalDigits(int colIndex)
          Provides the number of decimal digits for this column.
protected  String getColumnName()
           
 String getColumnName(int colIndex)
          Returns the name of the specified column in the primary key
protected  int getColumnSize()
           
 int getColumnSize(int colIndex)
          Returns the size of a primary key column as it would be provided by the database metadata.
protected  int getColumnType()
           
 int getColumnType(int colIndex)
          Returns the column type by using a constant available in the java.sql.Types interface
 String getTableName()
           
 String getTableSchemaName()
           
 boolean hasAutoIncrementColumns()
          Returns true if at least one column is of auto-increment type
 void initSupportStructures()
          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.
protected  boolean isAutoIncrement()
           
 boolean isAutoIncrement(int colIndex)
          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 isVolatile()
          Convenience since most FID mappers should be persistent, override on the specific ones that aren't.
 boolean returnFIDColumnsAsAttributes()
          If true the primary key columns will be returned as attributes.
protected  void setInfo(String colName, int colType, int colSize, int colDecimalDigits, boolean autoIncrement)
           
 String toString()
          Create a nice string representation of a FID Mapper
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface FIDMapper
createID, getID, getPKAttributes, isValid
 

Field Detail

autoIncrement

protected boolean[] autoIncrement

colDecimalDigits

protected int[] colDecimalDigits

colNames

protected String[] colNames

colSizes

protected int[] colSizes

colTypes

protected int[] colTypes

tableName

protected String tableName

tableSchemaName

protected String tableSchemaName

returnFIDColumnsAsAttributes

protected boolean returnFIDColumnsAsAttributes
Set if table FID columns are to be returned as business attributes.

Constructor Detail

AbstractFIDMapper

public AbstractFIDMapper()
Default constructor for AbstractFIDMapper


AbstractFIDMapper

public AbstractFIDMapper(String tableSchemaName,
                         String tableName)
Set common values for all FID mappers.

Parameters:
tableSchemaName -
tableName -
Method Detail

getColumnCount

public int getColumnCount()
Description copied from interface: FIDMapper
Returns the number of columns in the primary keys handled by this mapper

Specified by:
getColumnCount in interface FIDMapper
See Also:
FIDMapper.getColumnCount()

getColumnDecimalDigits

protected int getColumnDecimalDigits()
See Also:
FIDMapper.getColumnCount()

getColumnDecimalDigits

public int getColumnDecimalDigits(int colIndex)
Description copied from interface: FIDMapper
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

Specified by:
getColumnDecimalDigits in interface FIDMapper
See Also:
FIDMapper.getColumnDecimalDigits(int)

getColumnName

protected String getColumnName()

getColumnName

public String getColumnName(int colIndex)
Description copied from interface: FIDMapper
Returns the name of the specified column in the primary key

Specified by:
getColumnName in interface FIDMapper
See Also:
FIDMapper.getColumnName(int)

getColumnSize

protected int getColumnSize()

getColumnSize

public int getColumnSize(int colIndex)
Description copied from interface: FIDMapper
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).

Specified by:
getColumnSize in interface FIDMapper
See Also:
FIDMapper.getColumnSize(int)

getColumnType

protected int getColumnType()

getColumnType

public int getColumnType(int colIndex)
Description copied from interface: FIDMapper
Returns the column type by using a constant available in the java.sql.Types interface

Specified by:
getColumnType in interface FIDMapper
See Also:
FIDMapper.getColumnType(int)

hasAutoIncrementColumns

public boolean hasAutoIncrementColumns()
Description copied from interface: FIDMapper
Returns true if at least one column is of auto-increment type

Specified by:
hasAutoIncrementColumns in interface FIDMapper
See Also:
FIDMapper.hasAutoIncrementColumns()

initSupportStructures

public void initSupportStructures()
Description copied from interface: FIDMapper
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.

Specified by:
initSupportStructures in interface FIDMapper
See Also:
FIDMapper.initSupportStructures()

isAutoIncrement

protected boolean isAutoIncrement()

isAutoIncrement

public boolean isAutoIncrement(int colIndex)
Description copied from interface: FIDMapper
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

Specified by:
isAutoIncrement in interface FIDMapper
See Also:
FIDMapper.isAutoIncrement(int)

isVolatile

public boolean isVolatile()
Convenience since most FID mappers should be persistent, override on the specific ones that aren't.

Specified by:
isVolatile in interface FIDMapper
See Also:
FIDMapper.isVolatile()

returnFIDColumnsAsAttributes

public boolean returnFIDColumnsAsAttributes()
Description copied from interface: FIDMapper
If true the primary key columns will be returned as attributes. This is fundamental for primary key with businnes meaning.

Specified by:
returnFIDColumnsAsAttributes in interface FIDMapper
See Also:
FIDMapper.returnFIDColumnsAsAttributes()

setInfo

protected void setInfo(String colName,
                       int colType,
                       int colSize,
                       int colDecimalDigits,
                       boolean autoIncrement)

toString

public String toString()
Create a nice string representation of a FID Mapper

Overrides:
toString in class Object
Returns:
the String representation

getTableName

public String getTableName()

getTableSchemaName

public String getTableSchemaName()


Copyright © 1996-2009 Geotools. All Rights Reserved.