Package io.jmix.flowui.model.impl
Class InstanceLoaderImpl<E>
java.lang.Object
io.jmix.flowui.model.impl.InstanceLoaderImpl<E>
- All Implemented Interfaces:
DataLoader
,InstanceLoader<E>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.model.InstanceLoader
InstanceLoader.PostLoadEvent<T>, InstanceLoader.PreLoadEvent<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected Condition
protected InstanceContainer<E>
protected DataContext
protected DataManager
protected Function<LoadContext<E>,
E> protected Object
protected EventHub
protected FetchPlan
protected String
protected FetchPlanRepository
protected Map<String,
Serializable> protected Metadata
protected io.micrometer.core.instrument.MeterRegistry
protected Function<DataLoader,
DataLoaderMonitoringInfo> protected String
protected List<QueryStringProcessor>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddPostLoadListener
(Consumer<InstanceLoader.PostLoadEvent<E>> listener) Adds a listener toInstanceLoader.PostLoadEvent
.addPreLoadListener
(Consumer<InstanceLoader.PreLoadEvent<E>> listener) Adds a listener toInstanceLoader.PreLoadEvent
.Returns the root condition which is used together with the query when loading entities.Returns the container which accepts the loaded entity.Returns data context.Returns id of the entity to load.Returns the fetch plan used for loading the entity.getHints()
Returns a function which will be used to load data instead of standard implementation.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.void
load()
Loads data to the connected container.protected boolean
needLoad()
void
removeParameter
(String name) Removes a query parameter.protected FetchPlan
protected void
sendPostLoadEvent
(E entity) protected boolean
sendPreLoadEvent
(LoadContext<E> loadContext) void
setCondition
(Condition condition) Sets the root condition which will be used together with the query when loading entities.void
setContainer
(InstanceContainer<E> container) Sets the container which accepts the loaded entity.void
setDataContext
(DataContext dataContext) Sets the data context for the loader.void
setEntityId
(Object entityId) Sets the id of the entity to load.void
setFetchPlan
(FetchPlan fetchPlan) Sets the fetch plan to use for loading the entity.void
setFetchPlan
(String fetchPlanName) Sets the name of the fetch plan to use for loading the entity.void
setHint
(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.void
setLoadDelegate
(Function<LoadContext<E>, E> delegate) Sets a function which will be used to load data instead of standard implementation.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.
-
Field Details
-
dataManager
-
fetchPlanRepository
-
queryStringProcessors
-
metadata
-
meterRegistry
@Autowired protected io.micrometer.core.instrument.MeterRegistry meterRegistry -
dataContext
-
container
-
query
-
condition
-
parameters
-
entityId
-
fetchPlan
-
fetchPlanName
-
hints
-
delegate
-
events
-
monitoringInfoProvider
-
-
Constructor Details
-
InstanceLoaderImpl
public InstanceLoaderImpl()
-
-
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
-
needLoad
protected boolean needLoad() -
createLoadContext
-
resolveFetchPlan
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:InstanceLoader
Returns the container which accepts the loaded entity.- Specified by:
getContainer
in interfaceDataLoader
- Specified by:
getContainer
in interfaceInstanceLoader<E>
-
setContainer
Description copied from interface:InstanceLoader
Sets the container which accepts the loaded entity.- Specified by:
setContainer
in interfaceInstanceLoader<E>
-
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
-
getEntityId
Description copied from interface:InstanceLoader
Returns id of the entity to load.- Specified by:
getEntityId
in interfaceInstanceLoader<E>
-
setEntityId
Description copied from interface:InstanceLoader
Sets the id of the entity to load.- Specified by:
setEntityId
in interfaceInstanceLoader<E>
-
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:InstanceLoader
Returns a function which will be used to load data instead of standard implementation.- Specified by:
getLoadDelegate
in interfaceInstanceLoader<E>
-
setLoadDelegate
Description copied from interface:InstanceLoader
Sets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegate
in interfaceInstanceLoader<E>
-
addPreLoadListener
Description copied from interface:InstanceLoader
Adds a listener toInstanceLoader.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(InstanceLoader.PreLoadEvent<Foo> event) { // handle event here }
- Specified by:
addPreLoadListener
in interfaceInstanceLoader<E>
- Parameters:
listener
- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:InstanceLoader
Adds a listener toInstanceLoader.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(InstanceLoader.PostLoadEvent<Foo> event) { // handle event here }
- Specified by:
addPostLoadListener
in interfaceInstanceLoader<E>
- Parameters:
listener
- listener- Returns:
- subscription
-
getFetchPlan
Description copied from interface:InstanceLoader
Returns the fetch plan used for loading the entity.- Specified by:
getFetchPlan
in interfaceInstanceLoader<E>
-
setFetchPlan
Description copied from interface:InstanceLoader
Sets the fetch plan to use for loading the entity.- Specified by:
setFetchPlan
in interfaceInstanceLoader<E>
-
setFetchPlan
Description copied from interface:InstanceLoader
Sets the name of the fetch plan to use for loading the entity.- Specified by:
setFetchPlan
in interfaceInstanceLoader<E>
-