Package io.jmix.core.datastore
Class AbstractDataStore
java.lang.Object
io.jmix.core.datastore.AbstractDataStore
- All Implemented Interfaces:
DataStore
- Direct Known Subclasses:
JpaDataStore
,RestDataStore
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static interface
Designed to store and share various data during load transaction. -
Field Summary
Modifier and TypeFieldDescriptionprotected EntityStates
protected KeyValueMapper
protected final List<DataStoreEventListener>
protected Metadata
protected MetadataTools
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
beforeLoadTransactionCommit
(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) protected void
beforeSaveTransactionCommit
(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) protected void
beforeSaveTransactionRollback
(SaveContext context) protected abstract Object
beginLoadTransaction
(boolean joinTransaction) protected abstract Object
beginSaveTransaction
(boolean joinTransaction) checkAndReorderLoadedEntities
(LoadContext<?> context, List<Object> entities) protected abstract void
commitTransaction
(Object transaction) protected void
copyNonPersistentAttributes
(Object source, Object destination) protected abstract long
countAll
(LoadContext<?> context) protected abstract long
countAllValues
(ValueLoadContext context) deleteAll
(SaveContext context) protected <T extends BaseDataStoreEvent>
voidfireEvent
(T event) long
getCount
(LoadContext<?> context) Returns the number of entity instances for the given query passed in theLoadContext
.long
getCount
(ValueLoadContext context) Returns the number of key-value pairs for the given query passed in theValueLoadContext
.protected FetchPlan
getFetchPlanForSave
(Map<Object, FetchPlan> fetchPlans, Object entity) protected abstract AbstractDataStore.TransactionContextState
getTransactionContextState
(boolean isJoinTransaction) Invoked afterbeginLoadTransaction(boolean)
.load
(LoadContext<?> context) Loads a single entity instance.loadAll
(LoadContext<?> context) loadAllAfterSave
(SaveContext context, Set<Object> savedEntities) loadAllValues
(ValueLoadContext context) loadList
(LoadContext<?> context) Loads collection of entity instances.loadListByBatches
(LoadContext<?> context, int actualSize, EventSharedState eventState) protected abstract Object
loadOne
(LoadContext<?> context) loadValues
(ValueLoadContext context) Loads list of key-value pairs.void
registerInterceptor
(DataStoreEventListener listener) protected abstract void
rollbackTransaction
(Object transaction) Set<?>
save
(SaveContext context) Saves a collection of entity instances.saveAll
(SaveContext context) void
setEntityStates
(EntityStates entityStates) void
setKeyValueMapper
(KeyValueMapper keyValueMapper) void
setMetadata
(Metadata metadata) void
setMetadataTools
(MetadataTools metadataTools)
-
Field Details
-
listeners
-
metadata
-
metadataTools
-
entityStates
-
keyValueMapper
-
-
Constructor Details
-
AbstractDataStore
public AbstractDataStore()
-
-
Method Details
-
setMetadata
-
setMetadataTools
-
setEntityStates
-
setKeyValueMapper
-
load
Description copied from interface:DataStore
Loads a single entity instance. -
loadList
Description copied from interface:DataStore
Loads collection of entity instances. -
getCount
Description copied from interface:DataStore
Returns the number of entity instances for the given query passed in theLoadContext
. -
save
Description copied from interface:DataStore
Saves a collection of entity instances. -
loadValues
Description copied from interface:DataStore
Loads list of key-value pairs.- Specified by:
loadValues
in interfaceDataStore
- Parameters:
context
- defines a query for scalar values and a list of keys for returned KeyValueEntity- Returns:
- list of KeyValueEntity instances
-
getCount
Description copied from interface:DataStore
Returns the number of key-value pairs for the given query passed in theValueLoadContext
. -
loadOne
-
loadAll
-
countAll
-
saveAll
-
deleteAll
-
loadAllValues
-
countAllValues
-
beginLoadTransaction
-
beginSaveTransaction
-
commitTransaction
-
rollbackTransaction
-
getTransactionContextState
protected abstract AbstractDataStore.TransactionContextState getTransactionContextState(boolean isJoinTransaction) Invoked afterbeginLoadTransaction(boolean)
.
Override this method to createAbstractDataStore.TransactionContextState
implementation and store required data in it. -
beforeLoadTransactionCommit
protected void beforeLoadTransactionCommit(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) -
beforeSaveTransactionCommit
protected void beforeSaveTransactionCommit(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) -
beforeSaveTransactionRollback
-
registerInterceptor
-
fireEvent
-
checkAndReorderLoadedEntities
-
loadAllAfterSave
-
getFetchPlanForSave
-
copyNonPersistentAttributes
-