org.openstreetmap.osmosis.core.pgsql.v0_6.impl
Class EntityFeatureMapper<T>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.pgsql.v0_6.impl.EntityFeatureMapper<T>
Type Parameters:
T - The type of feature to be built.
Direct Known Subclasses:
RelationMemberMapper, TagMapper, WayNodeMapper

public abstract class EntityFeatureMapper<T>
extends java.lang.Object

Provides functionality common to all entity feature mapper implementations.

Author:
Brett Henderson

Constructor Summary
EntityFeatureMapper()
           
 
Method Summary
abstract  T buildEntity(java.sql.ResultSet resultSet)
          Creates a new entity based upon the current row in the result set.
abstract  java.lang.String getEntityName()
          Returns the name of the entity feature.
abstract  java.lang.String getParentEntityName()
          Returns the name of the entity features entity type.
 java.lang.String getSqlDefaultOrderBy()
          Provides a default SQL ORDER BY clause suitable for this entity feature.
abstract  java.lang.String getSqlDelete(boolean filterByEntityId)
          The SQL DELETE statement for deleting entity features.
abstract  java.lang.String getSqlInsert(int rowCount)
          The SQL INSERT statement for adding features.
abstract  java.lang.String getSqlSelect(boolean filterByEntityId, boolean orderBy)
          The SQL SELECT statement for retrieving entity feature details.
abstract  int populateEntityParameters(java.sql.PreparedStatement statement, int initialIndex, T entityFeature)
          Sets entity values as bind variable parameters to an entity insert query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityFeatureMapper

public EntityFeatureMapper()
Method Detail

getParentEntityName

public abstract java.lang.String getParentEntityName()
Returns the name of the entity features entity type.

Returns:
The parent entity name.

getEntityName

public abstract java.lang.String getEntityName()
Returns the name of the entity feature. This is used for error messages.

Returns:
The entity name.

getSqlDefaultOrderBy

public java.lang.String getSqlDefaultOrderBy()
Provides a default SQL ORDER BY clause suitable for this entity feature.

Returns:
The ORDER BY clause.

getSqlSelect

public abstract java.lang.String getSqlSelect(boolean filterByEntityId,
                                              boolean orderBy)
The SQL SELECT statement for retrieving entity feature details.

Parameters:
filterByEntityId - If true, a WHERE clause will be added filtering by the entity id column.
orderBy - If true, a default ORDER BY clause will be added ordering by the entity id column at a minimum and possibly other fields depending on implementation.
Returns:
The SQL string.

getSqlInsert

public abstract java.lang.String getSqlInsert(int rowCount)
The SQL INSERT statement for adding features.

Parameters:
rowCount - The number of rows to insert in a single statement.
Returns:
The SQL string.

getSqlDelete

public abstract java.lang.String getSqlDelete(boolean filterByEntityId)
The SQL DELETE statement for deleting entity features.

Parameters:
filterByEntityId - If true, a WHERE clause will be added filtering by the entity id column.
Returns:
The SQL String.

buildEntity

public abstract T buildEntity(java.sql.ResultSet resultSet)
Creates a new entity based upon the current row in the result set.

Parameters:
resultSet - The result set to read from.
Returns:
The newly built entity object.

populateEntityParameters

public abstract int populateEntityParameters(java.sql.PreparedStatement statement,
                                             int initialIndex,
                                             T entityFeature)
Sets entity values as bind variable parameters to an entity insert query.

Parameters:
statement - The prepared statement to add the values to.
initialIndex - The offset index of the first variable to set.
entityFeature - The entity containing the data to be inserted.
Returns:
The current parameter offset.