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

java.lang.Object
  extended by com.bretth.osmosis.core.pgsql.common.BaseDao
      extended by com.bretth.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  EntityFeatureBuilder<Tdb> entityFeatureBuilder
          Provides jdbc mapping functionality for this entity feature type.
 
Constructor Summary
protected EntityFeatureDao(DatabaseContext dbCtx, EntityFeatureBuilder<Tdb> entityFeatureBuilder)
          Creates a new instance.
 
Method Summary
 void addList(java.util.List<Tdb> featureList)
          Adds the specified feature list to the database.
 java.util.List<Tdb> getList(long entityId)
          Loads all instances of this feature for the specified entity from the database.
 java.util.List<Tef> getRawList(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 com.bretth.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 EntityFeatureBuilder<Tdb extends DbFeature<Tef>> entityFeatureBuilder
Provides jdbc mapping functionality for this entity feature type.

Constructor Detail

EntityFeatureDao

protected EntityFeatureDao(DatabaseContext dbCtx,
                           EntityFeatureBuilder<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

getList

public java.util.List<Tdb> getList(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.

getRawList

public java.util.List<Tef> getRawList(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.

addList

public void addList(java.util.List<Tdb> featureList)
Adds the specified feature list to the database.

Parameters:
featureList - The list of 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.