public class ExecutorReactiveOperations extends java.lang.Object implements ReactiveRepositoryOperations
ReactiveRepositoryOperations
that delegates to a blocking operations and specified Executor
.
This can be used in absence of true reactive support at the driver level an allows composing blocking operations within reactive flows.
If a backing implementation provides a reactive API then the backing implementation should not use this class and instead directly implement the ReactiveRepositoryOperations
interface.
ReactiveRepositoryOperations
Constructor and Description |
---|
ExecutorReactiveOperations(ExecutorAsyncOperations asyncOperations)
Default constructor.
|
ExecutorReactiveOperations(RepositoryOperations datastore,
java.util.concurrent.Executor executor)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> org.reactivestreams.Publisher<java.lang.Long> |
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.
|
<T> org.reactivestreams.Publisher<java.lang.Number> |
deleteAll(BatchOperation<T> operation)
Deletes all the entities of the given type.
|
org.reactivestreams.Publisher<java.lang.Number> |
executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes an update for the given query and parameter values.
|
<T> org.reactivestreams.Publisher<java.lang.Boolean> |
exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
Check with an record exists for the given query.
|
<T> org.reactivestreams.Publisher<T> |
findAll(PagedQuery<T> pagedQuery)
Finds all results for the given query.
|
<T,R> org.reactivestreams.Publisher<R> |
findAll(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
<T> org.reactivestreams.Publisher<T> |
findOne(java.lang.Class<T> type,
java.io.Serializable id)
Find one by ID.
|
<T,R> org.reactivestreams.Publisher<R> |
findOne(PreparedQuery<T,R> preparedQuery)
Find one by Query.
|
<T> org.reactivestreams.Publisher<T> |
findOptional(java.lang.Class<T> type,
java.io.Serializable id)
Find one by ID.
|
<T,R> org.reactivestreams.Publisher<R> |
findOptional(PreparedQuery<T,R> preparedQuery)
Find one by Query.
|
<R> org.reactivestreams.Publisher<Page<R>> |
findPage(PagedQuery<R> pagedQuery)
Find a page for the given entity and pageable.
|
<T> org.reactivestreams.Publisher<T> |
persist(InsertOperation<T> entity)
Persist the entity returning a possibly new entity.
|
<T> org.reactivestreams.Publisher<T> |
persistAll(BatchOperation<T> operation)
Persist all the given entities.
|
<T> org.reactivestreams.Publisher<T> |
update(UpdateOperation<T> operation)
Updates the entity returning a possibly new entity.
|
public ExecutorReactiveOperations(@NonNull RepositoryOperations datastore, @NonNull java.util.concurrent.Executor executor)
datastore
- The target operationsexecutor
- The executor to use.public ExecutorReactiveOperations(@NonNull ExecutorAsyncOperations asyncOperations)
asyncOperations
- The instance operations instance@NonNull public <T> org.reactivestreams.Publisher<T> findOne(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
ReactiveRepositoryOperations
findOne
in interface ReactiveRepositoryOperations
T
- The generic typetype
- The typeid
- The idpublic <T> org.reactivestreams.Publisher<java.lang.Boolean> exists(@NonNull PreparedQuery<T,java.lang.Boolean> preparedQuery)
ReactiveRepositoryOperations
exists
in interface ReactiveRepositoryOperations
T
- The declaring typepreparedQuery
- The query@NonNull public <T,R> org.reactivestreams.Publisher<R> findOne(@NonNull PreparedQuery<T,R> preparedQuery)
ReactiveRepositoryOperations
findOne
in interface ReactiveRepositoryOperations
T
- The generic resultTypeR
- The result typepreparedQuery
- The prepared query@NonNull public <T> org.reactivestreams.Publisher<T> findOptional(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
ReactiveRepositoryOperations
findOptional
in interface ReactiveRepositoryOperations
T
- The generic typetype
- The typeid
- The id@NonNull public <T,R> org.reactivestreams.Publisher<R> findOptional(@NonNull PreparedQuery<T,R> preparedQuery)
ReactiveRepositoryOperations
findOptional
in interface ReactiveRepositoryOperations
T
- The generic resultTypeR
- The result typepreparedQuery
- The prepared query@NonNull public <T> org.reactivestreams.Publisher<T> findAll(PagedQuery<T> pagedQuery)
ReactiveRepositoryOperations
findAll
in interface ReactiveRepositoryOperations
T
- The generic typepagedQuery
- The paged query@NonNull public <T> org.reactivestreams.Publisher<java.lang.Long> count(PagedQuery<T> pagedQuery)
ReactiveRepositoryOperations
count
in interface ReactiveRepositoryOperations
T
- The generic typepagedQuery
- The paged query@NonNull public <R> org.reactivestreams.Publisher<Page<R>> findPage(@NonNull PagedQuery<R> pagedQuery)
ReactiveRepositoryOperations
findPage
in interface ReactiveRepositoryOperations
R
- The entity generic typepagedQuery
- The paged query@NonNull public <T,R> org.reactivestreams.Publisher<R> findAll(@NonNull PreparedQuery<T,R> preparedQuery)
ReactiveRepositoryOperations
findAll
in interface ReactiveRepositoryOperations
T
- The entity typeR
- The result typepreparedQuery
- The prepared query@NonNull public <T> org.reactivestreams.Publisher<T> persist(@NonNull InsertOperation<T> entity)
ReactiveRepositoryOperations
persist
in interface ReactiveRepositoryOperations
T
- The generic typeentity
- The entity operation@NonNull public <T> org.reactivestreams.Publisher<T> update(@NonNull UpdateOperation<T> operation)
ReactiveRepositoryOperations
update
in interface ReactiveRepositoryOperations
T
- The generic typeoperation
- The entity operation@NonNull public <T> org.reactivestreams.Publisher<T> persistAll(@NonNull BatchOperation<T> operation)
ReactiveRepositoryOperations
persistAll
in interface ReactiveRepositoryOperations
T
- The generic typeoperation
- The batch operation@NonNull public org.reactivestreams.Publisher<java.lang.Number> executeUpdate(@NonNull PreparedQuery<?,java.lang.Number> preparedQuery)
ReactiveRepositoryOperations
executeUpdate
in interface ReactiveRepositoryOperations
preparedQuery
- The prepared query@NonNull public <T> org.reactivestreams.Publisher<java.lang.Number> deleteAll(BatchOperation<T> operation)
ReactiveRepositoryOperations
deleteAll
in interface ReactiveRepositoryOperations
T
- The generic typeoperation
- The batch operation