Class BackingAsyncRepository<T,ID>

java.lang.Object
com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
com.oracle.coherence.spring.data.repository.BackingAsyncRepository<T,ID>

public class BackingAsyncRepository<T,ID> extends com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
  • Constructor Details

  • Method Details

    • getId

      protected ID getId(T t)
      Specified by:
      getId in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • getEntityType

      protected Class<? extends T> getEntityType()
      Specified by:
      getEntityType in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • getMap

      public com.tangosol.net.AsyncNamedMap<ID,T> getMap()
      Specified by:
      getMap in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • count

      public CompletableFuture<Long> count()
      Overrides:
      count in class com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
    • delete

      public CompletableFuture<Void> delete(T entity)
      Deletes a given entity.
      Parameters:
      entity - must not be null
      Returns:
      a CompletableFuture
      Throws:
      IllegalArgumentException - in case the given entity is null.
    • deleteById

      public CompletableFuture<Void> deleteById(ID id)
      Deletes the entity with the given id.
      Parameters:
      id - must not be null
      Returns:
      a CompletableFuture
      Throws:
      IllegalArgumentException - in case the given id is null
    • deleteAll

      public CompletableFuture<Boolean> deleteAll(Iterable<? extends T> entities)
      Deletes the given entities.
      Parameters:
      entities - must not be null. Must not contain null elements
      Returns:
      a CompletableFuture
      Throws:
      IllegalArgumentException - in case the given entities or one of its entities is null.
    • saveAll

      public <S extends T> CompletableFuture<Iterable<S>> saveAll(Iterable<S> entities)
      Saves all given entities.
      Type Parameters:
      S - entity type
      Parameters:
      entities - must not be null nor must it contain null
      Returns:
      the saved entities; will never be null. The returned Iterable will have the same size as the Iterable passed as an argument.
      Throws:
      IllegalArgumentException - in case the given entities or one of its entities is null.
    • findById

      public CompletableFuture<Optional<T>> findById(ID id)
      Retrieves an entity by its id.
      Parameters:
      id - must not be null.
      Returns:
      the entity with the given id or Optional#empty() if none found.
      Throws:
      IllegalArgumentException - if id is null.
    • findAll

      public CompletableFuture<Iterable<T>> findAll()
      Returns all instances of the type.
      Returns:
      all entities
    • findAllById

      public CompletableFuture<Iterable<T>> findAllById(Iterable<ID> ids)
      Returns all instances of the type T with the given IDs.

      If some or all ids are not found, no entities are returned for these IDs.

      Note that the order of elements in the result is not guaranteed.

      Parameters:
      ids - must not be null nor contain any null values
      Returns:
      guaranteed to be not null. The size can be equal or less than the number of given ids.
      Throws:
      IllegalArgumentException - in case the given ids or one of its items is null.
    • existsById

      public CompletableFuture<Boolean> existsById(ID id)
      Returns whether an entity with the given id exists.
      Parameters:
      id - must not be null
      Returns:
      true if an entity with the given id exists, false otherwise.
      Throws:
      IllegalArgumentException - if id is null.
    • deleteAll

      public CompletableFuture<Void> deleteAll()
      Deletes all entities managed by the repository.
      Returns:
      a CompletableFuture
    • delete

      public CompletableFuture<T> delete(T entity, boolean fReturn)
      Alias for AbstractAsyncRepository.remove(Object, boolean).
      Parameters:
      entity - the entity to remove
      fReturn - the flag specifying whether to return removed entity
      Returns:
      deleted entity, iff fReturn == true; null otherwise
    • deleteAllById

      public CompletableFuture<Void> deleteAllById(Iterable<? extends ID> ids)
      Deletes all instances of the type T with the given IDs.
      Parameters:
      ids - must not be null. Must not contain null elements
      Returns:
      a CompletableFuture that can be used to determine whether the operation completed
    • deleteAllById

      public CompletableFuture<Boolean> deleteAllById(Collection<? extends ID> colIds)
      Alias for AbstractAsyncRepository.removeAllById(Collection).
      Parameters:
      colIds - the identifiers of the entities to remove
      Returns:
      true if this repository changed as a result of the call
    • deleteAllById

      public CompletableFuture<Map<ID,T>> deleteAllById(Collection<? extends ID> colIds, boolean fReturn)
      Alias for AbstractAsyncRepository.removeAllById(Collection, boolean).
      Parameters:
      colIds - the identifiers of the entities to remove
      fReturn - the flag specifying whether to return removed entity
      Returns:
      the map of removed entity identifiers as keys, and the removed entities as values iff fReturn == true; null otherwise
    • deleteAll

      public CompletableFuture<Boolean> deleteAll(Collection<? extends T> colEntities)
      Alias for AbstractAsyncRepository.removeAll(Collection).
      Parameters:
      colEntities - the entities to remove
      Returns:
      true if this repository changed as a result of the call
    • deleteAll

      public CompletableFuture<Map<ID,T>> deleteAll(Collection<? extends T> colEntities, boolean fReturn)
      Alias for AbstractAsyncRepository.removeAll(Collection, boolean).
      Parameters:
      colEntities - the entities to remove
      fReturn - the flag specifying whether to return removed entity
      Returns:
      the map of removed entity identifiers as keys, and the removed entities as values iff fReturn == true; null otherwise
    • deleteAll

      public CompletableFuture<Boolean> deleteAll(Stream<? extends T> strEntities)
      Alias for AbstractAsyncRepository.removeAll(Stream).
      Parameters:
      strEntities - the entities to remove
      Returns:
      true if this repository changed as a result of the call
    • deleteAll

      public CompletableFuture<Map<ID,T>> deleteAll(Stream<? extends T> strEntities, boolean fReturn)
      Alias for AbstractAsyncRepository.removeAll(Stream, boolean).
      Parameters:
      strEntities - the entities to remove
      fReturn - the flag specifying whether to return removed entity
      Returns:
      the map of removed entity identifiers as keys, and the removed entities as values iff fReturn == true; null otherwise
    • deleteAll

      public CompletableFuture<Boolean> deleteAll(com.tangosol.util.Filter<?> filter)
      Alias for AbstractAsyncRepository.removeAll(Filter).
      Parameters:
      filter - the criteria that should be used to select entities to remove
      Returns:
      true if this repository changed as a result of the call
    • deleteAll

      public CompletableFuture<Map<ID,T>> deleteAll(com.tangosol.util.Filter<?> filter, boolean fReturn)
      Alias for AbstractAsyncRepository.removeAll(Filter, boolean).
      Parameters:
      filter - the criteria that should be used to select entities to remove
      fReturn - the flag specifying whether to return removed entity
      Returns:
      the map of removed entity identifiers as keys, and the removed entities as values iff fReturn == true; null otherwise