Package org.appng.core.domain
Class PlatformEventListener
- java.lang.Object
-
- org.appng.core.domain.PlatformEventListener
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class PlatformEventListener extends Object implements org.springframework.context.ApplicationContextAware
An entity listener that creates a newPlatformEvent
onPrePersist
,PreUpdate
andPreRemove
. Also, aPlatformEvent
can be created manually by callingcreateEvent(PlatformEvent.Type, String)
.
Note that this listener is able to work in two scenarios. The first is as a regular Spring bean that can be invoked from other beans. As a JPA entity listener, we use a static reference to the currentApplicationContext
to retrieve an instance of theEntityManager
in use.- Author:
- Matthias Müller
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PlatformEventListener.EventProvider
-
Constructor Summary
Constructors Constructor Description PlatformEventListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeCreate(Auditable<?> o)
void
createEvent(PlatformEvent.Type type, String message)
void
createEvent(PlatformEvent.Type type, String message, javax.servlet.http.HttpServletRequest request)
PlatformEventListener.EventProvider
getEventProvider()
void
onDelete(Auditable<?> o)
void
onUpdate(Auditable<?> o)
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setAuditApplication(String auditApplication)
void
setAuditUser(String auditUser)
void
setEventProvider(PlatformEventListener.EventProvider eventProvider)
void
setPersist(boolean persist)
-
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
beforeCreate
public void beforeCreate(Auditable<?> o)
-
onUpdate
public void onUpdate(Auditable<?> o)
-
onDelete
public void onDelete(Auditable<?> o)
-
createEvent
public void createEvent(PlatformEvent.Type type, String message)
-
createEvent
public void createEvent(PlatformEvent.Type type, String message, javax.servlet.http.HttpServletRequest request)
-
setAuditUser
public void setAuditUser(String auditUser)
-
setAuditApplication
public void setAuditApplication(String auditApplication)
-
setPersist
public void setPersist(boolean persist)
-
getEventProvider
public PlatformEventListener.EventProvider getEventProvider()
-
setEventProvider
public void setEventProvider(PlatformEventListener.EventProvider eventProvider)
-
-