Ctx - The operation contextT - The entity typeExc - The exception@Internal public abstract class AbstractSyncEntityOperations<Ctx extends OperationContext,T,Exc extends java.lang.Exception> extends SyncEntityOperations<T,Exc>
| Modifier and Type | Field and Description |
|---|---|
protected SyncCascadeOperations<Ctx> |
cascadeOperations |
protected io.micronaut.core.convert.ConversionService<?> |
conversionService |
protected Ctx |
ctx |
protected T |
entity |
protected EntityEventListener<java.lang.Object> |
entityEventListener |
protected boolean |
hasGeneratedId |
protected boolean |
insert |
protected RuntimePersistentEntity<T> |
persistentEntity |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSyncEntityOperations(Ctx ctx,
SyncCascadeOperations<Ctx> cascadeOperations,
EntityEventListener<java.lang.Object> entityEventListener,
RuntimePersistentEntity<T> persistentEntity,
io.micronaut.core.convert.ConversionService<?> conversionService,
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 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) |
T |
getEntity() |
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 SyncCascadeOperations<Ctx extends OperationContext> cascadeOperations
protected final Ctx extends OperationContext ctx
protected final boolean insert
protected final boolean hasGeneratedId
protected T entity
protected final EntityEventListener<java.lang.Object> entityEventListener
protected final RuntimePersistentEntity<T> persistentEntity
protected final io.micronaut.core.convert.ConversionService<?> conversionService
protected AbstractSyncEntityOperations(Ctx ctx, SyncCascadeOperations<Ctx> cascadeOperations, EntityEventListener<java.lang.Object> entityEventListener, RuntimePersistentEntity<T> persistentEntity, io.micronaut.core.convert.ConversionService<?> conversionService, 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 void collectAutoPopulatedPreviousValues()
protected 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 T getEntity()
getEntity in class SyncEntityOperations<T,Exc extends java.lang.Exception>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
DataAccessExceptionprotected abstract void execute()
throws Exc extends java.lang.Exception
Exc - The exceptionExc extends java.lang.Exceptionprotected 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()