Class JmixDataRepositoryImpl<T,ID>

java.lang.Object
io.jmix.core.impl.repository.support.JmixDataRepositoryImpl<T,ID>
Type Parameters:
T -
ID -
All Implemented Interfaces:
JmixDataRepository<T,ID>, org.springframework.data.repository.CrudRepository<T,ID>, org.springframework.data.repository.PagingAndSortingRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>

@NoRepositoryBean public class JmixDataRepositoryImpl<T,ID> extends Object implements JmixDataRepository<T,ID>
Implementation of base repository methods used by application repository beans.
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public T create()
      Description copied from interface: JmixDataRepository
      Instantiate an entity. Invokes Metadata.create(Class)
      Specified by:
      create in interface JmixDataRepository<T,ID>
      Returns:
      new instance of <T>.
    • findById

      public Optional<T> findById(ID id, FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Loads an entity by its id according to fetchPlan
      Specified by:
      findById in interface JmixDataRepository<T,ID>
      Parameters:
      id - must not be null.
      Returns:
      the entity with the given id or Optional#empty() if none found.
    • getById

      public T getById(ID id, FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Loads an entity by its id according to fetchPlan
      Specified by:
      getById in interface JmixDataRepository<T,ID>
      Parameters:
      id - must not be null.
      Returns:
      the entity with the given id
    • findAll

      public Iterable<T> findAll(FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Returns all instances of the type T loaded according to fetchPlan
      Specified by:
      findAll in interface JmixDataRepository<T,ID>
      Returns:
      all entities
    • findAll

      public Iterable<T> findAll(Iterable<ID> ids, @Nullable FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Returns all instances of the type T with the given IDs loaded according to fetchPlan

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

      Specified by:
      findAll in interface JmixDataRepository<T,ID>
      Parameters:
      ids - must not be null nor contain any null values.
      fetchPlan - defines entity graph to load. FetchPlan.BASE will be used instead in case of null.
      Returns:
      guaranteed to be not null. The size can be equal or less than the number of given ids.
    • save

      public <S extends T> S save(S entity)
      Specified by:
      save in interface org.springframework.data.repository.CrudRepository<T,ID>
    • saveAll

      public <S extends T> Iterable<S> saveAll(Iterable<S> entities)
      Specified by:
      saveAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findById

      public Optional<T> findById(ID id)
      Specified by:
      findById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • existsById

      public boolean existsById(ID id)
      Specified by:
      existsById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findAll

      public Iterable<T> findAll()
      Specified by:
      findAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findAllById

      public Iterable<T> findAllById(Iterable<ID> ids)
      Specified by:
      findAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • count

      public long count()
      Specified by:
      count in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteById

      public void deleteById(ID id)
      Specified by:
      deleteById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • delete

      public void delete(T entity)
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll(Iterable<? extends T> entities)
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAllById

      public void deleteAllById(Iterable<? extends ID> ids)
      Specified by:
      deleteAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteInternal

      protected void deleteInternal(Object... entities)
    • getDomainClass

      public Class<T> getDomainClass()
    • setDomainClass

      public void setDomainClass(Class<T> domainClass)
    • findAll

      public Iterable<T> findAll(org.springframework.data.domain.Sort sort)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID>
    • findAll

      public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID>
    • findAll

      public Iterable<T> findAll(org.springframework.data.domain.Sort sort, @Nullable FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Returns all entities sorted by the given options and loaded by specified FetchPlan.
      Specified by:
      findAll in interface JmixDataRepository<T,ID>
      fetchPlan - to load entity. FetchPlan.BASE will be used if fetchPlan == null
      Returns:
      all entities sorted by the given options
    • findAll

      public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable, @Nullable FetchPlan fetchPlan)
      Description copied from interface: JmixDataRepository
      Returns a Page of entities meeting the paging restriction provided in the Pageable object. Entities will be loaded according to passed fetchPlan
      Specified by:
      findAll in interface JmixDataRepository<T,ID>
      fetchPlan - to load entities. FetchPlan.BASE will be used if fetchPlan == null
      Returns:
      a page of entities
    • getDataManager

      protected UnconstrainedDataManager getDataManager()
    • getHints

      protected Map<String,Serializable> getHints()
    • allLoader

      protected FluentLoader.ByCondition<T> allLoader()
    • idLoader

      protected FluentLoader.ById<T> idLoader(ID id)
    • toCollection

      protected Collection<ID> toCollection(Iterable<ID> ids)