|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.com.arsmachina.controller.impl.ControllerImpl<T,K>
T - the entity class related to this controller.K - the type of the field that represents the entity class' primary key.public abstract class ControllerImpl<T,K extends Serializable>
Abstract class that implements the Controller interface by delegating all method calls to
a DAO passed through its constructor.
| Constructor Summary | |
|---|---|
ControllerImpl(br.com.arsmachina.dao.DAO<T,K> dao)
Single constructor of this class. |
|
| Method Summary | |
|---|---|
int |
countAll()
Invokes dao.countAll() |
void |
delete(K id)
Invokes dao.delete() |
void |
delete(T object)
Invokes dao.delete() |
void |
evict(T object)
Invokes dao.evict() |
List<T> |
findAll()
Invokes dao.findAll() |
List<T> |
findAll(int firstResult,
int maxResults,
br.com.arsmachina.dao.SortCriterion... sortCriteria)
Invokes dao.findAll() |
List<T> |
findByExample(T example)
Invokes dao.findByExample() |
T |
findById(K id)
Invokes dao.findById() |
List<T> |
findByIds(K... ids)
Invokes dao.findByIds() |
boolean |
isPersistent(T object)
Invokes dao.isPersistent() |
T |
reattach(T object)
Invokes dao.reattach() |
void |
refresh(T object)
Invokes dao.refresh() |
void |
save(T object)
Invokes dao.save() |
T |
saveOrUpdate(T object)
Invokes save(Object) if the object is persistent and update(Object)
otherwise. |
T |
update(T object)
Invokes dao.update() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ControllerImpl(br.com.arsmachina.dao.DAO<T,K> dao)
dao - a DAO. It cannot be null.| Method Detail |
|---|
public int countAll()
dao.countAll().
- Specified by:
countAll in interface ReadableController<T,K extends Serializable>
- Returns:
- See Also:
ReadableControllerImpl.countAll()
public List<T> findAll()
dao.findAll().
- Specified by:
findAll in interface ReadableController<T,K extends Serializable>
- Returns:
- See Also:
ReadableControllerImpl.findAll()
public List<T> findAll(int firstResult,
int maxResults,
br.com.arsmachina.dao.SortCriterion... sortCriteria)
dao.findAll().
- Specified by:
findAll in interface ReadableController<T,K extends Serializable>
- Parameters:
firstResult - maxResults - sortCriteria -
- Returns:
- See Also:
ReadableControllerImpl.findAll(int, int, br.com.arsmachina.dao.SortCriterion[])
public List<T> findByExample(T example)
dao.findByExample().
- Specified by:
findByExample in interface ReadableController<T,K extends Serializable>
- Parameters:
example -
- Returns:
- See Also:
ReadableControllerImpl.findByExample(java.lang.Object)
public T findById(K id)
dao.findById().
- Specified by:
findById in interface ReadableController<T,K extends Serializable>
- Parameters:
id -
- Returns:
- See Also:
ReadableControllerImpl.findById(java.io.Serializable)
public List<T> findByIds(K... ids)
dao.findByIds().
- Specified by:
findByIds in interface ReadableController<T,K extends Serializable>
- Parameters:
ids -
- Returns:
- See Also:
br.com.arsmachina.controller.impl.ReadableControllerImpl#findByIds(K[])
public void refresh(T object)
dao.refresh().
- Parameters:
object - - See Also:
ReadableControllerImpl.refresh(java.lang.Object)
public void delete(K id)
dao.delete().
- Specified by:
delete in interface WriteableController<T,K extends Serializable>
- Parameters:
id - - See Also:
WriteableControllerImpl.delete(java.io.Serializable)
public void delete(T object)
dao.delete().
- Specified by:
delete in interface WriteableController<T,K extends Serializable>
- Parameters:
object - - See Also:
WriteableControllerImpl.delete(java.lang.Object)
public void evict(T object)
dao.evict().
- Specified by:
evict in interface WriteableController<T,K extends Serializable>
- Parameters:
object - - See Also:
WriteableControllerImpl.evict(java.lang.Object)
public boolean isPersistent(T object)
dao.isPersistent().
- Specified by:
isPersistent in interface WriteableController<T,K extends Serializable>
- Parameters:
object -
- Returns:
- See Also:
WriteableControllerImpl.isPersistent(java.lang.Object)
public void save(T object)
dao.save().
- Specified by:
save in interface WriteableController<T,K extends Serializable>
- Parameters:
object - - See Also:
WriteableControllerImpl.save(java.lang.Object)
public T saveOrUpdate(T object)
save(Object) if the object is persistent and update(Object)
otherwise. The object is considered persistent if isPersistent(Object) returns
true.
saveOrUpdate in interface WriteableController<T,K extends Serializable>object - a T.
T.public T update(T object)
dao.update().
- Specified by:
update in interface WriteableController<T,K extends Serializable>
- Parameters:
object -
- Returns:
- a
T. - See Also:
WriteableControllerImpl.update(java.lang.Object)
public T reattach(T object)
dao.reattach().
- Specified by:
reattach in interface ReadableController<T,K extends Serializable>
- Parameters:
object -
- Returns:
- See Also:
ReadableController.reattach(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||