Interface ReactiveRepositoryOperations

  • All Known Subinterfaces:
    ReactorReactiveRepositoryOperations

    public interface ReactiveRepositoryOperations
    Reactive operations for reading data from a backing implementations.
    Since:
    1.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method 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> delete​(DeleteOperation<T> operation)
      Deletes the entity.
      <T> org.reactivestreams.Publisher<java.lang.Number> deleteAll​(DeleteBatchOperation<T> operation)
      Deletes all the entities of the given type.
      default org.reactivestreams.Publisher<java.lang.Number> executeDelete​(PreparedQuery<?,​java.lang.Number> preparedQuery)
      Executes a batch delete for the given query and parameter values.
      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,​R>
      org.reactivestreams.Publisher<R>
      findOne​(PreparedQuery<T,​R> preparedQuery)
      Find one by 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>
      findOptional​(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.
      <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> operation)
      Persist the entity returning a possibly new entity.
      <T> org.reactivestreams.Publisher<T> persistAll​(InsertBatchOperation<T> operation)
      Persist all the given entities.
      <T> org.reactivestreams.Publisher<T> update​(UpdateOperation<T> operation)
      Updates the entity returning a possibly new entity.
      default <T> org.reactivestreams.Publisher<T> updateAll​(UpdateBatchOperation<T> operation)
      Updates the entities for the given operation.
    • Method Detail

      • findOne

        @NonNull
        @SingleResult
        <T> org.reactivestreams.Publisher<T> findOne​(@NonNull
                                                     java.lang.Class<T> type,
                                                     @NonNull
                                                     java.io.Serializable id)
        Find one by ID.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        id - The id
        Returns:
        A publisher that emits the result
        Throws:
        EmptyResultException - if the result couldn't be retrieved
      • exists

        <T> org.reactivestreams.Publisher<java.lang.Boolean> exists​(@NonNull
                                                                    PreparedQuery<T,​java.lang.Boolean> preparedQuery)
        Check with an record exists for the given query.
        Type Parameters:
        T - The declaring type
        Parameters:
        preparedQuery - The query
        Returns:
        True if it exists
      • findOne

        @SingleResult
        @NonNull
        <T,​R> org.reactivestreams.Publisher<R> findOne​(@NonNull
                                                             PreparedQuery<T,​R> preparedQuery)
        Find one by Query.
        Type Parameters:
        T - The generic resultType
        R - The result type
        Parameters:
        preparedQuery - The prepared query
        Returns:
        A publisher that emits the result
        Throws:
        EmptyResultException - if the result couldn't be retrieved
      • findOptional

        @NonNull
        @SingleResult
        <T> org.reactivestreams.Publisher<T> findOptional​(@NonNull
                                                          java.lang.Class<T> type,
                                                          @NonNull
                                                          java.io.Serializable id)
        Find one by ID.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        id - The id
        Returns:
        A publisher that emits zero or one result
        Throws:
        EmptyResultException - if the result couldn't be retrieved
      • findOptional

        @SingleResult
        @NonNull
        <T,​R> org.reactivestreams.Publisher<R> findOptional​(@NonNull
                                                                  PreparedQuery<T,​R> preparedQuery)
        Find one by Query.
        Type Parameters:
        T - The generic resultType
        R - The result type
        Parameters:
        preparedQuery - The prepared query
        Returns:
        A publisher that emits the zero or one result
      • findAll

        @NonNull
        <T> org.reactivestreams.Publisher<T> findAll​(PagedQuery<T> pagedQuery)
        Finds all results for the given query.
        Type Parameters:
        T - The generic type
        Parameters:
        pagedQuery - The paged query
        Returns:
        A publisher that emits the results
      • count

        @SingleResult
        @NonNull
        <T> org.reactivestreams.Publisher<java.lang.Long> count​(PagedQuery<T> pagedQuery)
        Counts all results for the given query.
        Type Parameters:
        T - The generic type
        Parameters:
        pagedQuery - The paged query
        Returns:
        A publisher that emits the count as a long
      • findAll

        @NonNull
        <T,​R> org.reactivestreams.Publisher<R> findAll​(@NonNull
                                                             PreparedQuery<T,​R> preparedQuery)
        Finds all results for the given query.
        Type Parameters:
        T - The entity type
        R - The result type
        Parameters:
        preparedQuery - The prepared query
        Returns:
        A publisher that emits an iterable with all results
      • persist

        @SingleResult
        @NonNull
        <T> org.reactivestreams.Publisher<T> persist​(@NonNull
                                                     InsertOperation<T> operation)
        Persist the entity returning a possibly new entity.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The entity operation
        Returns:
        A publisher that emits the entity
      • update

        @SingleResult
        @NonNull
        <T> org.reactivestreams.Publisher<T> update​(@NonNull
                                                    UpdateOperation<T> operation)
        Updates the entity returning a possibly new entity.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The entity operation
        Returns:
        A publisher that emits the entity
      • updateAll

        @NonNull
        default <T> org.reactivestreams.Publisher<T> updateAll​(@NonNull
                                                               UpdateBatchOperation<T> operation)
        Updates the entities for the given operation.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The operation
        Returns:
        The updated entities
      • persistAll

        @NonNull
        <T> org.reactivestreams.Publisher<T> persistAll​(@NonNull
                                                        InsertBatchOperation<T> operation)
        Persist all the given entities.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The batch operation
        Returns:
        The entities, possibly mutated
      • executeUpdate

        @NonNull
        @SingleResult
        org.reactivestreams.Publisher<java.lang.Number> executeUpdate​(@NonNull
                                                                      PreparedQuery<?,​java.lang.Number> preparedQuery)
        Executes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.
        Parameters:
        preparedQuery - The prepared query
        Returns:
        A publisher that emits a boolean true if the update was successful
      • executeDelete

        @NonNull
        @SingleResult
        default org.reactivestreams.Publisher<java.lang.Number> executeDelete​(@NonNull
                                                                              PreparedQuery<?,​java.lang.Number> preparedQuery)
        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.
        Parameters:
        preparedQuery - The prepared query
        Returns:
        A publisher that emits a boolean true if the update was successful
      • delete

        @SingleResult
        @NonNull
        <T> org.reactivestreams.Publisher<java.lang.Number> delete​(@NonNull
                                                                   DeleteOperation<T> operation)
        Deletes the entity.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The batch operation
        Returns:
        A publisher that emits the number of entities deleted
      • deleteAll

        @SingleResult
        @NonNull
        <T> org.reactivestreams.Publisher<java.lang.Number> deleteAll​(@NonNull
                                                                      DeleteBatchOperation<T> operation)
        Deletes all the entities of the given type.
        Type Parameters:
        T - The generic type
        Parameters:
        operation - The batch operation
        Returns:
        A publisher that emits the number of entities deleted
      • findPage

        @SingleResult
        @NonNull
        <R> org.reactivestreams.Publisher<Page<R>> findPage​(@NonNull
                                                            PagedQuery<R> pagedQuery)
        Find a page for the given entity and pageable.
        Type Parameters:
        R - The entity generic type
        Parameters:
        pagedQuery - The paged query
        Returns:
        The page type