Class DatatableEvent<T>
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
sk.iway.iwcm.system.datatable.events.DatatableEvent<T>
- All Implemented Interfaces:
Serializable
public class DatatableEvent<T>
extends org.springframework.context.ApplicationEvent
Generic event for datatable operations in WebJET, based on
https://www.baeldung.com/spring-events
Supports listening to specific entity types using:
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDatatableEvent(T source, DatatableEventType eventType) Constructor for BEFORE_SAVE, BEFORE_DELETE, BEFORE_DUPLICATE eventsDatatableEvent(T source, DatatableEventType eventType, Long entityId) Constructor for AFTER_DELETE eventDatatableEvent(T source, DatatableEventType eventType, T originalEntity) Constructor for AFTER_SAVE eventDatatableEvent(T source, DatatableEventType eventType, T originalEntity, Long originalId) Constructor for AFTER_DUPLICATE event -
Method Summary
Modifier and TypeMethodDescriptiongetClazz()voidPublish this event to Spring ApplicationContextvoidvoidsetEntityId(Long entityId) voidsetEventType(DatatableEventType eventType) voidsetOriginalEntity(T originalEntity) voidsetOriginalId(Long originalId) voidMethods inherited from class org.springframework.context.ApplicationEvent
getTimestampMethods inherited from class java.util.EventObject
toString
-
Constructor Details
-
DatatableEvent
Constructor for BEFORE_SAVE, BEFORE_DELETE, BEFORE_DUPLICATE events- Parameters:
source- - the entity being operated oneventType- - type of event
-
DatatableEvent
Constructor for AFTER_SAVE event- Parameters:
source- - the saved entity (with updated ID)eventType- - AFTER_SAVEoriginalEntity- - the original entity before save
-
DatatableEvent
Constructor for AFTER_DELETE event- Parameters:
source- - the deleted entityeventType- - AFTER_DELETEentityId- - the ID of deleted entity
-
DatatableEvent
Constructor for AFTER_DUPLICATE event- Parameters:
source- - the newly duplicated entityeventType- - AFTER_DUPLICATEoriginalEntity- - not used for duplicateoriginalId- - the ID of original record that was duplicated
-
-
Method Details
-
publishEvent
public void publishEvent()Publish this event to Spring ApplicationContext -
getSource
- Overrides:
getSourcein classEventObject
-
setSource
-
getEventType
-
setEventType
-
getClazz
-
setClazz
-
getOriginalEntity
-
setOriginalEntity
-
getEntityId
-
setEntityId
-
getOriginalId
-
setOriginalId
-