|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Callbacks<BeanType>
Callbacks are hooks that are being called when beans are manipulated
through the GenericQueryManager or other
query managers that are based on it (ContentQueryManager, for instance). They can either
be implemented directly by implementing this interface, or they can be
provided by a bean by implementing the CallbacksProvider interface.
This can for example be used to delete associated and dependent objects
when delete is called (by implementing beforeDelete(int)), or to
clear a cache when an object has been modified (by implementing afterSave(Object, boolean) and afterDelete(int, boolean)).
The return value of callbacks can be used to cancel actions. When the
before* callbacks return false, the associated
actions are cancelled. When the after* callbacks return
false, the execution of the action is interrupted at that step
and no further callbacks will be called.
GenericQueryManager| Method Detail |
|---|
boolean beforeValidate(BeanType object)
ValidationContext.validate(Validated).
object - the bean instance that will be validated
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean beforeInsert(BeanType object)
GenericQueryManager.insert(Object),
or in the beginning of GenericQueryManager.save(Object)
if a new bean is being saved.
object - the bean instance that will be inserted
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean beforeDelete(int objectId)
GenericQueryManager.delete(int).
objectId - the id of the bean that will be deleted
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean beforeSave(BeanType object)
GenericQueryManager.save(Object).
object - the bean instance that will be saved
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean beforeUpdate(BeanType object)
GenericQueryManager.update(Object),
or in the beginning of GenericQueryManager.save(Object)
if an existing bean is being saved.
object - the bean instance that will be updated
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterValidate(BeanType object)
ValidationContext.validate(Validated).
object - the bean instance that was validated
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterInsert(BeanType object,
boolean success)
GenericQueryManager.insert(Object),
or at the end of GenericQueryManager.save(Object)
if a new bean was saved.
object - the bean instance that was insertedsuccess - true if the insert was successful; or
false otherwise
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterDelete(int objectId,
boolean success)
GenericQueryManager.delete(int).
objectId - the id of the bean instance that was deletedsuccess - true if the delete was successful; or
false otherwise
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterSave(BeanType object,
boolean success)
GenericQueryManager.save(Object).
object - the bean instance that was savedsuccess - true if the save was successful; or
false otherwise
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterUpdate(BeanType object,
boolean success)
GenericQueryManager.update(Object),
or at the end of GenericQueryManager.save(Object)
if an existing bean was saved.
object - the bean instance that was updatedsuccess - true if the update was successful; or
false otherwise
true if the execution should continue as normal;
or
false if the execution should be interrupted
boolean afterRestore(BeanType object)
GenericQueryManager.restore(int)
and GenericQueryManager.restoreFirst(RestoreQuery),
and for every instance restored during GenericQueryManager.restore()
and GenericQueryManager.restore(RestoreQuery).
object - the bean instance that was restored
true if the execution should continue as normal;
or
false if the execution should be interrupted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||