Ctx
- The operation contextT
- The entity typeExc
- The exception@Internal public abstract class AbstractReactiveEntitiesOperations<Ctx extends OperationContext,T,Exc extends java.lang.Exception> extends ReactiveEntitiesOperations<T,Exc>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractReactiveEntitiesOperations.Data
Internal entity data holder.
|
Modifier and Type | Field and Description |
---|---|
protected ReactiveCascadeOperations<Ctx> |
cascadeOperations |
protected io.micronaut.core.convert.ConversionService<?> |
conversionService |
protected Ctx |
ctx |
protected reactor.core.publisher.Flux<AbstractReactiveEntitiesOperations.Data> |
entities |
protected EntityEventListener<java.lang.Object> |
entityEventListener |
protected boolean |
hasGeneratedId |
protected boolean |
insert |
protected RuntimePersistentEntity<T> |
persistentEntity |
protected reactor.core.publisher.Mono<java.lang.Long> |
rowsUpdated |
Modifier | Constructor and Description |
---|---|
protected |
AbstractReactiveEntitiesOperations(Ctx ctx,
ReactiveCascadeOperations<Ctx> cascadeOperations,
io.micronaut.core.convert.ConversionService<?> conversionService,
EntityEventListener<java.lang.Object> entityEventListener,
RuntimePersistentEntity<T> persistentEntity,
java.lang.Iterable<T> entities,
boolean insert)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cascadePost(Relation.Cascade cascadeType)
Cascade post operation.
|
protected void |
cascadePre(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 |
collectAutoPopulatedPreviousValues()
Collect auto-populated values before pre-triggers modifies them.
|
void |
delete()
Delete one operation.
|
protected abstract void |
execute()
Execute update.
|
protected void |
failed(java.lang.Exception e,
java.lang.String operation) |
reactor.core.publisher.Flux<T> |
getEntities() |
reactor.core.publisher.Mono<java.lang.Long> |
getRowsUpdated() |
protected boolean |
notVetoed(AbstractReactiveEntitiesOperations.Data data)
Check if data not vetoed.
|
void |
persist()
Persist one operation.
|
protected void |
triggerPost(java.util.function.Consumer<EntityEventContext<java.lang.Object>> fn)
Trigger post-actions on
EntityEventContext . |
protected void |
triggerPostPersist()
Trigger the post persist event.
|
protected void |
triggerPostRemove()
Trigger the post remove event.
|
protected void |
triggerPostUpdate()
Trigger the post update event.
|
protected boolean |
triggerPre(java.util.function.Function<EntityEventContext<java.lang.Object>,java.lang.Boolean> fn)
Trigger pre-actions on
EntityEventContext . |
protected boolean |
triggerPrePersist()
Trigger the pre persist event.
|
protected boolean |
triggerPreRemove()
Trigger the pre remove event.
|
protected boolean |
triggerPreUpdate()
Trigger the pre update event.
|
void |
update()
Update one operation.
|
protected T |
updateEntityId(io.micronaut.core.beans.BeanProperty<T,java.lang.Object> identity,
T entity,
java.lang.Object id)
Update entity id.
|
void |
veto(java.util.function.Predicate<T> predicate)
Veto an entity.
|
protected final Ctx extends OperationContext ctx
protected final ReactiveCascadeOperations<Ctx extends OperationContext> cascadeOperations
protected final boolean insert
protected final boolean hasGeneratedId
protected reactor.core.publisher.Flux<AbstractReactiveEntitiesOperations.Data> entities
protected reactor.core.publisher.Mono<java.lang.Long> rowsUpdated
protected final EntityEventListener<java.lang.Object> entityEventListener
protected final RuntimePersistentEntity<T> persistentEntity
protected final io.micronaut.core.convert.ConversionService<?> conversionService
protected AbstractReactiveEntitiesOperations(Ctx ctx, ReactiveCascadeOperations<Ctx> cascadeOperations, io.micronaut.core.convert.ConversionService<?> conversionService, EntityEventListener<java.lang.Object> entityEventListener, RuntimePersistentEntity<T> persistentEntity, java.lang.Iterable<T> entities, boolean insert)
ctx
- The contextcascadeOperations
- The cascade operationsconversionService
- The conversion serviceentityEventListener
- The entity event listenerpersistentEntity
- The persistent entityentities
- The entitiesinsert
- The insertprotected void cascadePre(Relation.Cascade cascadeType)
cascadeType
- The cascade typeprotected void cascadePost(Relation.Cascade cascadeType)
cascadeType
- The cascade typepublic void veto(java.util.function.Predicate<T> predicate)
predicate
- The veto predicateprotected boolean triggerPre(java.util.function.Function<EntityEventContext<java.lang.Object>,java.lang.Boolean> fn)
EntityEventContext
.fn
- The entity context functionprotected void triggerPost(java.util.function.Consumer<EntityEventContext<java.lang.Object>> fn)
EntityEventContext
.fn
- The entity context functionprotected boolean notVetoed(AbstractReactiveEntitiesOperations.Data data)
data
- The datapublic reactor.core.publisher.Flux<T> getEntities()
getEntities
in class ReactiveEntitiesOperations<T,Exc extends java.lang.Exception>
public reactor.core.publisher.Mono<java.lang.Long> getRowsUpdated()
protected void checkOptimisticLocking(long expected, long received)
OptimisticLockException
.expected
- The expected valuereceived
- THe received valuepublic void persist()
public void delete()
public void update()
protected void failed(java.lang.Exception e, java.lang.String operation) throws DataAccessException
DataAccessException
protected abstract void collectAutoPopulatedPreviousValues()
protected abstract void execute() throws Exc extends java.lang.Exception
Exc
- The exceptionExc extends java.lang.Exception
protected T updateEntityId(io.micronaut.core.beans.BeanProperty<T,java.lang.Object> identity, T entity, java.lang.Object id)
identity
- The identity property.entity
- The entity instanceid
- The id instanceprotected boolean triggerPrePersist()
protected boolean triggerPreUpdate()
protected boolean triggerPreRemove()
protected void triggerPostUpdate()
protected void triggerPostRemove()
protected void triggerPostPersist()