Package ch.autumo.beetroot.crud
Class EventHandler
java.lang.Object
ch.autumo.beetroot.crud.EventHandler
CRUD event handler.
Don't add CRUD handlers as listeners; this wouldn't be a good idea!
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCreateListener(Class<?> entityClass, CreateListener listener) Add a create listener for create notifications for a specific entity.voidaddDeleteListener(Class<?> entityClass, DeleteListener listener) Add a delete listener for delete notifications for a specific entity.voidaddUpdateListener(Class<?> entityClass, UpdateListener listener) Add an update listener for update notifications for a specific entity.static EventHandlerGet event handler (singleton).voidnotifyAfterCreate(Class<?> entityClass, int id) Notify create listeners for after-create and specific entity.voidnotifyAfterUpdate(Class<?> entityClass, int id) Notify update listeners for after-update and specific entity.booleannotifyBeforeDelete(Class<?> entityClass, int id) Notify delete listeners for before-delete and specific entity.booleannotifyBeforeUpdate(Class<?> entityClass, int id) Notify update listeners for before-update and specific entity.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Method Details
-
getInstance
Get event handler (singleton).- Returns:
- event handler
-
addCreateListener
Add a create listener for create notifications for a specific entity.- Parameters:
entityClass- entitylistener- create listener
-
addUpdateListener
Add an update listener for update notifications for a specific entity.- Parameters:
entityClass- entitylistener- update listener
-
addDeleteListener
Add a delete listener for delete notifications for a specific entity.- Parameters:
entityClass- entitylistener- delete listener
-
notifyAfterCreate
Notify create listeners for after-create and specific entity.- Parameters:
entityClass- entityid- id
-
notifyBeforeUpdate
Notify update listeners for before-update and specific entity. Every called listener can abort the update!- Parameters:
entityClass- entityid- id- Returns:
- true, if update should be aborted, otherwise false
-
notifyAfterUpdate
Notify update listeners for after-update and specific entity.- Parameters:
entityClass- entityid- id
-
notifyBeforeDelete
Notify delete listeners for before-delete and specific entity. Every called listener can abort the deletion!- Parameters:
entityClass- entityid- id- Returns:
- true, if deletion should be aborted, otherwise false
-