Class ReactiveEntitiesOperations<T,Exc extends Exception>

java.lang.Object
io.micronaut.data.runtime.operations.internal.ReactiveEntitiesOperations<T,Exc>
Type Parameters:
T - The entity type
Exc - The exception
Direct Known Subclasses:
AbstractReactiveEntitiesOperations

@Internal public abstract class ReactiveEntitiesOperations<T,Exc extends Exception> extends Object
The reactive entities operations container.
Since:
3.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final io.micronaut.core.convert.ConversionService
     
    protected final io.micronaut.data.event.EntityEventListener<Object>
     
    protected final io.micronaut.data.model.runtime.RuntimePersistentEntity<T>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReactiveEntitiesOperations(io.micronaut.data.event.EntityEventListener<Object> entityEventListener, io.micronaut.data.model.runtime.RuntimePersistentEntity<T> persistentEntity, io.micronaut.core.convert.ConversionService conversionService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    cascadePost(io.micronaut.data.annotation.Relation.Cascade cascadeType)
    Cascade post operation.
    protected abstract void
    cascadePre(io.micronaut.data.annotation.Relation.Cascade cascadeType)
    Cascade pre operation.
    protected void
    checkOptimisticLocking(long expected, long received)
    Compare the expected modifications and the received rows count.
    protected abstract void
    Collect auto-populated values before pre-triggers modifies them.
    void
    Delete one operation.
    protected abstract void
    Execute update.
    protected void
    failed(Exception e, String operation)
     
    abstract reactor.core.publisher.Flux<T>
     
    void
    Persist one operation.
    protected abstract void
    triggerPost(Consumer<io.micronaut.data.event.EntityEventContext<Object>> fn)
    Trigger post-actions on EntityEventContext.
    protected void
    Trigger the post persist event.
    protected void
    Trigger the post remove event.
    protected void
    Trigger the post update event.
    protected abstract boolean
    triggerPre(Function<io.micronaut.data.event.EntityEventContext<Object>,Boolean> fn)
    Trigger pre-actions on EntityEventContext.
    protected boolean
    Trigger the pre persist event.
    protected boolean
    Trigger the pre remove event.
    protected boolean
    Trigger the pre update event.
    void
    Update one operation.
    protected T
    updateEntityId(io.micronaut.core.beans.BeanProperty<T,Object> identity, T entity, Object id)
    Update entity id.
    abstract void
    veto(Predicate<T> predicate)
    Veto an entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • entityEventListener

      protected final io.micronaut.data.event.EntityEventListener<Object> entityEventListener
    • persistentEntity

      protected final io.micronaut.data.model.runtime.RuntimePersistentEntity<T> persistentEntity
    • conversionService

      protected final io.micronaut.core.convert.ConversionService conversionService
  • Constructor Details

    • ReactiveEntitiesOperations

      public ReactiveEntitiesOperations(io.micronaut.data.event.EntityEventListener<Object> entityEventListener, io.micronaut.data.model.runtime.RuntimePersistentEntity<T> persistentEntity, io.micronaut.core.convert.ConversionService conversionService)
  • Method Details

    • getEntities

      public abstract reactor.core.publisher.Flux<T> getEntities()
      Returns:
      The entities
    • checkOptimisticLocking

      protected void checkOptimisticLocking(long expected, long received)
      Compare the expected modifications and the received rows count. If not equals throw OptimisticLockException.
      Parameters:
      expected - The expected value
      received - THe received value
    • persist

      public void persist()
      Persist one operation.
    • delete

      public void delete()
      Delete one operation.
    • update

      public void update()
      Update one operation.
    • failed

      protected void failed(Exception e, String operation) throws io.micronaut.data.exceptions.DataAccessException
      Throws:
      io.micronaut.data.exceptions.DataAccessException
    • cascadePre

      protected abstract void cascadePre(io.micronaut.data.annotation.Relation.Cascade cascadeType)
      Cascade pre operation.
      Parameters:
      cascadeType - The cascade type
    • cascadePost

      protected abstract void cascadePost(io.micronaut.data.annotation.Relation.Cascade cascadeType)
      Cascade post operation.
      Parameters:
      cascadeType - The cascade type
    • collectAutoPopulatedPreviousValues

      protected abstract void collectAutoPopulatedPreviousValues()
      Collect auto-populated values before pre-triggers modifies them.
    • execute

      protected abstract void execute() throws Exc
      Execute update.
      Throws:
      Exc extends Exception - The exception
    • veto

      public abstract void veto(Predicate<T> predicate)
      Veto an entity.
      Parameters:
      predicate - The veto predicate
    • updateEntityId

      protected T updateEntityId(io.micronaut.core.beans.BeanProperty<T,Object> identity, T entity, Object id)
      Update entity id.
      Parameters:
      identity - The identity property.
      entity - The entity instance
      id - The id instance
      Returns:
      The entity instance
    • triggerPrePersist

      protected boolean triggerPrePersist()
      Trigger the pre persist event.
      Returns:
      true if operation was vetoed
    • triggerPreUpdate

      protected boolean triggerPreUpdate()
      Trigger the pre update event.
      Returns:
      true if operation was vetoed
    • triggerPreRemove

      protected boolean triggerPreRemove()
      Trigger the pre remove event.
      Returns:
      true if operation was vetoed
    • triggerPostUpdate

      protected void triggerPostUpdate()
      Trigger the post update event.
    • triggerPostRemove

      protected void triggerPostRemove()
      Trigger the post remove event.
    • triggerPostPersist

      protected void triggerPostPersist()
      Trigger the post persist event.
    • triggerPre

      protected abstract boolean triggerPre(Function<io.micronaut.data.event.EntityEventContext<Object>,Boolean> fn)
      Trigger pre-actions on EntityEventContext.
      Parameters:
      fn - The entity context function
      Returns:
      true if operation was vetoed
    • triggerPost

      protected abstract void triggerPost(Consumer<io.micronaut.data.event.EntityEventContext<Object>> fn)
      Trigger post-actions on EntityEventContext.
      Parameters:
      fn - The entity context function