|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jtheque.core.managers.persistence.GenericDao<T>
T
- The class managed by the dao.public abstract class GenericDao<T extends Entity>
A generic data access object.
Constructor Summary | |
---|---|
GenericDao(java.lang.String table)
Construct a new GenericDao. |
Method Summary | |
---|---|
void |
addDataListener(DataListener listener)
Add a data listener to dao. |
void |
clearAll()
Delete all the entities. |
void |
create(T entity)
Create the entity. |
boolean |
delete(int id)
Delete the entity with the specified ID. |
boolean |
delete(T entity)
Delete the entity. |
T |
get(int id)
Return the entity of a specific id. |
java.util.List<T> |
getAll()
Return all the entity managed by this dao. |
protected java.util.Map<java.lang.Integer,T> |
getCache()
Return the cache of the DAO. |
java.util.List<T> |
getDatas()
Return all the datas of the Dao. |
protected abstract QueryMapper |
getQueryMapper()
Return the query mapper for the DAO. |
protected abstract org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> |
getRowMapper()
Return the row mapper for the DAO. |
boolean |
isNotInCache(int i)
Indicate if the entity with the ID is in cache. |
protected void |
load()
Load the DAO. |
protected abstract void |
load(int i)
Load the entity. |
protected abstract void |
loadCache()
Load the cache. |
void |
removeDataListener(DataListener listener)
Remove a data listener from the dao. |
void |
save(T entity)
Save the entity. |
void |
setCacheEntirelyLoaded(boolean cacheEntirelyLoaded)
Set if the cache has been entirely loaded or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericDao(java.lang.String table)
table
- The database Table.Method Detail |
---|
public final java.util.List<T> getAll()
protected final java.util.Map<java.lang.Integer,T> getCache()
protected final void load()
protected abstract void loadCache()
protected abstract void load(int i)
i
- The ID of the entity.protected abstract org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> getRowMapper()
protected abstract QueryMapper getQueryMapper()
public final T get(int id)
id
- The id for which we search the entity.
public final java.util.List<T> getDatas()
JThequeDao
getDatas
in interface JThequeDao
public void create(T entity)
entity
- The entity to create.public void save(T entity)
entity
- The entity to save.public boolean delete(T entity)
entity
- The entity to delete.
public boolean delete(int id)
id
- The id of the entity to delete.
public final void clearAll()
clearAll
in interface JThequeDao
public final boolean isNotInCache(int i)
i
- The ID of the entity.
public final void setCacheEntirelyLoaded(boolean cacheEntirelyLoaded)
cacheEntirelyLoaded
- A boolean flag indicating if the cache is entirely loaded or not.public final void addDataListener(DataListener listener)
JThequeDao
addDataListener
in interface JThequeDao
listener
- The listener to add.public final void removeDataListener(DataListener listener)
JThequeDao
removeDataListener
in interface JThequeDao
listener
- The listener to remove.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |