org.openstreetmap.osmosis.core.pgsql.v0_6.impl
Class EntityFeatureDao<Tef extends Storeable,Tdb extends DbFeature<Tef>>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.pgsql.common.BaseDao
      extended by org.openstreetmap.osmosis.core.pgsql.v0_6.impl.EntityFeatureDao<Tef,Tdb>
Type Parameters:
Tef - The entity feature type to be supported.
Tdb - The entity feature database wrapper type to be used.
All Implemented Interfaces:
Releasable

public class EntityFeatureDao<Tef extends Storeable,Tdb extends DbFeature<Tef>>
extends BaseDao

Provides functionality common to all entity feature daos.

Author:
Brett Henderson

Field Summary
protected  EntityFeatureMapper<Tdb> entityFeatureBuilder
          Provides jdbc mapping functionality for this entity feature type.
 
Constructor Summary
protected EntityFeatureDao(DatabaseContext dbCtx, EntityFeatureMapper<Tdb> entityFeatureBuilder)
          Creates a new instance.
 
Method Summary
 void addAll(java.util.Collection<Tdb> features)
          Adds the specified features to the database.
 java.util.Collection<Tdb> getAll(long entityId)
          Loads all instances of this feature for the specified entity from the database.
 java.util.Collection<Tef> getAllRaw(long entityId)
          Loads all instances of this feature for the specified entity from the database.
 ReleasableIterator<Tdb> iterate()
          Returns an iterator providing access to all entity features of this type in the database.
 void removeList(long entityId)
          Removes the specified feature list from the database.
 
Methods inherited from class org.openstreetmap.osmosis.core.pgsql.common.BaseDao
getDatabaseContext, prepareStatement, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityFeatureBuilder

protected EntityFeatureMapper<Tdb extends DbFeature<Tef>> entityFeatureBuilder
Provides jdbc mapping functionality for this entity feature type.

Constructor Detail

EntityFeatureDao

protected EntityFeatureDao(DatabaseContext dbCtx,
                           EntityFeatureMapper<Tdb> entityFeatureBuilder)
Creates a new instance.

Parameters:
dbCtx - The database context to use for accessing the database.
entityFeatureBuilder - Provides entity type specific JDBC support.
Method Detail

getAll

public java.util.Collection<Tdb> getAll(long entityId)
Loads all instances of this feature for the specified entity from the database.

Parameters:
entityId - The unique identifier of the entity.
Returns:
All instances of this feature type for the entity.

getAllRaw

public java.util.Collection<Tef> getAllRaw(long entityId)
Loads all instances of this feature for the specified entity from the database.

Parameters:
entityId - The unique identifier of the entity.
Returns:
All instances of this feature type for the entity.

addAll

public void addAll(java.util.Collection<Tdb> features)
Adds the specified features to the database.

Parameters:
features - The features to add.

removeList

public void removeList(long entityId)
Removes the specified feature list from the database.

Parameters:
entityId - The id of the entity to remove.

iterate

public ReleasableIterator<Tdb> iterate()
Returns an iterator providing access to all entity features of this type in the database.

Returns:
The entity feature iterator.