T
- The entity typeExc
- The exception@Internal public abstract class SyncEntityOperations<T,Exc extends java.lang.Exception> extends EntityOperations<T,Exc>
Modifier and Type | Field and Description |
---|---|
protected io.micronaut.core.convert.ConversionService<?> |
conversionService |
protected EntityEventListener<java.lang.Object> |
entityEventListener |
protected RuntimePersistentEntity<T> |
persistentEntity |
Constructor and Description |
---|
SyncEntityOperations(EntityEventListener<java.lang.Object> entityEventListener,
RuntimePersistentEntity<T> persistentEntity,
io.micronaut.core.convert.ConversionService<?> conversionService) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
cascadePost(Relation.Cascade cascadeType)
Cascade post operation.
|
protected abstract 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) |
abstract T |
getEntity() |
void |
persist()
Persist one operation.
|
protected abstract 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 abstract 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.
|
abstract void |
veto(java.util.function.Predicate<T> predicate)
Veto an entity.
|
protected final EntityEventListener<java.lang.Object> entityEventListener
protected final RuntimePersistentEntity<T> persistentEntity
protected final io.micronaut.core.convert.ConversionService<?> conversionService
public SyncEntityOperations(EntityEventListener<java.lang.Object> entityEventListener, RuntimePersistentEntity<T> persistentEntity, io.micronaut.core.convert.ConversionService<?> conversionService)
public abstract T getEntity()
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 cascadePre(Relation.Cascade cascadeType)
cascadeType
- The cascade typeprotected abstract void cascadePost(Relation.Cascade cascadeType)
cascadeType
- The cascade typeprotected abstract void collectAutoPopulatedPreviousValues()
protected abstract void execute() throws Exc extends java.lang.Exception
Exc
- The exceptionExc extends java.lang.Exception
public abstract void veto(java.util.function.Predicate<T> predicate)
predicate
- The veto predicateprotected 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()
protected abstract boolean triggerPre(java.util.function.Function<EntityEventContext<java.lang.Object>,java.lang.Boolean> fn)
EntityEventContext
.fn
- The entity context functionprotected abstract void triggerPost(java.util.function.Consumer<EntityEventContext<java.lang.Object>> fn)
EntityEventContext
.fn
- The entity context function