Class DefaultReactiveCosmosRepositoryOperations
- java.lang.Object
-
- io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
-
- io.micronaut.data.cosmos.operations.DefaultReactiveCosmosRepositoryOperations
-
- All Implemented Interfaces:
io.micronaut.context.ApplicationContextProvider
,ReactiveRepositoryOperations
,ReactorReactiveRepositoryOperations
,MethodContextAwareStoredQueryDecorator
,PreparedQueryDecorator
@Singleton @Internal public final class DefaultReactiveCosmosRepositoryOperations extends AbstractRepositoryOperations implements ReactorReactiveRepositoryOperations, ReactiveRepositoryOperations, MethodContextAwareStoredQueryDecorator, PreparedQueryDecorator
The reactive Cosmos DB repository operations implementation.- Since:
- 3.9.0
- Author:
- radovanradic
-
-
Field Summary
-
Fields inherited from class io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
attributeConverterRegistry, conversionService, dateTimeProvider, entityEventRegistry, jsonCodec, runtimeEntityRegistry
-
-
Constructor Summary
Constructors Constructor Description DefaultReactiveCosmosRepositoryOperations(java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs, DateTimeProvider<java.lang.Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, DataConversionService<?> conversionService, AttributeConverterRegistry attributeConverterRegistry, com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient, io.micronaut.data.cosmos.operations.CosmosSerde cosmosSerde, CosmosDiagnosticsProcessor cosmosDiagnosticsProcessor, CosmosDatabaseConfiguration configuration)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> reactor.core.publisher.Mono<java.lang.Long>
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.<E,R>
StoredQuery<E,R>decorate(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,R> storedQuery)
Decorate stored query.<E,R>
PreparedQuery<E,R>decorate(PreparedQuery<E,R> preparedQuery)
Decorate prepared query.<T> reactor.core.publisher.Mono<java.lang.Number>
delete(DeleteOperation<T> operation)
Deletes the entity.<T> reactor.core.publisher.Mono<java.lang.Number>
deleteAll(DeleteBatchOperation<T> operation)
Deletes all the entities of the given type.reactor.core.publisher.Mono<java.lang.Number>
executeDelete(PreparedQuery<?,java.lang.Number> pq)
Executes a batch delete for the given query and parameter values.reactor.core.publisher.Mono<java.lang.Number>
executeUpdate(PreparedQuery<?,java.lang.Number> pq)
Executes an update for the given query and parameter values.<T> reactor.core.publisher.Mono<java.lang.Boolean>
exists(PreparedQuery<T,java.lang.Boolean> pq)
Check with an record exists for the given query.<T> reactor.core.publisher.Flux<T>
findAll(PagedQuery<T> pagedQuery)
Finds all results for the given query.<T,R>
reactor.core.publisher.Flux<R>findAll(PreparedQuery<T,R> pq)
Finds all results for the given query.<T,R>
reactor.core.publisher.Mono<R>findOne(PreparedQuery<T,R> pq)
Find one by Query.<T> reactor.core.publisher.Mono<T>
findOne(java.lang.Class<T> type, java.io.Serializable id)
Find one by ID.<T,R>
reactor.core.publisher.Mono<R>findOptional(PreparedQuery<T,R> preparedQuery)
Find one by Query.<T> reactor.core.publisher.Mono<T>
findOptional(java.lang.Class<T> type, java.io.Serializable id)
Find one by ID.<R> reactor.core.publisher.Mono<Page<R>>
findPage(PagedQuery<R> pagedQuery)
Find a page for the given entity and pageable.<T> reactor.core.publisher.Mono<T>
persist(InsertOperation<T> operation)
Persist the entity returning a possibly new entity.<T> reactor.core.publisher.Flux<T>
persistAll(InsertBatchOperation<T> operation)
Persist all the given entities.<T> reactor.core.publisher.Mono<T>
update(UpdateOperation<T> operation)
Updates the entity returning a possibly new entity.<T> reactor.core.publisher.Flux<T>
updateAll(UpdateBatchOperation<T> operation)
Updates the entities for the given operation.-
Methods inherited from class io.micronaut.data.runtime.operations.internal.AbstractRepositoryOperations
checkOptimisticLocking, getApplicationContext, getConversionService, getEntity, getIdReader, isOnlySingleEndedJoins, triggerPostLoad
-
-
-
-
Constructor Detail
-
DefaultReactiveCosmosRepositoryOperations
public DefaultReactiveCosmosRepositoryOperations(java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs, DateTimeProvider<java.lang.Object> dateTimeProvider, RuntimeEntityRegistry runtimeEntityRegistry, DataConversionService<?> conversionService, AttributeConverterRegistry attributeConverterRegistry, com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient, io.micronaut.data.cosmos.operations.CosmosSerde cosmosSerde, @Nullable CosmosDiagnosticsProcessor cosmosDiagnosticsProcessor, CosmosDatabaseConfiguration configuration)
Default constructor.- Parameters:
codecs
- The media type codecsdateTimeProvider
- The date time providerruntimeEntityRegistry
- The entity registryconversionService
- The conversion serviceattributeConverterRegistry
- The attribute converter registrycosmosAsyncClient
- The Cosmos async clientcosmosSerde
- The Cosmos de/serialization helpercosmosDiagnosticsProcessor
- The Cosmos diagnostics processor, can be nullconfiguration
- The Cosmos database configuration
-
-
Method Detail
-
decorate
public <E,R> PreparedQuery<E,R> decorate(PreparedQuery<E,R> preparedQuery)
Description copied from interface:PreparedQueryDecorator
Decorate prepared query.- Specified by:
decorate
in interfacePreparedQueryDecorator
- Type Parameters:
E
- The entity typeR
- The result type- Parameters:
preparedQuery
- The query to be decorated- Returns:
- decorated prepared query
-
decorate
public <E,R> StoredQuery<E,R> decorate(io.micronaut.aop.MethodInvocationContext<?,?> context, StoredQuery<E,R> storedQuery)
Description copied from interface:MethodContextAwareStoredQueryDecorator
Decorate stored query.- Specified by:
decorate
in interfaceMethodContextAwareStoredQueryDecorator
- Type Parameters:
E
- The entity typeR
- The result type- Parameters:
context
- The contextstoredQuery
- The query to be decorated- Returns:
- decorated stored query
-
findOne
@NonNull public <T> reactor.core.publisher.Mono<T> findOne(@NonNull java.lang.Class<T> type, java.io.Serializable id)
Description copied from interface:ReactiveRepositoryOperations
Find one by ID.- Specified by:
findOne
in interfaceReactiveRepositoryOperations
- Specified by:
findOne
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeid
- The id- Returns:
- A publisher that emits the result
-
exists
public <T> reactor.core.publisher.Mono<java.lang.Boolean> exists(@NonNull PreparedQuery<T,java.lang.Boolean> pq)
Description copied from interface:ReactiveRepositoryOperations
Check with an record exists for the given query.- Specified by:
exists
in interfaceReactiveRepositoryOperations
- Specified by:
exists
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The declaring type- Parameters:
pq
- The query- Returns:
- True if it exists
-
findOne
@NonNull public <T,R> reactor.core.publisher.Mono<R> findOne(@NonNull PreparedQuery<T,R> pq)
Description copied from interface:ReactiveRepositoryOperations
Find one by Query.- Specified by:
findOne
in interfaceReactiveRepositoryOperations
- Specified by:
findOne
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic resultTypeR
- The result type- Parameters:
pq
- The prepared query- Returns:
- A publisher that emits the result
-
findOptional
@NonNull public <T> reactor.core.publisher.Mono<T> findOptional(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
Description copied from interface:ReactiveRepositoryOperations
Find one by ID.- Specified by:
findOptional
in interfaceReactiveRepositoryOperations
- Specified by:
findOptional
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeid
- The id- Returns:
- A publisher that emits zero or one result
-
findOptional
@NonNull public <T,R> reactor.core.publisher.Mono<R> findOptional(@NonNull PreparedQuery<T,R> preparedQuery)
Description copied from interface:ReactiveRepositoryOperations
Find one by Query.- Specified by:
findOptional
in interfaceReactiveRepositoryOperations
- Specified by:
findOptional
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic resultTypeR
- The result type- Parameters:
preparedQuery
- The prepared query- Returns:
- A publisher that emits the zero or one result
-
findAll
@NonNull public <T> reactor.core.publisher.Flux<T> findAll(PagedQuery<T> pagedQuery)
Description copied from interface:ReactiveRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in interfaceReactiveRepositoryOperations
- Specified by:
findAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
pagedQuery
- The paged query- Returns:
- A publisher that emits the results
-
count
@NonNull public <T> reactor.core.publisher.Mono<java.lang.Long> count(PagedQuery<T> pagedQuery)
Description copied from interface:ReactiveRepositoryOperations
Counts all results for the given query.- Specified by:
count
in interfaceReactiveRepositoryOperations
- Specified by:
count
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
pagedQuery
- The paged query- Returns:
- A publisher that emits the count as a long
-
findAll
@NonNull public <T,R> reactor.core.publisher.Flux<R> findAll(@NonNull PreparedQuery<T,R> pq)
Description copied from interface:ReactiveRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in interfaceReactiveRepositoryOperations
- Specified by:
findAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The entity typeR
- The result type- Parameters:
pq
- The prepared query- Returns:
- A publisher that emits an iterable with all results
-
persist
@NonNull public <T> reactor.core.publisher.Mono<T> persist(@NonNull InsertOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Persist the entity returning a possibly new entity.- Specified by:
persist
in interfaceReactiveRepositoryOperations
- Specified by:
persist
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A publisher that emits the entity
-
update
@NonNull public <T> reactor.core.publisher.Mono<T> update(@NonNull UpdateOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Updates the entity returning a possibly new entity.- Specified by:
update
in interfaceReactiveRepositoryOperations
- Specified by:
update
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A publisher that emits the entity
-
updateAll
@NonNull public <T> reactor.core.publisher.Flux<T> updateAll(@NonNull UpdateBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Updates the entities for the given operation.- Specified by:
updateAll
in interfaceReactiveRepositoryOperations
- Specified by:
updateAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The operation- Returns:
- The updated entities
-
persistAll
@NonNull public <T> reactor.core.publisher.Flux<T> persistAll(@NonNull InsertBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Persist all the given entities.- Specified by:
persistAll
in interfaceReactiveRepositoryOperations
- Specified by:
persistAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- The entities, possibly mutated
-
executeUpdate
@NonNull public reactor.core.publisher.Mono<java.lang.Number> executeUpdate(@NonNull PreparedQuery<?,java.lang.Number> pq)
Description copied from interface:ReactiveRepositoryOperations
Executes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeUpdate
in interfaceReactiveRepositoryOperations
- Specified by:
executeUpdate
in interfaceReactorReactiveRepositoryOperations
- Parameters:
pq
- The prepared query- Returns:
- A publisher that emits a boolean true if the update was successful
-
executeDelete
@NonNull public reactor.core.publisher.Mono<java.lang.Number> executeDelete(@NonNull PreparedQuery<?,java.lang.Number> pq)
Description copied from interface:ReactiveRepositoryOperations
Executes a batch delete for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeDelete
in interfaceReactiveRepositoryOperations
- Specified by:
executeDelete
in interfaceReactorReactiveRepositoryOperations
- Parameters:
pq
- The prepared query- Returns:
- A publisher that emits a boolean true if the update was successful
-
delete
@NonNull public <T> reactor.core.publisher.Mono<java.lang.Number> delete(@NonNull DeleteOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Deletes the entity.- Specified by:
delete
in interfaceReactiveRepositoryOperations
- Specified by:
delete
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- A publisher that emits the number of entities deleted
-
deleteAll
@NonNull public <T> reactor.core.publisher.Mono<java.lang.Number> deleteAll(@NonNull DeleteBatchOperation<T> operation)
Description copied from interface:ReactiveRepositoryOperations
Deletes all the entities of the given type.- Specified by:
deleteAll
in interfaceReactiveRepositoryOperations
- Specified by:
deleteAll
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- A publisher that emits the number of entities deleted
-
findPage
@NonNull public <R> reactor.core.publisher.Mono<Page<R>> findPage(@NonNull PagedQuery<R> pagedQuery)
Description copied from interface:ReactiveRepositoryOperations
Find a page for the given entity and pageable.- Specified by:
findPage
in interfaceReactiveRepositoryOperations
- Specified by:
findPage
in interfaceReactorReactiveRepositoryOperations
- Type Parameters:
R
- The entity generic type- Parameters:
pagedQuery
- The paged query- Returns:
- The page type
-
-