I
- type of the persistent object and transport object id.
This type should be immutable. It is critical this type
implements equals() and hashCode() correctly.K
- Type of Column Name.P
- type of the persistent object.F
- type of the associated filter.S
- type of the associated sort specification type.public abstract class AbstractBaseDao<I extends Serializable,K extends Serializable & Comparable<K>,P extends Storable<I>,F,S> extends Object implements BaseDao<I,P,F,S,DataStoreContext>
Modifier and Type | Field and Description |
---|---|
protected Provider<ColumnDecoder<K,?>,ColumnName<K,?>> |
columnDecoderProvider |
Constructor and Description |
---|
AbstractBaseDao()
Construct the DAO and create column families in the persistent database.
|
Modifier and Type | Method and Description |
---|---|
protected abstract int |
compareRows(P row1,
P row2,
SortSpecification.SortComponent<S> s) |
long |
count(F filter,
DataStoreContext context)
Gets the number of persisted objects based on a filter criteria.
|
protected Long |
countByFilter(F filter,
DataStoreContext context)
Given a filter, count the number of rows that match it.
|
List<P> |
find(F filter,
SortSpecification<S> sortSpecification,
DataStoreContext context)
Get the list of persistent objects based on the given filter criteria.
|
MarkPage<P> |
find(F filter,
SortSpecification<S> sortSpecification,
MarkPageRequest<?> request,
DataStoreContext context) |
List<P> |
findAll(SortSpecification<S> sortSpecification,
DataStoreContext context)
Gets all the persistent objects.
|
protected abstract <M> MarkPage<I> |
findPagedRows(F filter,
SortSpecification<S> sortSpecification,
MarkPageRequest<M> request,
DataStoreContext context) |
protected abstract Collection<I> |
findRows(F filter,
DataStoreContext context) |
P |
get(I id,
DataStoreContext context)
Get the persistent object with the given id.
|
protected abstract ColumnDecoder<K,?> |
getColumnDecoder(ColumnName<K,?> columnName) |
protected abstract Collection<ColumnFamilyDefinition<?,?>> |
getColumnFamilyDefinitions() |
protected abstract ColumnFamilyDefinition<String,?> |
getCountCf() |
protected abstract String |
getCountRowKey() |
protected abstract ColumnFamilyDefinition<I,K> |
getMainColumnFamily() |
protected Provider<ColumnDecoder<K extends Serializable & Comparable<K>,?>,ColumnName<K extends Serializable & Comparable<K>,?>> columnDecoderProvider
public AbstractBaseDao() throws PersistenceConnException
PersistenceConnException
- Database connection failure exception.public P get(I id, DataStoreContext context)
BaseDao
get
in interface BaseDao<I extends Serializable,P extends Storable<I>,F,S,DataStoreContext>
id
- persistent object's id.context
- data store context.public List<P> find(F filter, SortSpecification<S> sortSpecification, DataStoreContext context) throws Exception
public List<P> findAll(SortSpecification<S> sortSpecification, DataStoreContext context) throws Exception
BaseDao
protected Long countByFilter(F filter, DataStoreContext context) throws Exception
filter
- Filter object to search the databasecontext
- Context to execute the queryException
- General exceptionpublic long count(F filter, DataStoreContext context) throws PersistenceConnException
BaseDao
count
in interface BaseDao<I extends Serializable,P extends Storable<I>,F,S,DataStoreContext>
filter
- filter.context
- data store context.PersistenceConnException
- Database connection failure exception.public MarkPage<P> find(F filter, SortSpecification<S> sortSpecification, MarkPageRequest<?> request, DataStoreContext context) throws Exception
protected abstract <M> MarkPage<I> findPagedRows(F filter, SortSpecification<S> sortSpecification, MarkPageRequest<M> request, DataStoreContext context)
protected abstract ColumnDecoder<K,?> getColumnDecoder(ColumnName<K,?> columnName)
protected abstract Collection<ColumnFamilyDefinition<?,?>> getColumnFamilyDefinitions()
protected abstract ColumnFamilyDefinition<I,K> getMainColumnFamily()
protected abstract Collection<I> findRows(F filter, DataStoreContext context) throws Exception
Exception
protected abstract String getCountRowKey()
protected abstract ColumnFamilyDefinition<String,?> getCountCf()
protected abstract int compareRows(P row1, P row2, SortSpecification.SortComponent<S> s)
Copyright © 2015. All Rights Reserved.