Class TenantIdEntityEventListener
java.lang.Object
io.micronaut.data.runtime.event.listeners.AutoPopulatedEntityEventListener
io.micronaut.data.runtime.event.listeners.TenantIdEntityEventListener
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,EntityEventListener<Object>
,PropertyAutoPopulator<TenantId>
,EventListener
@Requires(beans=TenantResolver.class)
@Singleton
public class TenantIdEntityEventListener
extends AutoPopulatedEntityEventListener
implements PropertyAutoPopulator<TenantId>
An event listener that handles
TenantId
.- Since:
- 4.8.0
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from interface io.micronaut.data.event.EntityEventListener
NOOP
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionTenantIdEntityEventListener
(TenantResolver tenantResolver, DataConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull List<Class<? extends Annotation>>
protected @NonNull Predicate<RuntimePersistentProperty<Object>>
@NonNull Object
populate
(RuntimePersistentProperty<?> property, @Nullable Object previousValue) Auto-populating the property.boolean
prePersist
(@NonNull EntityEventContext<Object> context) A pre-persist hook.Methods inherited from class io.micronaut.data.runtime.event.listeners.AutoPopulatedEntityEventListener
getApplicableProperties, supports
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.event.EntityEventListener
postLoad, postPersist, postRemove, postUpdate, preQuery, preRemove, preUpdate
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
TenantIdEntityEventListener
public TenantIdEntityEventListener(TenantResolver tenantResolver, DataConversionService conversionService) Default constructor.- Parameters:
conversionService
- The conversion servicetenantResolver
- The tenant resolver
-
-
Method Details
-
getEventTypes
- Specified by:
getEventTypes
in classAutoPopulatedEntityEventListener
- Returns:
- The event type
-
getPropertyPredicate
- Specified by:
getPropertyPredicate
in classAutoPopulatedEntityEventListener
- Returns:
- A predicate to apply for the given property.
-
prePersist
Description copied from interface:EntityEventListener
A pre-persist hook. Implementors can return false to evict the operation.- Specified by:
prePersist
in interfaceEntityEventListener<Object>
- Parameters:
context
- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
populate
@NonNull public @NonNull Object populate(RuntimePersistentProperty<?> property, @Nullable @Nullable Object previousValue) Description copied from interface:PropertyAutoPopulator
Auto-populating the property.- Specified by:
populate
in interfacePropertyAutoPopulator<TenantId>
- Parameters:
property
- the property to auto-populatepreviousValue
- the previous value, if any- Returns:
- new value
-