Package io.jmix.ui.model.impl
Class KeyValueCollectionLoaderImpl
java.lang.Object
io.jmix.ui.model.impl.KeyValueCollectionLoaderImpl
- All Implemented Interfaces:
BaseCollectionLoader
,DataLoader
,KeyValueCollectionLoader
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.model.KeyValueCollectionLoader
KeyValueCollectionLoader.PostLoadEvent, KeyValueCollectionLoader.PreLoadEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected Condition
protected KeyValueCollectionContainer
protected DataContext
protected DataManager
protected Function<ValueLoadContext,
List<KeyValueEntity>> protected EventHub
protected int
protected Map<String,
Serializable> protected int
protected io.micrometer.core.instrument.MeterRegistry
protected Function<DataLoader,
DataLoaderMonitoringInfo> protected String
protected Sort
protected SorterFactory
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a listener toKeyValueCollectionLoader.PostLoadEvent
.Adds a listener toKeyValueCollectionLoader.PreLoadEvent
.ReturnsValueLoadContext
which is created by the parameters of this loader.Returns the root condition which is used together with the query when loading entities.Returns the container which accepts loaded entities.Returns data context.Returns a function which will be used to load data instead of standard implementation.int
The position of the first instance to load, numbered from 0.getHints()
int
The maximum number of instances to load.Returns function that provides monitoring info about this data loader.getParameter
(String name) Returns a query parameter by its name.Returns the map of query parameters.getQuery()
Returns the query which is used for loading entities.getSort()
Returns the sort object which is used when loading.Returns data store name.void
load()
Loads data to the connected container.void
removeParameter
(String name) Removes a query parameter.protected void
sendPostLoadEvent
(List<KeyValueEntity> entities) protected boolean
sendPreLoadEvent
(ValueLoadContext loadContext) void
setCondition
(Condition condition) Sets the root condition which will be used together with the query when loading entities.void
setContainer
(KeyValueCollectionContainer container) Sets the container which accepts loaded entities.void
setDataContext
(DataContext dataContext) Sets the data context for the loader.void
setFirstResult
(int firstResult) Sets the position of the first instance to load, numbered from 0.void
setHint
(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.void
setLoadDelegate
(Function<ValueLoadContext, List<KeyValueEntity>> delegate) Sets a function which will be used to load data instead of standard implementation.void
setMaxResults
(int maxResults) Sets the maximum number of instances to load.void
setMonitoringInfoProvider
(Function<DataLoader, DataLoaderMonitoringInfo> monitoringInfoProvider) Sets function that provides monitoring info about this data loader.void
setParameter
(String name, Object value) Sets a query parameter.void
setParameters
(Map<String, Object> parameters) Sets the map of query parameters.void
Sets a query which will be used for loading entities.void
Sets the sort object which is used when loading.void
setStoreName
(String name) Sets the data store name.
-
Field Details
-
dataManager
-
sorterFactory
-
meterRegistry
@Autowired protected io.micrometer.core.instrument.MeterRegistry meterRegistry -
dataContext
-
container
-
query
-
condition
-
parameters
-
firstResult
protected int firstResult -
maxResults
protected int maxResults -
sort
-
hints
-
storeName
-
delegate
-
events
-
monitoringInfoProvider
-
-
Constructor Details
-
KeyValueCollectionLoaderImpl
public KeyValueCollectionLoaderImpl()
-
-
Method Details
-
getDataContext
Description copied from interface:DataLoader
Returns data context. If the data context is set, all loaded instance will be merged into it.- Specified by:
getDataContext
in interfaceDataLoader
-
setDataContext
Description copied from interface:DataLoader
Sets the data context for the loader. If the data context is set, all loaded instance will be merged into it.- Specified by:
setDataContext
in interfaceDataLoader
-
setMonitoringInfoProvider
public void setMonitoringInfoProvider(Function<DataLoader, DataLoaderMonitoringInfo> monitoringInfoProvider) Description copied from interface:DataLoader
Sets function that provides monitoring info about this data loader.- Specified by:
setMonitoringInfoProvider
in interfaceDataLoader
-
getMonitoringInfoProvider
Description copied from interface:DataLoader
Returns function that provides monitoring info about this data loader.- Specified by:
getMonitoringInfoProvider
in interfaceDataLoader
-
load
public void load()Description copied from interface:DataLoader
Loads data to the connected container.- Specified by:
load
in interfaceDataLoader
-
createLoadContext
Description copied from interface:KeyValueCollectionLoader
ReturnsValueLoadContext
which is created by the parameters of this loader. TheValueLoadContext
can be used withDataManager
to load data by the same conditions.- Specified by:
createLoadContext
in interfaceKeyValueCollectionLoader
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:KeyValueCollectionLoader
Returns the container which accepts loaded entities.- Specified by:
getContainer
in interfaceBaseCollectionLoader
- Specified by:
getContainer
in interfaceDataLoader
- Specified by:
getContainer
in interfaceKeyValueCollectionLoader
-
setContainer
Description copied from interface:KeyValueCollectionLoader
Sets the container which accepts loaded entities.- Specified by:
setContainer
in interfaceKeyValueCollectionLoader
-
getQuery
Description copied from interface:DataLoader
Returns the query which is used for loading entities.- Specified by:
getQuery
in interfaceDataLoader
-
setQuery
Description copied from interface:DataLoader
Sets a query which will be used for loading entities.- Specified by:
setQuery
in interfaceDataLoader
-
getCondition
Description copied from interface:DataLoader
Returns the root condition which is used together with the query when loading entities.- Specified by:
getCondition
in interfaceDataLoader
-
setCondition
Description copied from interface:DataLoader
Sets the root condition which will be used together with the query when loading entities.- Specified by:
setCondition
in interfaceDataLoader
-
getParameters
Description copied from interface:DataLoader
Returns the map of query parameters.- Specified by:
getParameters
in interfaceDataLoader
-
setParameters
Description copied from interface:DataLoader
Sets the map of query parameters.- Specified by:
setParameters
in interfaceDataLoader
-
getParameter
Description copied from interface:DataLoader
Returns a query parameter by its name.- Specified by:
getParameter
in interfaceDataLoader
-
setParameter
Description copied from interface:DataLoader
Sets a query parameter.- Specified by:
setParameter
in interfaceDataLoader
-
removeParameter
Description copied from interface:DataLoader
Removes a query parameter.- Specified by:
removeParameter
in interfaceDataLoader
-
getMaxResults
public int getMaxResults()Description copied from interface:BaseCollectionLoader
The maximum number of instances to load. ReturnsInteger.MAX_VALUE
ifBaseCollectionLoader.setMaxResults(int)
was not called.- Specified by:
getMaxResults
in interfaceBaseCollectionLoader
-
setMaxResults
public void setMaxResults(int maxResults) Description copied from interface:BaseCollectionLoader
Sets the maximum number of instances to load.- Specified by:
setMaxResults
in interfaceBaseCollectionLoader
-
getSort
Description copied from interface:BaseCollectionLoader
Returns the sort object which is used when loading.- Specified by:
getSort
in interfaceBaseCollectionLoader
-
setSort
Description copied from interface:BaseCollectionLoader
Sets the sort object which is used when loading.- Specified by:
setSort
in interfaceBaseCollectionLoader
-
setHint
Description copied from interface:DataLoader
Sets custom hint that should be used by the query for loading data.- Specified by:
setHint
in interfaceDataLoader
-
getHints
- Specified by:
getHints
in interfaceDataLoader
- Returns:
- custom hints which are used by the query for loading data.
-
getDelegate
Description copied from interface:KeyValueCollectionLoader
Returns a function which will be used to load data instead of standard implementation.- Specified by:
getDelegate
in interfaceKeyValueCollectionLoader
-
setLoadDelegate
Description copied from interface:KeyValueCollectionLoader
Sets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegate
in interfaceKeyValueCollectionLoader
-
addPreLoadListener
Description copied from interface:KeyValueCollectionLoader
Adds a listener toKeyValueCollectionLoader.PreLoadEvent
.You can also add an event listener declaratively using a controller method annotated with
Subscribe
:@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPreLoad(KeyValueCollectionLoader.PreLoadEvent event) { // handle event here }
- Specified by:
addPreLoadListener
in interfaceKeyValueCollectionLoader
- Parameters:
listener
- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:KeyValueCollectionLoader
Adds a listener toKeyValueCollectionLoader.PostLoadEvent
.You can also add an event listener declaratively using a controller method annotated with
Subscribe
:@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPostLoad(KeyValueCollectionLoader.PostLoadEvent event) { // handle event here }
- Specified by:
addPostLoadListener
in interfaceKeyValueCollectionLoader
- Parameters:
listener
- listener- Returns:
- subscription
-
getStoreName
Description copied from interface:KeyValueCollectionLoader
Returns data store name.- Specified by:
getStoreName
in interfaceKeyValueCollectionLoader
-
setStoreName
Description copied from interface:KeyValueCollectionLoader
Sets the data store name. By default, the main data store is used.- Specified by:
setStoreName
in interfaceKeyValueCollectionLoader
-
getFirstResult
public int getFirstResult()Description copied from interface:BaseCollectionLoader
The position of the first instance to load, numbered from 0. Returns 0 ifBaseCollectionLoader.setFirstResult(int)
was not called.- Specified by:
getFirstResult
in interfaceBaseCollectionLoader
-
setFirstResult
public void setFirstResult(int firstResult) Description copied from interface:BaseCollectionLoader
Sets the position of the first instance to load, numbered from 0.- Specified by:
setFirstResult
in interfaceBaseCollectionLoader
-