Ctx
- The operation contextT
- The entity typeExc
- The exception@Internal public abstract class AbstractReactiveEntityOperations<Ctx extends OperationContext,T,Exc extends java.lang.Exception> extends ReactiveEntityOperations<T,Exc>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractReactiveEntityOperations.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.Mono<AbstractReactiveEntityOperations.Data> |
data |
protected EntityEventListener<java.lang.Object> |
entityEventListener |
protected boolean |
hasGeneratedId |
protected boolean |
insert |
protected RuntimePersistentEntity<T> |
persistentEntity |
Modifier | Constructor and Description |
---|---|
protected |
AbstractReactiveEntityOperations(Ctx ctx,
ReactiveCascadeOperations<Ctx> cascadeOperations,
io.micronaut.core.convert.ConversionService<?> conversionService,
EntityEventListener<java.lang.Object> entityEventListener,
RuntimePersistentEntity<T> persistentEntity,
T entity,
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.Mono<T> |
getEntity() |
reactor.core.publisher.Mono<java.lang.Long> |
getRowsUpdated() |
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.Mono<AbstractReactiveEntityOperations.Data> data
protected final EntityEventListener<java.lang.Object> entityEventListener
protected final RuntimePersistentEntity<T> persistentEntity
protected final io.micronaut.core.convert.ConversionService<?> conversionService
protected AbstractReactiveEntityOperations(Ctx ctx, ReactiveCascadeOperations<Ctx> cascadeOperations, io.micronaut.core.convert.ConversionService<?> conversionService, EntityEventListener<java.lang.Object> entityEventListener, RuntimePersistentEntity<T> persistentEntity, T entity, boolean insert)
ctx
- The contextcascadeOperations
- The cascade operationsconversionService
- The conversion serviceentityEventListener
- The entity event listenerpersistentEntity
- The persistent entityentity
- The entityinsert
- The insertprotected void cascadePre(Relation.Cascade cascadeType)
cascadeType
- The cascade typeprotected void cascadePost(Relation.Cascade cascadeType)
cascadeType
- The cascade typeprotected 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 functionpublic void veto(java.util.function.Predicate<T> predicate)
predicate
- The veto predicatepublic reactor.core.publisher.Mono<T> getEntity()
getEntity
in class ReactiveEntityOperations<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()