com.uwyn.rife.database.querymanagers.generic
Interface Callbacks<BeanType>

All Known Implementing Classes:
AbstractCallbacks

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.

Since:
1.0
Version:
$Revision: 3634 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
GenericQueryManager

Method Summary
 boolean afterDelete(int objectId, boolean success)
          Is called after GenericQueryManager.delete(int).
 boolean afterInsert(BeanType object, boolean success)
          Is called after GenericQueryManager.insert(Object), or at the end of GenericQueryManager.save(Object) if a new bean was saved.
 boolean afterRestore(BeanType object)
          Is called after GenericQueryManager.restore(int) and GenericQueryManager.restoreFirst(RestoreQuery), and for every instance restored during GenericQueryManager.restore() and GenericQueryManager.restore(RestoreQuery).
 boolean afterSave(BeanType object, boolean success)
          Is called after GenericQueryManager.save(Object).
 boolean afterUpdate(BeanType object, boolean success)
          Is called after GenericQueryManager.update(Object), or at the end of GenericQueryManager.save(Object) if an existing bean was saved.
 boolean afterValidate(BeanType object)
          Is called after ValidationContext.validate(Validated).
 boolean beforeDelete(int objectId)
          Is called before GenericQueryManager.delete(int).
 boolean beforeInsert(BeanType object)
          Is called before GenericQueryManager.insert(Object), or in the beginning of GenericQueryManager.save(Object) if a new bean is being saved.
 boolean beforeSave(BeanType object)
          Is called before GenericQueryManager.save(Object).
 boolean beforeUpdate(BeanType object)
          Is called before GenericQueryManager.update(Object), or in the beginning of GenericQueryManager.save(Object) if an existing bean is being saved.
 boolean beforeValidate(BeanType object)
          Is called before ValidationContext.validate(Validated).
 

Method Detail

beforeValidate

boolean beforeValidate(BeanType object)
Is called before ValidationContext.validate(Validated).

Parameters:
object - the bean instance that will be validated
Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.3

beforeInsert

boolean beforeInsert(BeanType object)
Is called before GenericQueryManager.insert(Object), or in the beginning of GenericQueryManager.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; or

false if the execution should be interrupted

Since:
1.0

beforeDelete

boolean beforeDelete(int objectId)
Is called before GenericQueryManager.delete(int).

Parameters:
objectId - the id of the bean that will be deleted
Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

beforeSave

boolean beforeSave(BeanType object)
Is called before GenericQueryManager.save(Object).

Parameters:
object - the bean instance that will be saved
Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

beforeUpdate

boolean beforeUpdate(BeanType object)
Is called before GenericQueryManager.update(Object), or in the beginning of GenericQueryManager.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; or

false if the execution should be interrupted

Since:
1.0

afterValidate

boolean afterValidate(BeanType object)
Is called after ValidationContext.validate(Validated).

Parameters:
object - the bean instance that was validated
Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.3

afterInsert

boolean afterInsert(BeanType object,
                    boolean success)
Is called after GenericQueryManager.insert(Object), or at the end of GenericQueryManager.save(Object) if a new bean was saved.

Parameters:
object - the bean instance that was inserted
success - true if the insert was successful; or

false otherwise

Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

afterDelete

boolean afterDelete(int objectId,
                    boolean success)
Is called after GenericQueryManager.delete(int).

Parameters:
objectId - the id of the bean instance that was deleted
success - true if the delete was successful; or

false otherwise

Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

afterSave

boolean afterSave(BeanType object,
                  boolean success)
Is called after GenericQueryManager.save(Object).

Parameters:
object - the bean instance that was saved
success - true if the save was successful; or

false otherwise

Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

afterUpdate

boolean afterUpdate(BeanType object,
                    boolean success)
Is called after GenericQueryManager.update(Object), or at the end of GenericQueryManager.save(Object) if an existing bean was saved.

Parameters:
object - the bean instance that was updated
success - true if the update was successful; or

false otherwise

Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0

afterRestore

boolean afterRestore(BeanType object)
Is called after GenericQueryManager.restore(int) and GenericQueryManager.restoreFirst(RestoreQuery), and for every instance restored during GenericQueryManager.restore() and GenericQueryManager.restore(RestoreQuery).

Parameters:
object - the bean instance that was restored
Returns:
true if the execution should continue as normal; or

false if the execution should be interrupted

Since:
1.0


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.