org.jtheque.core.managers.persistence.context
Class DaoPersistenceContext

java.lang.Object
  extended by org.jtheque.core.managers.persistence.context.DaoPersistenceContext
All Implemented Interfaces:
IDaoPersistenceContext

public final class DaoPersistenceContext
extends java.lang.Object
implements IDaoPersistenceContext

The persistence context for DAOs.

Author:
Baptiste Wicht

Constructor Summary
DaoPersistenceContext()
           
 
Method Summary
 boolean delete(java.lang.String table, Entity d)
          Delete an Entity.
 boolean delete(java.lang.String table, int id)
          Delete an entity of a specific ID.
 void deleteAll(java.lang.String table)
          Delete all the entities of a certain class.
<T extends Entity>
T
getDataByID(java.lang.String table, int id, org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> mapper)
          Return an entity of a specific ID.
<T extends Entity>
java.util.List<T>
getSortedList(java.lang.String table, org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> mapper)
          Return all the entities of a certain class.
 boolean saveOrUpdate(Entity entity, QueryMapper mapper)
          Save or update an entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaoPersistenceContext

public DaoPersistenceContext()
Method Detail

getSortedList

public <T extends Entity> java.util.List<T> getSortedList(java.lang.String table,
                                                          org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> mapper)
Description copied from interface: IDaoPersistenceContext
Return all the entities of a certain class.

Specified by:
getSortedList in interface IDaoPersistenceContext
Type Parameters:
T - The entity class type.
Parameters:
table - The entity table.
mapper - The row mapper.
Returns:
A List sorted by entity displayable text containing all the entity of the class.

getDataByID

public <T extends Entity> T getDataByID(java.lang.String table,
                                        int id,
                                        org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> mapper)
Description copied from interface: IDaoPersistenceContext
Return an entity of a specific ID.

Specified by:
getDataByID in interface IDaoPersistenceContext
Type Parameters:
T - The entity class type.
Parameters:
table - The entity table.
id - The searched id.
mapper - The row mapper.
Returns:
The entity.

delete

public boolean delete(java.lang.String table,
                      int id)
Description copied from interface: IDaoPersistenceContext
Delete an entity of a specific ID.

Specified by:
delete in interface IDaoPersistenceContext
Parameters:
table - The entity table.
id - The searched id.
Returns:
true if the object is deleted else false.

delete

public boolean delete(java.lang.String table,
                      Entity d)
Description copied from interface: IDaoPersistenceContext
Delete an Entity.

Specified by:
delete in interface IDaoPersistenceContext
Parameters:
table - The entity table.
d - The entity to delete.
Returns:
true if the object is deleted else false.

saveOrUpdate

public boolean saveOrUpdate(Entity entity,
                            QueryMapper mapper)
Description copied from interface: IDaoPersistenceContext
Save or update an entity.

Specified by:
saveOrUpdate in interface IDaoPersistenceContext
Parameters:
entity - The entity to save or update.
mapper - The query mapper.
Returns:
true if the object is saved else false.

deleteAll

public void deleteAll(java.lang.String table)
Description copied from interface: IDaoPersistenceContext
Delete all the entities of a certain class.

Specified by:
deleteAll in interface IDaoPersistenceContext
Parameters:
table - The entity table.


Copyright © 2009 JTheque. All Rights Reserved.