Package io.jmix.flowui.model.impl
Class KeyValueInstanceLoaderImpl
java.lang.Object
io.jmix.flowui.model.impl.KeyValueInstanceLoaderImpl
- All Implemented Interfaces:
DataLoader
,KeyValueInstanceLoader
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.model.KeyValueInstanceLoader
KeyValueInstanceLoader.PostLoadEvent, KeyValueInstanceLoader.PreLoadEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected Condition
protected KeyValueContainer
protected DataContext
protected DataManager
protected Function<ValueLoadContext,
KeyValueEntity> protected EventHub
protected Map<String,
Serializable> protected String
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a listener toKeyValueInstanceLoader.PostLoadEvent
.Adds a listener toKeyValueInstanceLoader.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.getHints()
Returns a function which will be used to load data instead of standard implementation.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.Returns data store name.void
load()
Loads data to the connected container.void
removeParameter
(String name) Removes a query parameter.protected void
sendPostLoadEvent
(KeyValueEntity entity) 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
(KeyValueContainer container) Sets the container which accepts loaded entities.void
setDataContext
(DataContext dataContext) Sets the data context for the loader.void
setHint
(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.void
setLoadDelegate
(Function<ValueLoadContext, KeyValueEntity> delegate) Sets a function which will be used to load data instead of standard implementation.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
setStoreName
(String name) Sets the data store name.
-
Field Details
-
dataManager
-
dataContext
-
container
-
query
-
condition
-
parameters
-
hints
-
storeName
-
delegate
-
events
-
-
Constructor Details
-
KeyValueInstanceLoaderImpl
public KeyValueInstanceLoaderImpl()
-
-
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
-
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:KeyValueInstanceLoader
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 interfaceKeyValueInstanceLoader
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:KeyValueInstanceLoader
Returns the container which accepts loaded entities.- Specified by:
getContainer
in interfaceDataLoader
- Specified by:
getContainer
in interfaceKeyValueInstanceLoader
-
setContainer
Description copied from interface:KeyValueInstanceLoader
Sets the container which accepts loaded entities.- Specified by:
setContainer
in interfaceKeyValueInstanceLoader
-
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
-
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.
-
getLoadDelegate
Description copied from interface:KeyValueInstanceLoader
Returns a function which will be used to load data instead of standard implementation.- Specified by:
getLoadDelegate
in interfaceKeyValueInstanceLoader
-
setLoadDelegate
Description copied from interface:KeyValueInstanceLoader
Sets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegate
in interfaceKeyValueInstanceLoader
-
addPreLoadListener
Description copied from interface:KeyValueInstanceLoader
Adds a listener toKeyValueInstanceLoader.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(KeyValueInstanceLoader.PreLoadEvent event) { // handle event here }
- Specified by:
addPreLoadListener
in interfaceKeyValueInstanceLoader
- Parameters:
listener
- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:KeyValueInstanceLoader
Adds a listener toKeyValueInstanceLoader.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(KeyValueInstanceLoader.PostLoadEvent event) { // handle event here }
- Specified by:
addPostLoadListener
in interfaceKeyValueInstanceLoader
- Parameters:
listener
- listener- Returns:
- subscription
-
getStoreName
Description copied from interface:KeyValueInstanceLoader
Returns data store name.- Specified by:
getStoreName
in interfaceKeyValueInstanceLoader
-
setStoreName
Description copied from interface:KeyValueInstanceLoader
Sets the data store name. By default, the main data store is used.- Specified by:
setStoreName
in interfaceKeyValueInstanceLoader
-