Class ReactiveEntitiesOperations<T,Exc extends Exception>
java.lang.Object
io.micronaut.data.runtime.operations.internal.ReactiveEntitiesOperations<T,Exc>
- Type Parameters:
T- The entity typeExc- The exception
- Direct Known Subclasses:
AbstractReactiveEntitiesOperations
The reactive entities operations container.
- Since:
- 3.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReactiveEntitiesOperations(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 TypeMethodDescriptionprotected abstract voidcascadePost(io.micronaut.data.annotation.Relation.Cascade cascadeType) Cascade post operation.protected abstract voidcascadePre(io.micronaut.data.annotation.Relation.Cascade cascadeType) Cascade pre operation.protected voidcheckOptimisticLocking(long expected, long received) Compare the expected modifications and the received rows count.protected abstract voidCollect auto-populated values before pre-triggers modifies them.voiddelete()Delete one operation.protected abstract voidexecute()Execute update.protected voidabstract reactor.core.publisher.Flux<T>voidpersist()Persist one operation.protected abstract voidtriggerPost(Consumer<io.micronaut.data.event.EntityEventContext<Object>> fn) Trigger post-actions onEntityEventContext.protected voidTrigger the post persist event.protected voidTrigger the post remove event.protected voidTrigger the post update event.protected abstract booleantriggerPre(Function<io.micronaut.data.event.EntityEventContext<Object>, Boolean> fn) Trigger pre-actions onEntityEventContext.protected booleanTrigger the pre persist event.protected booleanTrigger the pre remove event.protected booleanTrigger the pre update event.voidupdate()Update one operation.protected TupdateEntityId(io.micronaut.core.beans.BeanProperty<T, Object> identity, T entity, Object id) Update entity id.abstract voidVeto an entity.
-
Field Details
-
entityEventListener
-
persistentEntity
-
conversionService
protected final io.micronaut.core.convert.ConversionService conversionService
-
-
Constructor Details
-
ReactiveEntitiesOperations
-
-
Method Details
-
getEntities
- Returns:
- The entities
-
checkOptimisticLocking
protected void checkOptimisticLocking(long expected, long received) Compare the expected modifications and the received rows count. If not equals throwOptimisticLockException.- Parameters:
expected- The expected valuereceived- 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
Execute update. -
veto
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 instanceid- 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 onEntityEventContext.- 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 onEntityEventContext.- Parameters:
fn- The entity context function
-