Class BackingRepository<T,​ID>

  • Type Parameters:
    T - the entity type
    ID - the id type

    public class BackingRepository<T,​ID>
    extends com.oracle.coherence.repository.AbstractRepository<ID,​T>
    The BackingRepository is a Coherence Repository backing Coherence-based Spring repositories.
    Since:
    3.0
    Author:
    Ryan Lubke
    See Also:
    CoherenceRepository
    • 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>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(T entity)
      Deletes a given entity.
      T delete​(T entity, boolean fReturn)
      Alias for AbstractRepository.remove(Object, boolean).
      void deleteAll()
      Deletes all entities managed by the repository.
      boolean deleteAll​(com.tangosol.util.Filter<?> filter)
      Alias for AbstractRepository.removeAll(Filter).
      java.util.Map<ID,​T> deleteAll​(com.tangosol.util.Filter<?> filter, boolean fReturn)
      Alias for AbstractRepository.removeAll(Filter, boolean).
      void deleteAll​(java.lang.Iterable<? extends T> entities)
      Deletes the given entities.
      boolean deleteAll​(java.util.Collection<? extends T> colEntities)
      Alias for AbstractRepository.removeAll(Collection).
      java.util.Map<ID,​T> deleteAll​(java.util.Collection<? extends T> colEntities, boolean fReturn)
      Alias for AbstractRepository.removeAll(Collection, boolean).
      boolean deleteAll​(java.util.stream.Stream<? extends T> strEntities)
      Alias for AbstractRepository.removeAll(Stream).
      java.util.Map<ID,​T> deleteAll​(java.util.stream.Stream<? extends T> strEntities, boolean fReturn)
      Alias for AbstractRepository.removeAll(Stream, boolean).
      void deleteAllById​(java.lang.Iterable<? extends ID> ids)
      Deletes all instances of the type T with the given IDs.
      boolean deleteAllById​(java.util.Collection<? extends ID> colIds)
      Alias for AbstractRepository.removeAllById(Collection).
      java.util.Map<ID,​T> deleteAllById​(java.util.Collection<? extends ID> colIds, boolean fReturn)
      Alias for AbstractRepository.removeAllById(Collection, boolean).
      void deleteById​(ID id)
      Deletes the entity with the given id.
      boolean existsById​(ID id)
      Returns whether an entity with the given id exists.
      java.lang.Iterable<T> findAll()
      Returns all instances of the type.
      org.springframework.data.domain.Page<T> findAll​(org.springframework.data.domain.Pageable pageable)
      Returns a Page of entities meeting the paging restriction provided in the Pageable object.
      java.lang.Iterable<T> findAll​(org.springframework.data.domain.Sort sort)
      Returns all entities sorted by the given options.
      java.lang.Iterable<T> findAllById​(java.lang.Iterable<ID> ids)
      Returns all instances of the type T with the given IDs.
      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.NamedMap<ID,​T> getMap()  
      <S extends T>
      java.lang.Iterable<S>
      saveAll​(java.lang.Iterable<S> entities)
      Saves all given entities.
      • Methods inherited from class com.oracle.coherence.repository.AbstractRepository

        average, average, average, average, average, average, average, average, count, count, distinct, distinct, exists, get, get, 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, stream, stream, stream, 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
      • Methods inherited from class com.oracle.coherence.repository.AbstractRepositoryBase

        addListener, addListener, addListener, createIndices, ensureInitialized, instantiateMapListener, listener, removeListener, removeListener, removeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMap

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

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

        protected java.lang.Class<? extends T> getEntityType()
        Specified by:
        getEntityType in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,​T,​com.tangosol.net.NamedMap<ID,​T>>
      • delete

        public void delete​(T entity)
        Deletes a given entity.
        Parameters:
        entity - must not be null
        Throws:
        java.lang.IllegalArgumentException - in case the given entity is null.
      • deleteById

        public void deleteById​(ID id)
        Deletes the entity with the given id.
        Parameters:
        id - must not be null
        Throws:
        java.lang.IllegalArgumentException - in case the given id is null
      • deleteAll

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

        public <S extends T> 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 given entities or one of its entities is null.
      • findById

        public 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.lang.Iterable<T> findAll()
        Returns all instances of the type.
        Returns:
        all entities
      • findAll

        public java.lang.Iterable<T> findAll​(org.springframework.data.domain.Sort sort)
        Returns all entities sorted by the given options.
        Parameters:
        sort - the sort configuration
        Returns:
        all entities sorted by the given options
      • findAll

        public org.springframework.data.domain.Page<T> findAll​(org.springframework.data.domain.Pageable pageable)
        Returns a Page of entities meeting the paging restriction provided in the Pageable object.
        Parameters:
        pageable - paging metadata
        Returns:
        a page of entities
      • findAllById

        public java.lang.Iterable<T> findAllById​(java.lang.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:
        java.lang.IllegalArgumentException - in case the given ids or one of its items is null.
      • existsById

        public 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 void deleteAll()
        Deletes all entities managed by the repository.
      • delete

        public T delete​(T entity,
                        boolean fReturn)
        Alias for AbstractRepository.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 void deleteAllById​(java.lang.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.
      • deleteAllById

        public boolean deleteAllById​(java.util.Collection<? extends ID> colIds)
        Alias for AbstractRepository.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.Map<ID,​T> deleteAllById​(java.util.Collection<? extends ID> colIds,
                                                       boolean fReturn)
        Alias for AbstractRepository.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 boolean deleteAll​(java.util.Collection<? extends T> colEntities)
        Alias for AbstractRepository.removeAll(Collection).
        Parameters:
        colEntities - the entities to remove
        Returns:
        true if this repository changed as a result of the call
      • deleteAll

        public java.util.Map<ID,​T> deleteAll​(java.util.Collection<? extends T> colEntities,
                                                   boolean fReturn)
        Alias for AbstractRepository.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 boolean deleteAll​(java.util.stream.Stream<? extends T> strEntities)
        Alias for AbstractRepository.removeAll(Stream).
        Parameters:
        strEntities - the entities to remove
        Returns:
        true if this repository changed as a result of the call
      • deleteAll

        public java.util.Map<ID,​T> deleteAll​(java.util.stream.Stream<? extends T> strEntities,
                                                   boolean fReturn)
        Alias for AbstractRepository.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 boolean deleteAll​(com.tangosol.util.Filter<?> filter)
        Alias for AbstractRepository.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.Map<ID,​T> deleteAll​(com.tangosol.util.Filter<?> filter,
                                                   boolean fReturn)
        Alias for AbstractRepository.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