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>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.coherence.repository.AbstractRepositoryBase
com.oracle.coherence.repository.AbstractRepositoryBase.Listener<T extends java.lang.Object>, com.oracle.coherence.repository.AbstractRepositoryBase.MapListenerAdapter<ID extends java.lang.Object,T extends java.lang.Object>
-
-
Constructor Summary
Constructors Constructor Description BackingAsyncRepository(com.tangosol.net.NamedMap<ID,T> namedMap, org.springframework.data.mapping.context.MappingContext<CoherencePersistentEntity<T>,CoherencePersistentProperty> mappingContext, java.lang.Class<? extends T> domainType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>
count()
java.util.concurrent.CompletableFuture<java.lang.Void>
delete(T entity)
Deletes a given entity.java.util.concurrent.CompletableFuture<T>
delete(T entity, boolean fReturn)
Alias forAbstractAsyncRepository.remove(Object, boolean)
.java.util.concurrent.CompletableFuture<java.lang.Void>
deleteAll()
Deletes all entities managed by the repository.java.util.concurrent.CompletableFuture<java.lang.Boolean>
deleteAll(com.tangosol.util.Filter<?> filter)
Alias forAbstractAsyncRepository.removeAll(Filter)
.java.util.concurrent.CompletableFuture<java.util.Map<ID,T>>
deleteAll(com.tangosol.util.Filter<?> filter, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Filter, boolean)
.java.util.concurrent.CompletableFuture<java.lang.Boolean>
deleteAll(java.lang.Iterable<? extends T> entities)
Deletes the given entities.java.util.concurrent.CompletableFuture<java.lang.Boolean>
deleteAll(java.util.Collection<? extends T> colEntities)
Alias forAbstractAsyncRepository.removeAll(Collection)
.java.util.concurrent.CompletableFuture<java.util.Map<ID,T>>
deleteAll(java.util.Collection<? extends T> colEntities, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Collection, boolean)
.java.util.concurrent.CompletableFuture<java.lang.Boolean>
deleteAll(java.util.stream.Stream<? extends T> strEntities)
Alias forAbstractAsyncRepository.removeAll(Stream)
.java.util.concurrent.CompletableFuture<java.util.Map<ID,T>>
deleteAll(java.util.stream.Stream<? extends T> strEntities, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Stream, boolean)
.java.util.concurrent.CompletableFuture<java.lang.Void>
deleteAllById(java.lang.Iterable<? extends ID> ids)
Deletes all instances of the typeT
with the given IDs.java.util.concurrent.CompletableFuture<java.lang.Boolean>
deleteAllById(java.util.Collection<? extends ID> colIds)
Alias forAbstractAsyncRepository.removeAllById(Collection)
.java.util.concurrent.CompletableFuture<java.util.Map<ID,T>>
deleteAllById(java.util.Collection<? extends ID> colIds, boolean fReturn)
Alias forAbstractAsyncRepository.removeAllById(Collection, boolean)
.java.util.concurrent.CompletableFuture<java.lang.Void>
deleteById(ID id)
Deletes the entity with the given id.java.util.concurrent.CompletableFuture<java.lang.Boolean>
existsById(ID id)
Returns whether an entity with the given id exists.java.util.concurrent.CompletableFuture<java.lang.Iterable<T>>
findAll()
Returns all instances of the type.java.util.concurrent.CompletableFuture<java.lang.Iterable<T>>
findAllById(java.lang.Iterable<ID> ids)
Returns all instances of the typeT
with the given IDs.java.util.concurrent.CompletableFuture<java.util.Optional<T>>
findById(ID id)
Retrieves an entity by its id.protected java.lang.Class<? extends T>
getEntityType()
protected ID
getId(T t)
com.tangosol.net.AsyncNamedMap<ID,T>
getMap()
<S extends T>
java.util.concurrent.CompletableFuture<java.lang.Iterable<S>>saveAll(java.lang.Iterable<S> entities)
Saves all given entities.-
Methods inherited from class com.oracle.coherence.repository.AbstractAsyncRepository
average, average, average, average, average, average, average, average, count, distinct, distinct, exists, get, get, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAllOrderedBy, getAllOrderedBy, getAllOrderedBy, getAllOrderedBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, max, max, max, max, max, max, max, max, max, max, maxBy, maxBy, min, min, min, min, min, min, min, min, min, min, minBy, minBy, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeAllById, removeAllById, removeById, removeById, save, saveAll, saveAll, sum, sum, sum, sum, sum, sum, sum, sum, top, top, top, top, topBy, topBy, topBy, topBy, update, update, update, update, update, update, updateAll, updateAll, updateAll
-
-
-
-
Constructor Detail
-
BackingAsyncRepository
public BackingAsyncRepository(com.tangosol.net.NamedMap<ID,T> namedMap, org.springframework.data.mapping.context.MappingContext<CoherencePersistentEntity<T>,CoherencePersistentProperty> mappingContext, java.lang.Class<? extends T> domainType)
-
-
Method Detail
-
getEntityType
protected java.lang.Class<? extends T> getEntityType()
-
count
public java.util.concurrent.CompletableFuture<java.lang.Long> count()
-
delete
public java.util.concurrent.CompletableFuture<java.lang.Void> delete(T entity)
Deletes a given entity.- Parameters:
entity
- must not be null- Returns:
- a
CompletableFuture
- Throws:
java.lang.IllegalArgumentException
- in case the given entity is null.
-
deleteById
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteById(ID id)
Deletes the entity with the given id.- Parameters:
id
- must not be null- Returns:
- a
CompletableFuture
- Throws:
java.lang.IllegalArgumentException
- in case the given id is null
-
deleteAll
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteAll(java.lang.Iterable<? extends T> entities)
Deletes the given entities.- Parameters:
entities
- must not be null. Must not contain null elements- Returns:
- a
CompletableFuture
- Throws:
java.lang.IllegalArgumentException
- in case the given entities or one of its entities is null.
-
saveAll
public <S extends T> java.util.concurrent.CompletableFuture<java.lang.Iterable<S>> saveAll(java.lang.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:
java.lang.IllegalArgumentException
- in case the givenentities
or one of its entities is null.
-
findById
public java.util.concurrent.CompletableFuture<java.util.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:
java.lang.IllegalArgumentException
- if id is null.
-
findAll
public java.util.concurrent.CompletableFuture<java.lang.Iterable<T>> findAll()
Returns all instances of the type.- Returns:
- all entities
-
findAllById
public java.util.concurrent.CompletableFuture<java.lang.Iterable<T>> findAllById(java.lang.Iterable<ID> ids)
Returns all instances of the typeT
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:
java.lang.IllegalArgumentException
- in case the givenids
or one of its items is null.
-
existsById
public java.util.concurrent.CompletableFuture<java.lang.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:
java.lang.IllegalArgumentException
- if id is null.
-
deleteAll
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll()
Deletes all entities managed by the repository.- Returns:
- a
CompletableFuture
-
delete
public java.util.concurrent.CompletableFuture<T> delete(T entity, boolean fReturn)
Alias forAbstractAsyncRepository.remove(Object, boolean)
.- Parameters:
entity
- the entity to removefReturn
- the flag specifying whether to return removed entity- Returns:
- deleted entity, iff
fReturn == true
;null
otherwise
-
deleteAllById
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteAllById(java.lang.Iterable<? extends ID> ids)
Deletes all instances of the typeT
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 java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteAllById(java.util.Collection<? extends ID> colIds)
Alias forAbstractAsyncRepository.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 java.util.concurrent.CompletableFuture<java.util.Map<ID,T>> deleteAllById(java.util.Collection<? extends ID> colIds, boolean fReturn)
Alias forAbstractAsyncRepository.removeAllById(Collection, boolean)
.- Parameters:
colIds
- the identifiers of the entities to removefReturn
- 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 java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteAll(java.util.Collection<? extends T> colEntities)
Alias forAbstractAsyncRepository.removeAll(Collection)
.- Parameters:
colEntities
- the entities to remove- Returns:
true
if this repository changed as a result of the call
-
deleteAll
public java.util.concurrent.CompletableFuture<java.util.Map<ID,T>> deleteAll(java.util.Collection<? extends T> colEntities, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Collection, boolean)
.- Parameters:
colEntities
- the entities to removefReturn
- 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 java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteAll(java.util.stream.Stream<? extends T> strEntities)
Alias forAbstractAsyncRepository.removeAll(Stream)
.- Parameters:
strEntities
- the entities to remove- Returns:
true
if this repository changed as a result of the call
-
deleteAll
public java.util.concurrent.CompletableFuture<java.util.Map<ID,T>> deleteAll(java.util.stream.Stream<? extends T> strEntities, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Stream, boolean)
.- Parameters:
strEntities
- the entities to removefReturn
- 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 java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteAll(com.tangosol.util.Filter<?> filter)
Alias forAbstractAsyncRepository.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 java.util.concurrent.CompletableFuture<java.util.Map<ID,T>> deleteAll(com.tangosol.util.Filter<?> filter, boolean fReturn)
Alias forAbstractAsyncRepository.removeAll(Filter, boolean)
.- Parameters:
filter
- the criteria that should be used to select entities to removefReturn
- 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
-
-