Class SyncCascadeOperations<Ctx extends OperationContext>
java.lang.Object
io.micronaut.data.runtime.operations.internal.SyncCascadeOperations<Ctx>
- Type Parameters:
Ctx
- The operation context.
Synchronous cascade operations.
- Since:
- 3.3
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
The cascade operations helper. -
Constructor Summary
ConstructorDescriptionSyncCascadeOperations
(io.micronaut.core.convert.ConversionService conversionService, SyncCascadeOperations.SyncCascadeOperationsHelper<Ctx> helper) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> T
afterCascadedMany
(T entity, List<Association> associations, Iterable<Object> prevChildren, List<Object> newChildren) Process after a children element has been cascaded.protected <T> T
afterCascadedOne
(T entity, List<Association> associations, Object prevChild, Object newChild) Process after a child element has been cascaded.protected <T> void
cascade
(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, Class<?> repositoryType, boolean fkOnly, Relation.Cascade cascadeType, io.micronaut.data.runtime.operations.internal.AbstractCascadeOperations.CascadeContext ctx, RuntimePersistentEntity<T> persistentEntity, T entity, List<io.micronaut.data.runtime.operations.internal.AbstractCascadeOperations.CascadeOp> cascadeOps) Cascade on the entity instance and collect cascade operations.<T> T
cascadeEntity
(Ctx ctx, T entity, RuntimePersistentEntity<T> persistentEntity, boolean isPost, Relation.Cascade cascadeType) Cascade the entity operation.
-
Constructor Details
-
SyncCascadeOperations
public SyncCascadeOperations(io.micronaut.core.convert.ConversionService conversionService, SyncCascadeOperations.SyncCascadeOperationsHelper<Ctx> helper) Default constructor.- Parameters:
conversionService
- The conversionServicehelper
- The helper
-
-
Method Details
-
cascadeEntity
public <T> T cascadeEntity(Ctx ctx, T entity, RuntimePersistentEntity<T> persistentEntity, boolean isPost, Relation.Cascade cascadeType) Cascade the entity operation.- Type Parameters:
T
- The entity type- Parameters:
ctx
- The contextentity
- The entity instancepersistentEntity
- The persistent entityisPost
- Is post cascade?cascadeType
- The cascade type- Returns:
- The entity instance
-
cascade
protected <T> void cascade(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, Class<?> repositoryType, boolean fkOnly, Relation.Cascade cascadeType, io.micronaut.data.runtime.operations.internal.AbstractCascadeOperations.CascadeContext ctx, RuntimePersistentEntity<T> persistentEntity, T entity, List<io.micronaut.data.runtime.operations.internal.AbstractCascadeOperations.CascadeOp> cascadeOps) Cascade on the entity instance and collect cascade operations.- Type Parameters:
T
- The entity type- Parameters:
annotationMetadata
- The annotationMetadatarepositoryType
- The repositoryTypefkOnly
- Is FK onlycascadeType
- The cascadeTypectx
- The cascade contextpersistentEntity
- The persistent entityentity
- The entity instancecascadeOps
- The cascade operations
-
afterCascadedOne
protected <T> T afterCascadedOne(T entity, List<Association> associations, Object prevChild, Object newChild) Process after a child element has been cascaded.- Type Parameters:
T
- The entity type- Parameters:
entity
- The parent entity.associations
- The association leading to the childprevChild
- The previous child valuenewChild
- The new child value- Returns:
- The entity instance
-
afterCascadedMany
protected <T> T afterCascadedMany(T entity, List<Association> associations, Iterable<Object> prevChildren, List<Object> newChildren) Process after a children element has been cascaded.- Type Parameters:
T
- The entity type- Parameters:
entity
- The parent entity.associations
- The association leading to the childprevChildren
- The previous children valuenewChildren
- The new children value- Returns:
- The entity instance
-