Class AbstractReactiveEntityOperations<Ctx extends OperationContext,T,Exc extends Exception>

java.lang.Object
io.micronaut.data.runtime.operations.internal.EntityOperations<T,Exc>
io.micronaut.data.runtime.operations.internal.ReactiveEntityOperations<T,Exc>
io.micronaut.data.runtime.operations.internal.AbstractReactiveEntityOperations<Ctx,T,Exc>
Type Parameters:
Ctx - The operation context
T - The entity type
Exc - The exception

@Internal public abstract class AbstractReactiveEntityOperations<Ctx extends OperationContext,T,Exc extends Exception> extends ReactiveEntityOperations<T,Exc>
Abstract reactive entity operations.
Since:
3.3
Author:
Denis Stepanov
  • Field Details

  • Constructor Details

    • AbstractReactiveEntityOperations

      protected AbstractReactiveEntityOperations(Ctx ctx, ReactiveCascadeOperations<Ctx> cascadeOperations, io.micronaut.core.convert.ConversionService conversionService, EntityEventListener<Object> entityEventListener, RuntimePersistentEntity<T> persistentEntity, T entity, boolean insert)
      Default constructor.
      Parameters:
      ctx - The context
      cascadeOperations - The cascade operations
      conversionService - The conversion service
      entityEventListener - The entity event listener
      persistentEntity - The persistent entity
      entity - The entity
      insert - The insert
  • Method Details

    • cascadePre

      protected void cascadePre(Relation.Cascade cascadeType)
      Cascade pre operation.
      Parameters:
      cascadeType - The cascade type
    • cascadePost

      protected void cascadePost(Relation.Cascade cascadeType)
      Cascade post operation.
      Parameters:
      cascadeType - The cascade type
    • triggerPre

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

      protected void triggerPost(Consumer<EntityEventContext<Object>> fn)
      Trigger post-actions on EntityEventContext.
      Parameters:
      fn - The entity context function
    • veto

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

      public reactor.core.publisher.Mono<T> getEntity()
      Specified by:
      getEntity in class ReactiveEntityOperations<T,Exc extends Exception>
      Returns:
      The entity
    • getRowsUpdated

      public reactor.core.publisher.Mono<Number> getRowsUpdated()
      Returns:
      The rows updated
    • 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 DataAccessException
      Throws:
      DataAccessException
    • 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
    • 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.