Interface Callbacks<BeanType>
- All Known Implementing Classes:
AbstractCallbacks
GenericQueryManager
or other
query managers that are based on it. 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.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
afterDelete
(int objectId, boolean success) Is called afterGenericQueryManager.delete(int)
.boolean
afterInsert
(BeanType object, boolean success) Is called afterGenericQueryManager.insert(Object)
, or at the end ofGenericQueryManager.save(Object)
if a new bean was saved.boolean
afterRestore
(BeanType object) Is called afterGenericQueryManager.restore(int)
andGenericQueryManager.restoreFirst(RestoreQuery)
, and for every instance restored duringGenericQueryManager.restore()
andGenericQueryManager.restore(RestoreQuery)
.boolean
Is called afterGenericQueryManager.save(Object)
.boolean
afterUpdate
(BeanType object, boolean success) Is called afterGenericQueryManager.update(Object)
, or at the end ofGenericQueryManager.save(Object)
if an existing bean was saved.boolean
afterValidate
(BeanType object) Is called afterValidationContext.validate(Validated)
.boolean
beforeDelete
(int objectId) Is called beforeGenericQueryManager.delete(int)
.boolean
beforeInsert
(BeanType object) Is called beforeGenericQueryManager.insert(Object)
, or in the beginning ofGenericQueryManager.save(Object)
if a new bean is being saved.boolean
beforeSave
(BeanType object) Is called beforeGenericQueryManager.save(Object)
.boolean
beforeUpdate
(BeanType object) Is called beforeGenericQueryManager.update(Object)
, or in the beginning ofGenericQueryManager.save(Object)
if an existing bean is being saved.boolean
beforeValidate
(BeanType object) Is called beforeValidationContext.validate(Validated)
.
-
Method Details
-
beforeValidate
Is called beforeValidationContext.validate(Validated)
.- Parameters:
object
- the bean instance that will be validated- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
beforeInsert
Is called beforeGenericQueryManager.insert(Object)
, or in the beginning ofGenericQueryManager.save(Object)
if a new bean is being saved.- Parameters:
object
- the bean instance that will be inserted- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
beforeDelete
boolean beforeDelete(int objectId) Is called beforeGenericQueryManager.delete(int)
.- Parameters:
objectId
- the id of the bean that will be deleted- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
beforeSave
Is called beforeGenericQueryManager.save(Object)
.- Parameters:
object
- the bean instance that will be saved- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
beforeUpdate
Is called beforeGenericQueryManager.update(Object)
, or in the beginning ofGenericQueryManager.save(Object)
if an existing bean is being saved.- Parameters:
object
- the bean instance that will be updated- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterValidate
Is called afterValidationContext.validate(Validated)
.- Parameters:
object
- the bean instance that was validated- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterInsert
Is called afterGenericQueryManager.insert(Object)
, or at the end ofGenericQueryManager.save(Object)
if a new bean was saved.- Parameters:
object
- the bean instance that was insertedsuccess
-true
if the insert was successful; orfalse
otherwise- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterDelete
boolean afterDelete(int objectId, boolean success) Is called afterGenericQueryManager.delete(int)
.- Parameters:
objectId
- the id of the bean instance that was deletedsuccess
-true
if the delete was successful; orfalse
otherwise- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterSave
Is called afterGenericQueryManager.save(Object)
.- Parameters:
object
- the bean instance that was savedsuccess
-true
if the save was successful; orfalse
otherwise- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterUpdate
Is called afterGenericQueryManager.update(Object)
, or at the end ofGenericQueryManager.save(Object)
if an existing bean was saved.- Parameters:
object
- the bean instance that was updatedsuccess
-true
if the update was successful; orfalse
otherwise- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-
afterRestore
Is called afterGenericQueryManager.restore(int)
andGenericQueryManager.restoreFirst(RestoreQuery)
, and for every instance restored duringGenericQueryManager.restore()
andGenericQueryManager.restore(RestoreQuery)
.- Parameters:
object
- the bean instance that was restored- Returns:
true
if the execution should continue as normal; orfalse
if the execution should be interrupted- Since:
- 1.0
-