public class ReactiveCosmosTemplate extends Object implements ReactiveCosmosOperations, org.springframework.context.ApplicationContextAware
| Constructor and Description |
|---|
ReactiveCosmosTemplate(CosmosAsyncClient client,
String databaseName,
CosmosConfig cosmosConfig,
MappingCosmosConverter mappingCosmosConverter)
Initialization
|
ReactiveCosmosTemplate(CosmosAsyncClient client,
String databaseName,
CosmosConfig cosmosConfig,
MappingCosmosConverter mappingCosmosConverter,
org.springframework.data.auditing.IsNewAwareAuditingHandler cosmosAuditingHandler)
Initialization
|
ReactiveCosmosTemplate(CosmosFactory cosmosFactory,
CosmosConfig cosmosConfig,
MappingCosmosConverter mappingCosmosConverter)
Initialization
|
ReactiveCosmosTemplate(CosmosFactory cosmosFactory,
CosmosConfig cosmosConfig,
MappingCosmosConverter mappingCosmosConverter,
org.springframework.data.auditing.IsNewAwareAuditingHandler cosmosAuditingHandler)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Mono<Long> |
count(CosmosQuery query,
String containerName)
Count
|
Mono<Long> |
count(SqlQuerySpec querySpec,
String containerName)
Count
|
Mono<Long> |
count(String containerName)
Count
|
Mono<CosmosContainerResponse> |
createContainerIfNotExists(CosmosEntityInformation<?,?> information)
Creates a container if it doesn't already exist
|
<T> Flux<T> |
delete(CosmosQuery query,
Class<T> domainType,
String containerName)
Delete items matching query
|
Mono<Void> |
deleteAll(String containerName,
Class<?> domainType)
Delete all items in a container
|
Mono<Void> |
deleteById(String containerName,
Object id,
PartitionKey partitionKey)
Deletes the item with id and partition key.
|
void |
deleteContainer(String containerName)
Delete container with container name
|
<T> Mono<Void> |
deleteEntity(String containerName,
T entity)
Deletes the entity
|
Mono<Boolean> |
exists(CosmosQuery query,
Class<?> domainType,
String containerName)
Exists
|
Mono<Boolean> |
existsById(Object id,
Class<?> domainType,
String containerName)
Exists
|
<T> Flux<T> |
find(CosmosQuery query,
Class<T> domainType,
String containerName)
Find items
|
<T> Flux<T> |
findAll(Class<T> domainType)
Find all items in a given container
|
<T> Flux<T> |
findAll(PartitionKey partitionKey,
Class<T> domainType)
Find all items in a given container with partition key
|
<T> Flux<T> |
findAll(String containerName,
Class<T> domainType)
Find all items in a given container
|
<T> Mono<T> |
findById(Object id,
Class<T> domainType)
Find by id
|
<T> Mono<T> |
findById(Object id,
Class<T> domainType,
PartitionKey partitionKey)
Find by id
|
<T> Mono<T> |
findById(String containerName,
Object id,
Class<T> domainType)
Find by id
|
String |
getContainerName(Class<?> domainType)
Get container name
|
Mono<CosmosContainerProperties> |
getContainerProperties(String containerName)
Get properties for specified container
|
MappingCosmosConverter |
getConverter()
To get converter
|
<T> Mono<T> |
insert(String containerName,
Object objectToSave,
PartitionKey partitionKey)
Insert
|
<T> Mono<T> |
insert(String containerName,
T objectToSave)
Insert
|
<T> Mono<T> |
insert(T objectToSave)
Insert
|
<T> Mono<T> |
insert(T objectToSave,
PartitionKey partitionKey)
Insert
|
Mono<CosmosContainerProperties> |
replaceContainerProperties(String containerName,
CosmosContainerProperties properties)
Replace container properties for the specified container
|
<T> Flux<T> |
runQuery(SqlQuerySpec querySpec,
Class<?> domainType,
Class<T> returnType)
Run the query.
|
<T> Flux<T> |
runQuery(SqlQuerySpec querySpec,
org.springframework.data.domain.Sort sort,
Class<?> domainType,
Class<T> returnType)
Run the query.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
<T> Mono<T> |
upsert(String containerName,
T object)
Upsert
|
<T> Mono<T> |
upsert(T object)
Upsert
|
public ReactiveCosmosTemplate(CosmosAsyncClient client, String databaseName, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter, org.springframework.data.auditing.IsNewAwareAuditingHandler cosmosAuditingHandler)
client - must not be nulldatabaseName - must not be nullcosmosConfig - must not be nullmappingCosmosConverter - must not be nullcosmosAuditingHandler - can be nullpublic ReactiveCosmosTemplate(CosmosAsyncClient client, String databaseName, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter)
client - must not be nulldatabaseName - must not be nullcosmosConfig - must not be nullmappingCosmosConverter - must not be nullpublic ReactiveCosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter, org.springframework.data.auditing.IsNewAwareAuditingHandler cosmosAuditingHandler)
cosmosFactory - the cosmos db factorycosmosConfig - the cosmos configmappingCosmosConverter - the mappingCosmosConvertercosmosAuditingHandler - the auditing handlerpublic ReactiveCosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter)
cosmosFactory - must not be nullcosmosConfig - must not be nullmappingCosmosConverter - must not be nullpublic void setApplicationContext(@NonNull
org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - the application contextorg.springframework.beans.BeansException - the bean exceptionpublic Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?,?> information)
createContainerIfNotExists in interface ReactiveCosmosOperationsinformation - the CosmosEntityInformationpublic Mono<CosmosContainerProperties> getContainerProperties(String containerName)
ReactiveCosmosOperationsgetContainerProperties in interface ReactiveCosmosOperationscontainerName - Stringpublic Mono<CosmosContainerProperties> replaceContainerProperties(String containerName, CosmosContainerProperties properties)
ReactiveCosmosOperationsreplaceContainerProperties in interface ReactiveCosmosOperationscontainerName - Stringproperties - CosmosContainerPropertiespublic <T> Flux<T> findAll(String containerName, Class<T> domainType)
findAll in interface ReactiveCosmosOperationsT - type of domainTypecontainerName - the containerNamedomainType - the domainTypepublic <T> Flux<T> findAll(Class<T> domainType)
findAll in interface ReactiveCosmosOperationsT - type of domainTypedomainType - the domainTypepublic <T> Flux<T> findAll(PartitionKey partitionKey, Class<T> domainType)
ReactiveCosmosOperationsfindAll in interface ReactiveCosmosOperationsT - type of domainTypepartitionKey - partition KeydomainType - the domainTypepublic <T> Mono<T> findById(Object id, Class<T> domainType)
findById in interface ReactiveCosmosOperationsT - type of domainTypeid - the iddomainType - the domainTypepublic <T> Mono<T> findById(String containerName, Object id, Class<T> domainType)
findById in interface ReactiveCosmosOperationsT - type of domainTypecontainerName - the container nameid - the iddomainType - the entity classpublic <T> Mono<T> findById(Object id, Class<T> domainType, PartitionKey partitionKey)
findById in interface ReactiveCosmosOperationsT - type of domainTypeid - the iddomainType - the entity classpartitionKey - partition Keypublic <T> Mono<T> insert(T objectToSave, PartitionKey partitionKey)
insert in interface ReactiveCosmosOperationsT - type of inserted objectToSaveobjectToSave - the object to savepartitionKey - the partition keypublic <T> Mono<T> insert(T objectToSave)
T - type of inserted objectToSaveobjectToSave - the object to savepublic <T> Mono<T> insert(String containerName, Object objectToSave, PartitionKey partitionKey)
insert in interface ReactiveCosmosOperationsT - type of inserted objectToSavecontainerName - the container nameobjectToSave - the object to savepartitionKey - the partition keypublic <T> Mono<T> insert(String containerName, T objectToSave)
insert in interface ReactiveCosmosOperationsT - type of inserted objectToSavecontainerName - the container nameobjectToSave - the object to savepublic <T> Mono<T> upsert(T object)
upsert in interface ReactiveCosmosOperationsT - type class of objectobject - the object to upsertpublic <T> Mono<T> upsert(String containerName, T object)
upsert in interface ReactiveCosmosOperationsT - type class of objectcontainerName - the container nameobject - the object to savepublic Mono<Void> deleteById(String containerName, Object id, PartitionKey partitionKey)
deleteById in interface ReactiveCosmosOperationscontainerName - Container name of databaseid - item idpartitionKey - the partition keypublic <T> Mono<Void> deleteEntity(String containerName, T entity)
deleteEntity in interface ReactiveCosmosOperationsT - type class of domain typecontainerName - Container name of databaseentity - the entity to deletepublic Mono<Void> deleteAll(@NonNull String containerName, @NonNull Class<?> domainType)
deleteAll in interface ReactiveCosmosOperationscontainerName - the container namedomainType - the domainTypepublic <T> Flux<T> delete(CosmosQuery query, Class<T> domainType, String containerName)
delete in interface ReactiveCosmosOperationsT - type class of domainTypequery - the document querydomainType - the entity classcontainerName - the container namepublic <T> Flux<T> find(CosmosQuery query, Class<T> domainType, String containerName)
find in interface ReactiveCosmosOperationsT - type class of domainTypequery - the document querydomainType - the entity classcontainerName - the container namepublic Mono<Boolean> exists(CosmosQuery query, Class<?> domainType, String containerName)
exists in interface ReactiveCosmosOperationsquery - the document querydomainType - the entity classcontainerName - the container namepublic Mono<Boolean> existsById(Object id, Class<?> domainType, String containerName)
existsById in interface ReactiveCosmosOperationsid - the iddomainType - the entity classcontainerName - the container namepublic Mono<Long> count(String containerName)
count in interface ReactiveCosmosOperationscontainerName - the container namepublic Mono<Long> count(CosmosQuery query, String containerName)
count in interface ReactiveCosmosOperationsquery - the document querycontainerName - the container namepublic Mono<Long> count(SqlQuerySpec querySpec, String containerName)
count in interface ReactiveCosmosOperationsquerySpec - the document query speccontainerName - the container namepublic MappingCosmosConverter getConverter()
ReactiveCosmosOperationsgetConverter in interface ReactiveCosmosOperationspublic <T> Flux<T> runQuery(SqlQuerySpec querySpec, Class<?> domainType, Class<T> returnType)
ReactiveCosmosOperationsrunQuery in interface ReactiveCosmosOperationsT - the type parameterquerySpec - the query specdomainType - the domain typereturnType - the return typepublic <T> Flux<T> runQuery(SqlQuerySpec querySpec, org.springframework.data.domain.Sort sort, Class<?> domainType, Class<T> returnType)
ReactiveCosmosOperationsrunQuery in interface ReactiveCosmosOperationsT - the type parameterquerySpec - the query specsort - the sort orderdomainType - the domain typereturnType - the return typepublic void deleteContainer(@NonNull
String containerName)
deleteContainer in interface ReactiveCosmosOperationscontainerName - the container namepublic String getContainerName(Class<?> domainType)
ReactiveCosmosOperationsgetContainerName in interface ReactiveCosmosOperationsdomainType - the domain classVisit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.