Ctx
- The operation contextT
- The entity typeExc
- The exception@Internal public abstract class AbstractSyncEntitiesOperations<Ctx extends OperationContext,T,Exc extends java.lang.Exception> extends SyncEntitiesOperations<T,Exc>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractSyncEntitiesOperations.Data |
Modifier and Type | Field and Description |
---|---|
protected SyncCascadeOperations<Ctx> |
cascadeOperations |
protected io.micronaut.core.convert.ConversionService<?> |
conversionService |
protected Ctx |
ctx |
protected java.util.List<AbstractSyncEntitiesOperations.Data> |
entities |
protected EntityEventListener<java.lang.Object> |
entityEventListener |
protected boolean |
hasGeneratedId |
protected boolean |
insert |
protected RuntimePersistentEntity<T> |
persistentEntity |
Modifier | Constructor and Description |
---|---|
protected |
AbstractSyncEntitiesOperations(Ctx ctx,
SyncCascadeOperations<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 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) |
java.util.List<T> |
getEntities() |
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 SyncCascadeOperations<Ctx extends OperationContext> cascadeOperations
protected final io.micronaut.core.convert.ConversionService<?> conversionService
protected final java.util.List<AbstractSyncEntitiesOperations.Data> entities
protected final boolean insert
protected final boolean hasGeneratedId
protected final EntityEventListener<java.lang.Object> entityEventListener
protected final RuntimePersistentEntity<T> persistentEntity
protected AbstractSyncEntitiesOperations(Ctx ctx, SyncCascadeOperations<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 typeprotected void collectAutoPopulatedPreviousValues()
public 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 functionpublic java.util.List<T> getEntities()
getEntities
in class SyncEntitiesOperations<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
DataAccessException
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()