Class AbstractRepositoryOperations
java.lang.Object
io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
- All Implemented Interfaces:
io.micronaut.context.ApplicationContextProvider
- Direct Known Subclasses:
AbstractSqlRepositoryOperations,DefaultMongoRepositoryOperations,DefaultReactiveCosmosRepositoryOperations,DefaultReactiveMongoRepositoryOperations
@Internal
public abstract class AbstractRepositoryOperations
extends Object
implements io.micronaut.context.ApplicationContextProvider
Abstract repository implementation.
- Since:
- 3.1.0
- Author:
- Denis Stepanov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AttributeConverterRegistryprotected final DataConversionServiceprotected final DateTimeProviderprotected final EntityEventListener<Object>protected final RuntimeEntityRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRepositoryOperations(DateTimeProvider<Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, DataConversionService conversionService, AttributeConverterRegistry attributeConverterRegistry) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckOptimisticLocking(int expected, Number received) Compare the expected modifications and the received rows count.io.micronaut.context.ApplicationContextfinal <T> RuntimePersistentEntity<T>protected final RuntimePersistentProperty<Object>Obtain an ID reader for the given object.protected booleanisOnlySingleEndedJoins(RuntimePersistentEntity<?> rootPersistentEntity, Set<JoinPath> joinFetchPaths) Check if joined associated are all single ended (Can produce only one result).protected <T> TtriggerPostLoad(T entity, RuntimePersistentEntity<T> pe, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Trigger the post load event.
-
Field Details
-
entityEventRegistry
-
dateTimeProvider
-
runtimeEntityRegistry
-
conversionService
-
attributeConverterRegistry
-
-
Constructor Details
-
AbstractRepositoryOperations
protected AbstractRepositoryOperations(DateTimeProvider<Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, DataConversionService conversionService, AttributeConverterRegistry attributeConverterRegistry) Default constructor.- Parameters:
dateTimeProvider- The date time providerruntimeEntityRegistry- The entity registryconversionService- The conversion serviceattributeConverterRegistry- The attribute converter registry
-
-
Method Details
-
getConversionService
- Returns:
- the conversion service
-
getApplicationContext
public io.micronaut.context.ApplicationContext getApplicationContext()- Specified by:
getApplicationContextin interfaceio.micronaut.context.ApplicationContextProvider
-
getEntity
-
triggerPostLoad
protected <T> T triggerPostLoad(@NonNull T entity, RuntimePersistentEntity<T> pe, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Trigger the post load event.- Type Parameters:
T- The generic type- Parameters:
entity- The entitype- The persistent entityannotationMetadata- The annotation metadata- Returns:
- The entity, possibly modified
-
getIdReader
Obtain an ID reader for the given object.- Parameters:
o- The object- Returns:
- The ID reader
-
checkOptimisticLocking
Compare the expected modifications and the received rows count. If not equals throwOptimisticLockException.- Parameters:
expected- The expected valuereceived- THe received value
-
isOnlySingleEndedJoins
protected boolean isOnlySingleEndedJoins(RuntimePersistentEntity<?> rootPersistentEntity, Set<JoinPath> joinFetchPaths) Check if joined associated are all single ended (Can produce only one result).- Parameters:
rootPersistentEntity- The root entityjoinFetchPaths- The join paths- Returns:
- true if there are no "many" joins
-