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 Summary
Modifier and TypeFieldDescriptionprotected DataManager
protected Metadata
protected CrudMethodMetadata.Accessor
protected UnconstrainedDataManager
-
Constructor Summary
ConstructorDescriptionJmixDataRepositoryImpl
(Class<T> domainClass, DataManager dataManager, Metadata metadata, CrudMethodMetadata.Accessor methodMetadataAccessor) -
Method Summary
Modifier and TypeMethodDescriptionprotected FluentLoader.ByCondition<T>
long
count()
create()
Instantiate an entity.void
void
void
void
deleteAllById
(Iterable<? extends ID> ids) void
deleteById
(ID id) protected void
deleteInternal
(Object... entities) boolean
existsById
(ID id) findAll()
Returns all instances of the typeT
loaded according tofetchPlan
Returns all instances of the typeT
with the given IDs loaded according tofetchPlan
org.springframework.data.domain.Page<T>
findAll
(org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<T>
Returns aPage
of entities meeting the paging restriction provided in thePageable
object.findAll
(org.springframework.data.domain.Sort sort) Returns all entities sorted by the given options and loaded by specified FetchPlan.findAllById
(Iterable<ID> ids) Loads an entity by itsid
according tofetchPlan
Loads an entity by itsid
according tofetchPlan
protected UnconstrainedDataManager
protected Map<String,
Serializable> getHints()
protected FluentLoader.ById<T>
<S extends T>
Ssave
(S entity) void
setDomainClass
(Class<T> domainClass) protected Collection<ID>
toCollection
(Iterable<ID> ids)
-
Field Details
-
metadata
-
unconstrainedDataManager
-
dataManager
-
methodMetadataAccessor
-
-
Constructor Details
-
JmixDataRepositoryImpl
public JmixDataRepositoryImpl(Class<T> domainClass, DataManager dataManager, Metadata metadata, CrudMethodMetadata.Accessor methodMetadataAccessor)
-
-
Method Details
-
create
Description copied from interface:JmixDataRepository
Instantiate an entity. InvokesMetadata.create(Class)
- Specified by:
create
in interfaceJmixDataRepository<T,
ID> - Returns:
- new instance of
<T>
.
-
findById
Description copied from interface:JmixDataRepository
Loads an entity by itsid
according tofetchPlan
- Specified by:
findById
in interfaceJmixDataRepository<T,
ID> - Parameters:
id
- must not be null.- Returns:
- the entity with the given id or Optional#empty() if none found.
-
getById
Description copied from interface:JmixDataRepository
Loads an entity by itsid
according tofetchPlan
- Specified by:
getById
in interfaceJmixDataRepository<T,
ID> - Parameters:
id
- must not be null.- Returns:
- the entity with the given id
-
findAll
Description copied from interface:JmixDataRepository
Returns all instances of the typeT
loaded according tofetchPlan
- Specified by:
findAll
in interfaceJmixDataRepository<T,
ID> - Returns:
- all entities
-
findAll
Description copied from interface:JmixDataRepository
Returns all instances of the typeT
with the given IDs loaded according tofetchPlan
If some or all ids are not found, no entities are returned for these IDs.
- Specified by:
findAll
in interfaceJmixDataRepository<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
-
saveAll
-
findById
-
existsById
-
findAll
-
findAllById
-
count
public long count() -
deleteById
-
delete
-
deleteAll
-
deleteAllById
-
deleteAll
public void deleteAll() -
deleteInternal
-
getDomainClass
-
setDomainClass
-
findAll
-
findAll
public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable) -
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 interfaceJmixDataRepository<T,
ID> fetchPlan
- to load entity.FetchPlan.BASE
will be used iffetchPlan == 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 aPage
of entities meeting the paging restriction provided in thePageable
object. Entities will be loaded according to passedfetchPlan
- Specified by:
findAll
in interfaceJmixDataRepository<T,
ID> fetchPlan
- to load entities.FetchPlan.BASE
will be used iffetchPlan == null
- Returns:
- a page of entities
-
getDataManager
-
getHints
-
allLoader
-
idLoader
-
toCollection
-