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
FieldsModifier and TypeFieldDescriptionprotected Conditionprotected InstanceContainer<E>protected DataContextprotected DataManagerprotected Function<LoadContext<E>,E> protected Objectprotected EventHubprotected FetchPlanprotected Stringprotected FetchPlanRepositoryprotected Map<String,Serializable> protected Metadataprotected io.micrometer.core.instrument.MeterRegistryprotected Function<DataLoader,DataLoaderMonitoringInfo> protected Stringprotected List<QueryStringProcessor> -
Constructor Summary
Constructors -
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.voidload()Loads data to the connected container.protected booleanneedLoad()voidremoveParameter(String name) Removes a query parameter.protected FetchPlanprotected voidsendPostLoadEvent(E entity) protected booleansendPreLoadEvent(LoadContext<E> loadContext) voidsetCondition(Condition condition) Sets the root condition which will be used together with the query when loading entities.voidsetContainer(InstanceContainer<E> container) Sets the container which accepts the loaded entity.voidsetDataContext(DataContext dataContext) Sets the data context for the loader.voidsetEntityId(Object entityId) Sets the id of the entity to load.voidsetFetchPlan(FetchPlan fetchPlan) Sets the fetch plan to use for loading the entity.voidsetFetchPlan(String fetchPlanName) Sets the name of the fetch plan to use for loading the entity.voidsetHint(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.voidsetLoadDelegate(Function<LoadContext<E>, E> delegate) Sets a function which will be used to load data instead of standard implementation.voidsetMonitoringInfoProvider(Function<DataLoader, DataLoaderMonitoringInfo> monitoringInfoProvider) Sets function that provides monitoring info about this data loader.voidsetParameter(String name, Object value) Sets a query parameter.voidsetParameters(Map<String, Object> parameters) Sets the map of query parameters.voidSets 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:DataLoaderReturns data context. If the data context is set, all loaded instance will be merged into it.- Specified by:
getDataContextin interfaceDataLoader
-
setDataContext
Description copied from interface:DataLoaderSets the data context for the loader. If the data context is set, all loaded instance will be merged into it.- Specified by:
setDataContextin interfaceDataLoader
-
setMonitoringInfoProvider
public void setMonitoringInfoProvider(Function<DataLoader, DataLoaderMonitoringInfo> monitoringInfoProvider) Description copied from interface:DataLoaderSets function that provides monitoring info about this data loader.- Specified by:
setMonitoringInfoProviderin interfaceDataLoader
-
getMonitoringInfoProvider
Description copied from interface:DataLoaderReturns function that provides monitoring info about this data loader.- Specified by:
getMonitoringInfoProviderin interfaceDataLoader
-
load
public void load()Description copied from interface:DataLoaderLoads data to the connected container.- Specified by:
loadin interfaceDataLoader
-
needLoad
protected boolean needLoad() -
createLoadContext
-
resolveFetchPlan
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:InstanceLoaderReturns the container which accepts the loaded entity.- Specified by:
getContainerin interfaceDataLoader- Specified by:
getContainerin interfaceInstanceLoader<E>
-
setContainer
Description copied from interface:InstanceLoaderSets the container which accepts the loaded entity.- Specified by:
setContainerin interfaceInstanceLoader<E>
-
getQuery
Description copied from interface:DataLoaderReturns the query which is used for loading entities.- Specified by:
getQueryin interfaceDataLoader
-
setQuery
Description copied from interface:DataLoaderSets a query which will be used for loading entities.- Specified by:
setQueryin interfaceDataLoader
-
getCondition
Description copied from interface:DataLoaderReturns the root condition which is used together with the query when loading entities.- Specified by:
getConditionin interfaceDataLoader
-
setCondition
Description copied from interface:DataLoaderSets the root condition which will be used together with the query when loading entities.- Specified by:
setConditionin interfaceDataLoader
-
getParameters
Description copied from interface:DataLoaderReturns the map of query parameters.- Specified by:
getParametersin interfaceDataLoader
-
setParameters
Description copied from interface:DataLoaderSets the map of query parameters.- Specified by:
setParametersin interfaceDataLoader
-
getParameter
Description copied from interface:DataLoaderReturns a query parameter by its name.- Specified by:
getParameterin interfaceDataLoader
-
setParameter
Description copied from interface:DataLoaderSets a query parameter.- Specified by:
setParameterin interfaceDataLoader
-
removeParameter
Description copied from interface:DataLoaderRemoves a query parameter.- Specified by:
removeParameterin interfaceDataLoader
-
getEntityId
Description copied from interface:InstanceLoaderReturns id of the entity to load.- Specified by:
getEntityIdin interfaceInstanceLoader<E>
-
setEntityId
Description copied from interface:InstanceLoaderSets the id of the entity to load.- Specified by:
setEntityIdin interfaceInstanceLoader<E>
-
setHint
Description copied from interface:DataLoaderSets custom hint that should be used by the query for loading data.- Specified by:
setHintin interfaceDataLoader
-
getHints
- Specified by:
getHintsin interfaceDataLoader- Returns:
- custom hints which are used by the query for loading data.
-
getLoadDelegate
Description copied from interface:InstanceLoaderReturns a function which will be used to load data instead of standard implementation.- Specified by:
getLoadDelegatein interfaceInstanceLoader<E>
-
setLoadDelegate
Description copied from interface:InstanceLoaderSets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegatein interfaceInstanceLoader<E>
-
addPreLoadListener
Description copied from interface:InstanceLoaderAdds 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:
addPreLoadListenerin interfaceInstanceLoader<E>- Parameters:
listener- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:InstanceLoaderAdds 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:
addPostLoadListenerin interfaceInstanceLoader<E>- Parameters:
listener- listener- Returns:
- subscription
-
getFetchPlan
Description copied from interface:InstanceLoaderReturns the fetch plan used for loading the entity.- Specified by:
getFetchPlanin interfaceInstanceLoader<E>
-
setFetchPlan
Description copied from interface:InstanceLoaderSets the fetch plan to use for loading the entity.- Specified by:
setFetchPlanin interfaceInstanceLoader<E>
-
setFetchPlan
Description copied from interface:InstanceLoaderSets the name of the fetch plan to use for loading the entity.- Specified by:
setFetchPlanin interfaceInstanceLoader<E>
-