@EachBean(value=com.mongodb.client.MongoClient.class) @Internal public final class DefaultMongoRepositoryOperations extends AbstractRepositoryOperations<com.mongodb.client.ClientSession,java.lang.Object> implements MongoRepositoryOperations, AsyncCapableRepository, ReactiveCapableRepository, SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultMongoRepositoryOperations.MongoOperationContext |
attributeConverterRegistry, conversionService, dateTimeProvider, entityEventRegistry, jsonCodec, runtimeEntityRegistry| Modifier | Constructor and Description |
|---|---|
protected |
DefaultMongoRepositoryOperations(java.lang.String serverName,
io.micronaut.context.BeanContext beanContext,
java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs,
DateTimeProvider<java.lang.Object> dateTimeProvider,
RuntimeEntityRegistry runtimeEntityRegistry,
DataConversionService<?> conversionService,
AttributeConverterRegistry attributeConverterRegistry,
com.mongodb.client.MongoClient mongoClient,
java.util.concurrent.ExecutorService executorService)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ExecutorAsyncOperations |
async() |
<T> long |
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.
|
protected io.micronaut.core.convert.ConversionContext |
createTypeConversionContext(com.mongodb.client.ClientSession connection,
RuntimePersistentProperty<?> property,
io.micronaut.core.type.Argument<?> argument)
Creates implementation specific conversion context.
|
<T> int |
delete(DeleteOperation<T> operation)
Deletes the entity.
|
<T> java.util.Optional<java.lang.Number> |
deleteAll(DeleteBatchOperation<T> operation)
Deletes all the entities of the given type.
|
java.util.Optional<java.lang.Number> |
executeDelete(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes a delete for the given query and parameter values.
|
java.util.Optional<java.lang.Number> |
executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes an update for the given query and parameter values.
|
<T> boolean |
exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
Execute a query that checks for existence.
|
<T> java.lang.Iterable<T> |
findAll(PagedQuery<T> query)
Finds all results for the given query.
|
<T,R> java.lang.Iterable<R> |
findAll(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
<T> T |
findOne(java.lang.Class<T> type,
java.io.Serializable id)
Find one by ID.
|
<T,R> R |
findOne(PreparedQuery<T,R> preparedQuery)
Find one by Query.
|
<R> Page<R> |
findPage(PagedQuery<R> query)
Find a page for the given entity and pageable.
|
<T> java.util.stream.Stream<T> |
findStream(PagedQuery<T> query)
Finds a stream for the given arguments.
|
<T,R> java.util.stream.Stream<R> |
findStream(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
<T> T |
persist(InsertOperation<T> operation)
Persist the operation returning a possibly new entity.
|
<T> java.lang.Iterable<T> |
persistAll(InsertBatchOperation<T> operation)
Persist all the given entities.
|
<T> java.util.List<T> |
persistBatch(DefaultMongoRepositoryOperations.MongoOperationContext ctx,
java.lang.Iterable<T> values,
RuntimePersistentEntity<T> persistentEntity,
java.util.function.Predicate<T> predicate)
Persist multiple entities in batch during cascade.
|
void |
persistManyAssociation(DefaultMongoRepositoryOperations.MongoOperationContext ctx,
RuntimeAssociation runtimeAssociation,
java.lang.Object value,
RuntimePersistentEntity<java.lang.Object> persistentEntity,
java.lang.Object child,
RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
Persist JOIN table relationship.
|
void |
persistManyAssociationBatch(DefaultMongoRepositoryOperations.MongoOperationContext ctx,
RuntimeAssociation runtimeAssociation,
java.lang.Object value,
RuntimePersistentEntity<java.lang.Object> persistentEntity,
java.lang.Iterable<java.lang.Object> child,
RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
Persist JOIN table relationships in batch.
|
<T> T |
persistOne(DefaultMongoRepositoryOperations.MongoOperationContext ctx,
T value,
RuntimePersistentEntity<T> persistentEntity)
Persist one entity during cascade.
|
ReactiveRepositoryOperations |
reactive() |
void |
setStatementParameter(java.lang.Object preparedStatement,
int index,
DataType dataType,
java.lang.Object value,
Dialect dialect)
Set the parameter value on the given statement.
|
<T> T |
update(UpdateOperation<T> operation)
Updates the entity for the given operation.
|
<T> java.lang.Iterable<T> |
updateAll(UpdateBatchOperation<T> operation)
Updates the entities for the given operation.
|
<T> T |
updateOne(DefaultMongoRepositoryOperations.MongoOperationContext ctx,
T value,
RuntimePersistentEntity<T> persistentEntity)
Update one entity during cascade.
|
checkOptimisticLocking, convert, convert, getApplicationContext, getEntity, getIdReader, getRuntimeEntityRegistry, isOnlySingleEndedJoins, shiftIndex, triggerPostLoadclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConversionService, getEntity, getQueryHintsgetApplicationContextisSupportsBatchDelete, isSupportsBatchInsert, isSupportsBatchUpdateprotected DefaultMongoRepositoryOperations(@Parameter
java.lang.String serverName,
io.micronaut.context.BeanContext beanContext,
java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs,
DateTimeProvider<java.lang.Object> dateTimeProvider,
RuntimeEntityRegistry runtimeEntityRegistry,
DataConversionService<?> conversionService,
AttributeConverterRegistry attributeConverterRegistry,
com.mongodb.client.MongoClient mongoClient,
@Named(value="io") @Nullable
java.util.concurrent.ExecutorService executorService)
serverName - The server namebeanContext - The bean contextcodecs - The media type codecsdateTimeProvider - The date time providerruntimeEntityRegistry - The entity registryconversionService - The conversion serviceattributeConverterRegistry - The attribute converter registrymongoClient - The Mongo clientexecutorService - The executor servicepublic <T> T findOne(java.lang.Class<T> type,
java.io.Serializable id)
RepositoryOperationsfindOne in interface RepositoryOperationsT - The generic typetype - The typeid - The idpublic <T,R> R findOne(PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindOne in interface RepositoryOperationsT - The generic resultTypeR - The result typepreparedQuery - The prepared querypublic <T> boolean exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
RepositoryOperationsexists in interface RepositoryOperationsT - The generic resultTypepreparedQuery - The prepared querypublic <T> java.lang.Iterable<T> findAll(PagedQuery<T> query)
RepositoryOperationsfindAll in interface RepositoryOperationsT - The generic typequery - The root entitypublic <T> long count(PagedQuery<T> pagedQuery)
RepositoryOperationscount in interface RepositoryOperationsT - The generic typepagedQuery - The paged querypublic <T> java.util.stream.Stream<T> findStream(PagedQuery<T> query)
RepositoryOperationsfindStream in interface RepositoryOperationsT - The generic typequery - The querypublic <R> Page<R> findPage(PagedQuery<R> query)
RepositoryOperationsfindPage in interface RepositoryOperationsR - The entity generic typequery - The querypublic <T,R> java.lang.Iterable<R> findAll(PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindAll in interface RepositoryOperationsT - The entity typeR - The result typepreparedQuery - The prepared querypublic <T,R> java.util.stream.Stream<R> findStream(PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindStream in interface RepositoryOperationsT - The entity typeR - The result typepreparedQuery - The prepared querypublic <T> T persist(InsertOperation<T> operation)
RepositoryOperationspersist in interface RepositoryOperationsT - The generic typeoperation - The operationpublic <T> java.lang.Iterable<T> persistAll(InsertBatchOperation<T> operation)
RepositoryOperationspersistAll in interface RepositoryOperationsT - The generic typeoperation - The operationpublic <T> T update(UpdateOperation<T> operation)
RepositoryOperationsupdate in interface RepositoryOperationsT - The generic typeoperation - The operationpublic <T> java.lang.Iterable<T> updateAll(UpdateBatchOperation<T> operation)
RepositoryOperationsupdateAll in interface RepositoryOperationsT - The generic typeoperation - The operationpublic <T> int delete(DeleteOperation<T> operation)
RepositoryOperationsdelete in interface RepositoryOperationsT - The generic typeoperation - The operationpublic <T> java.util.Optional<java.lang.Number> deleteAll(DeleteBatchOperation<T> operation)
RepositoryOperationsdeleteAll in interface RepositoryOperationsT - The generic typeoperation - The operationpublic java.util.Optional<java.lang.Number> executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
RepositoryOperationsexecuteUpdate in interface RepositoryOperationspreparedQuery - The prepared querypublic java.util.Optional<java.lang.Number> executeDelete(PreparedQuery<?,java.lang.Number> preparedQuery)
RepositoryOperationsexecuteDelete in interface RepositoryOperationspreparedQuery - The prepared queryprotected io.micronaut.core.convert.ConversionContext createTypeConversionContext(com.mongodb.client.ClientSession connection,
RuntimePersistentProperty<?> property,
io.micronaut.core.type.Argument<?> argument)
AbstractRepositoryOperationscreateTypeConversionContext in class AbstractRepositoryOperations<com.mongodb.client.ClientSession,java.lang.Object>connection - The connectionproperty - The propertyargument - The argumentConversionContextpublic void setStatementParameter(java.lang.Object preparedStatement,
int index,
DataType dataType,
java.lang.Object value,
Dialect dialect)
OpContextsetStatementParameter in interface OpContext<com.mongodb.client.ClientSession,java.lang.Object>preparedStatement - The prepared statementindex - The indexdataType - The data typevalue - The valuedialect - The dialectpublic <T> T persistOne(DefaultMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
SyncCascadeOperations.SyncCascadeOperationsHelperpersistOne in interface SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>T - The entity typectx - The contextvalue - The entity valuepersistentEntity - The persistent entitypublic <T> java.util.List<T> persistBatch(DefaultMongoRepositoryOperations.MongoOperationContext ctx, java.lang.Iterable<T> values, RuntimePersistentEntity<T> persistentEntity, java.util.function.Predicate<T> predicate)
SyncCascadeOperations.SyncCascadeOperationsHelperpersistBatch in interface SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>T - The entity typectx - The contextvalues - The entity valuespersistentEntity - The persistent entitypredicate - The veto predicatepublic <T> T updateOne(DefaultMongoRepositoryOperations.MongoOperationContext ctx, T value, RuntimePersistentEntity<T> persistentEntity)
SyncCascadeOperations.SyncCascadeOperationsHelperupdateOne in interface SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>T - The entity typectx - The contextvalue - The entity valuepersistentEntity - The persistent entitypublic void persistManyAssociation(DefaultMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Object child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
SyncCascadeOperations.SyncCascadeOperationsHelperpersistManyAssociation in interface SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>ctx - The contextruntimeAssociation - The associationvalue - The parent entity valuepersistentEntity - The parent persistent entitychild - The child entity valuechildPersistentEntity - The child persistent entitypublic void persistManyAssociationBatch(DefaultMongoRepositoryOperations.MongoOperationContext ctx, RuntimeAssociation runtimeAssociation, java.lang.Object value, RuntimePersistentEntity<java.lang.Object> persistentEntity, java.lang.Iterable<java.lang.Object> child, RuntimePersistentEntity<java.lang.Object> childPersistentEntity)
SyncCascadeOperations.SyncCascadeOperationsHelperpersistManyAssociationBatch in interface SyncCascadeOperations.SyncCascadeOperationsHelper<DefaultMongoRepositoryOperations.MongoOperationContext>ctx - The contextruntimeAssociation - The associationvalue - The parent entity valuepersistentEntity - The parent persistent entitychild - The child entity valueschildPersistentEntity - The child persistent entity@NonNull public ExecutorAsyncOperations async()
async in interface AsyncCapableRepository@NonNull public ReactiveRepositoryOperations reactive()
reactive in interface ReactiveCapableRepository