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 TypeMethodDescriptionbooleanafterDelete(int objectId, boolean success) Is called afterGenericQueryManager.delete(int).booleanafterInsert(BeanType object, boolean success) Is called afterGenericQueryManager.insert(Object), or at the end ofGenericQueryManager.save(Object)if a new bean was saved.booleanafterRestore(BeanType object) Is called afterGenericQueryManager.restore(int)andGenericQueryManager.restoreFirst(RestoreQuery), and for every instance restored duringGenericQueryManager.restore()andGenericQueryManager.restore(RestoreQuery).booleanIs called afterGenericQueryManager.save(Object).booleanafterUpdate(BeanType object, boolean success) Is called afterGenericQueryManager.update(Object), or at the end ofGenericQueryManager.save(Object)if an existing bean was saved.booleanafterValidate(BeanType object) Is called afterValidationContext.validate(Validated).booleanbeforeDelete(int objectId) Is called beforeGenericQueryManager.delete(int).booleanbeforeInsert(BeanType object) Is called beforeGenericQueryManager.insert(Object), or in the beginning ofGenericQueryManager.save(Object)if a new bean is being saved.booleanbeforeSave(BeanType object) Is called beforeGenericQueryManager.save(Object).booleanbeforeUpdate(BeanType object) Is called beforeGenericQueryManager.update(Object), or in the beginning ofGenericQueryManager.save(Object)if an existing bean is being saved.booleanbeforeValidate(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:
trueif the execution should continue as normal; orfalseif 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:
trueif the execution should continue as normal; orfalseif 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:
trueif the execution should continue as normal; orfalseif the execution should be interrupted- Since:
- 1.0
-
beforeSave
Is called beforeGenericQueryManager.save(Object).- Parameters:
object- the bean instance that will be saved- Returns:
trueif the execution should continue as normal; orfalseif 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:
trueif the execution should continue as normal; orfalseif the execution should be interrupted- Since:
- 1.0
-
afterValidate
Is called afterValidationContext.validate(Validated).- Parameters:
object- the bean instance that was validated- Returns:
trueif the execution should continue as normal; orfalseif 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-trueif the insert was successful; orfalseotherwise- Returns:
trueif the execution should continue as normal; orfalseif 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-trueif the delete was successful; orfalseotherwise- Returns:
trueif the execution should continue as normal; orfalseif the execution should be interrupted- Since:
- 1.0
-
afterSave
Is called afterGenericQueryManager.save(Object).- Parameters:
object- the bean instance that was savedsuccess-trueif the save was successful; orfalseotherwise- Returns:
trueif the execution should continue as normal; orfalseif 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-trueif the update was successful; orfalseotherwise- Returns:
trueif the execution should continue as normal; orfalseif 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:
trueif the execution should continue as normal; orfalseif the execution should be interrupted- Since:
- 1.0
-