Package io.jmix.flowui.model.impl
Class CollectionLoaderImpl<E>
java.lang.Object
io.jmix.flowui.model.impl.CollectionLoaderImpl<E>
- All Implemented Interfaces:
BaseCollectionLoader,CollectionLoader<E>,DataLoader
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.model.CollectionLoader
CollectionLoader.PostLoadEvent<T>, CollectionLoader.PreLoadEvent<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Conditionprotected CollectionContainer<E>protected DataContextprotected DataManagerprotected Function<LoadContext<E>,List<E>> protected EventHubprotected FetchPlanprotected Stringprotected FetchPlanRepositoryprotected intprotected Map<String,Serializable> protected intprotected Stringprotected List<QueryStringProcessor>protected Sortprotected SorterFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_load()addPostLoadListener(Consumer<CollectionLoader.PostLoadEvent<E>> listener) Adds a listener toCollectionLoader.PostLoadEvent.addPreLoadListener(Consumer<CollectionLoader.PreLoadEvent<E>> listener) Adds a listener toCollectionLoader.PreLoadEvent.ReturnsLoadContextwhich 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 the fetch plan used for loading entities.intThe position of the first instance to load, numbered from 0.getHints()Function<LoadContext<E>,List<E>> Returns a function which will be used to load data instead of standard implementation.intThe maximum number of instances to load.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.booleanReturns true if the query for loading data is cacheable.voidload()Loads data to the connected container.voidremoveParameter(String name) Removes a query parameter.protected FetchPlanprotected voidsendPostLoadEvent(List<E> entities) protected booleansendPreLoadEvent(LoadContext<E> loadContext) voidsetCacheable(boolean cacheable) Sets the query for loading data cacheable.voidsetCondition(Condition condition) Sets the root condition which will be used together with the query when loading entities.voidsetContainer(CollectionContainer<E> container) Sets the container which accepts loaded entities.voidsetDataContext(DataContext dataContext) Sets the data context for the loader.voidsetFetchPlan(FetchPlan fetchPlan) Sets the fetch plan to use for loading entities.voidsetFetchPlan(String fetchPlanName) Sets the name of the fetch plan to use for loading entities.voidsetFirstResult(int firstResult) Sets the position of the first instance to load, numbered from 0.voidsetHint(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.voidsetLoadDelegate(Function<LoadContext<E>, List<E>> delegate) Sets a function which will be used to load data instead of standard implementation.voidsetMaxResults(int maxResults) Sets the maximum number of instances to load.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.voidSets the sort object which is used when loading.
-
Field Details
-
dataManager
-
fetchPlanRepository
-
sorterFactory
-
queryStringProcessors
-
dataContext
-
container
-
query
-
condition
-
parameters
-
firstResult
protected int firstResult -
maxResults
protected int maxResults -
cacheable
protected boolean cacheable -
fetchPlan
-
fetchPlanName
-
sort
-
hints
-
delegate
-
events
-
-
Constructor Details
-
CollectionLoaderImpl
public CollectionLoaderImpl()
-
-
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
-
load
public void load()Description copied from interface:DataLoaderLoads data to the connected container.- Specified by:
loadin interfaceDataLoader
-
_load
protected boolean _load() -
createLoadContext
Description copied from interface:CollectionLoaderReturnsLoadContextwhich is created by the parameters of this loader. TheLoadContextcan be used withDataManagerto load data by the same conditions.- Specified by:
createLoadContextin interfaceCollectionLoader<E>
-
resolveFetchPlan
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:CollectionLoaderReturns the container which accepts loaded entities.- Specified by:
getContainerin interfaceBaseCollectionLoader- Specified by:
getContainerin interfaceCollectionLoader<E>- Specified by:
getContainerin interfaceDataLoader
-
setContainer
Description copied from interface:CollectionLoaderSets the container which accepts loaded entities.- Specified by:
setContainerin interfaceCollectionLoader<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
-
getFirstResult
public int getFirstResult()Description copied from interface:BaseCollectionLoaderThe position of the first instance to load, numbered from 0. Returns 0 ifBaseCollectionLoader.setFirstResult(int)was not called.- Specified by:
getFirstResultin interfaceBaseCollectionLoader
-
setFirstResult
public void setFirstResult(int firstResult) Description copied from interface:BaseCollectionLoaderSets the position of the first instance to load, numbered from 0.- Specified by:
setFirstResultin interfaceBaseCollectionLoader
-
getMaxResults
public int getMaxResults()Description copied from interface:BaseCollectionLoaderThe maximum number of instances to load. ReturnsInteger.MAX_VALUEifBaseCollectionLoader.setMaxResults(int)was not called.- Specified by:
getMaxResultsin interfaceBaseCollectionLoader
-
setMaxResults
public void setMaxResults(int maxResults) Description copied from interface:BaseCollectionLoaderSets the maximum number of instances to load.- Specified by:
setMaxResultsin interfaceBaseCollectionLoader
-
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.
-
isCacheable
public boolean isCacheable()Description copied from interface:CollectionLoaderReturns true if the query for loading data is cacheable.- Specified by:
isCacheablein interfaceCollectionLoader<E>
-
setCacheable
public void setCacheable(boolean cacheable) Description copied from interface:CollectionLoaderSets the query for loading data cacheable.- Specified by:
setCacheablein interfaceCollectionLoader<E>
-
getFetchPlan
Description copied from interface:CollectionLoaderReturns the fetch plan used for loading entities.- Specified by:
getFetchPlanin interfaceCollectionLoader<E>
-
setFetchPlan
Description copied from interface:CollectionLoaderSets the fetch plan to use for loading entities.- Specified by:
setFetchPlanin interfaceCollectionLoader<E>
-
setFetchPlan
Description copied from interface:CollectionLoaderSets the name of the fetch plan to use for loading entities.- Specified by:
setFetchPlanin interfaceCollectionLoader<E>
-
getSort
Description copied from interface:BaseCollectionLoaderReturns the sort object which is used when loading.- Specified by:
getSortin interfaceBaseCollectionLoader
-
setSort
Description copied from interface:BaseCollectionLoaderSets the sort object which is used when loading.- Specified by:
setSortin interfaceBaseCollectionLoader
-
getLoadDelegate
Description copied from interface:CollectionLoaderReturns a function which will be used to load data instead of standard implementation.- Specified by:
getLoadDelegatein interfaceCollectionLoader<E>
-
setLoadDelegate
Description copied from interface:CollectionLoaderSets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegatein interfaceCollectionLoader<E>
-
addPreLoadListener
Description copied from interface:CollectionLoaderAdds a listener toCollectionLoader.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(CollectionLoader.PreLoadEvent event) { // handle event here }- Specified by:
addPreLoadListenerin interfaceCollectionLoader<E>- Parameters:
listener- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:CollectionLoaderAdds a listener toCollectionLoader.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(CollectionLoader.PostLoadEvent event) { // handle event here }- Specified by:
addPostLoadListenerin interfaceCollectionLoader<E>- Parameters:
listener- listener- Returns:
- subscription
-