org.keycloak.events.jpa

## Class JpaEventStoreProvider

- java.lang.Object
- - org.keycloak.events.jpa.JpaEventStoreProvider

- All Implemented Interfaces:
    EventListenerProvider, EventStoreProvider, Provider

      public class JpaEventStoreProvider
      extends Object
      implements EventStoreProvider

  Author:
    Stian Thorgersen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JpaEventStoreProvider(KeycloakSession session, javax.persistence.EntityManager em, int maxDetailLength)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `void` | `clear(String realmId)`
    `void` | `clear(String realmId, long olderThan)`
    `void` | `clearAdmin()`
    `void` | `clearAdmin(String realmId)`
    `void` | `clearAdmin(String realmId, long olderThan)`
    `void` | `clearExpiredEvents()` Clear all expired events in all realms
    `void` | `close()`
    `AdminEventQuery` | `createAdminQuery()`
    `EventQuery` | `createQuery()`
    `void` | `onEvent(AdminEvent event, boolean includeRepresentation)` Called when an admin event occurs e.g.
    `void` | `onEvent(Event event)` Called when a user event occurs e.g.

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

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

- - ### Constructor Detail

    - #### JpaEventStoreProvider

          public JpaEventStoreProvider(KeycloakSession session,
                                       javax.persistence.EntityManager em,
                                       int maxDetailLength)

  - ### Method Detail

    - #### createQuery

          public EventQuery createQuery()

      Specified by:
        `createQuery` in interface `EventStoreProvider`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `EventStoreProvider`

    - #### clear

          public void clear(String realmId)

      Specified by:
        `clear` in interface `EventStoreProvider`

    - #### clear

          public void clear(String realmId,
                            long olderThan)

      Specified by:
        `clear` in interface `EventStoreProvider`

    - #### clearExpiredEvents

          public void clearExpiredEvents()

      Description copied from interface: `EventStoreProvider`
      Clear all expired events in all realms
      Specified by:
        `clearExpiredEvents` in interface `EventStoreProvider`

    - #### onEvent

          public void onEvent(Event event)

      Description copied from interface: `EventListenerProvider`
      Called when a user event occurs e.g. log in, register.

      Note this method should not do any action that cannot be rolled back, see `EventListenerProvider` javadoc for more details.
      Specified by:
        `onEvent` in interface `EventListenerProvider`
      Parameters:
        `event` - to be triggered

    - #### createAdminQuery

          public AdminEventQuery createAdminQuery()

      Specified by:
        `createAdminQuery` in interface `EventStoreProvider`

    - #### clearAdmin

          public void clearAdmin()

      Specified by:
        `clearAdmin` in interface `EventStoreProvider`

    - #### clearAdmin

          public void clearAdmin(String realmId)

      Specified by:
        `clearAdmin` in interface `EventStoreProvider`

    - #### clearAdmin

          public void clearAdmin(String realmId,
                                 long olderThan)

      Specified by:
        `clearAdmin` in interface `EventStoreProvider`

    - #### onEvent

          public void onEvent(AdminEvent event,
                              boolean includeRepresentation)

      Description copied from interface: `EventListenerProvider`
      Called when an admin event occurs e.g. a client was updated/deleted.

      Note this method should not do any action that cannot be rolled back, see `EventListenerProvider` javadoc for more details.
      Specified by:
        `onEvent` in interface `EventListenerProvider`
      Parameters:
        `event` - to be triggered
        `includeRepresentation` - when false, event listener should NOT include representation field in the resulting action

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

Copyright © 2021 JBoss by Red Hat. All rights reserved.