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 new `PlatformEvent` on `PrePersist`, `PreUpdate` and `PreRemove`. Also, a `PlatformEvent` can be created manually by calling `#createEvent(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 current `ApplicationContext` to retrieve an instance of the `EntityManager` in use.
  Author:
    Matthias Müller

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PlatformEventListener.EventProvider`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlatformEventListener()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PlatformEventListener

          public PlatformEventListener()

  - ### Method Detail

    - #### setApplicationContext

          public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                                     throws org.springframework.beans.BeansException

      Specified by:
        `setApplicationContext` in interface `org.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)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.