@InstallSubject(value="loadDelegate") public interface CollectionLoader<E> extends BaseCollectionLoader
Modifier and Type | Interface and Description |
---|---|
static class |
CollectionLoader.PostLoadEvent<T>
Event sent after successful loading of entities, merging them into
DataContext and setting to
the container. |
static class |
CollectionLoader.PreLoadEvent<T>
Event sent before loading entities.
|
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addPostLoadListener(java.util.function.Consumer<CollectionLoader.PostLoadEvent<E>> listener)
Adds a listener to
CollectionLoader.PostLoadEvent . |
io.jmix.core.common.event.Subscription |
addPreLoadListener(java.util.function.Consumer<CollectionLoader.PreLoadEvent<E>> listener)
Adds a listener to
CollectionLoader.PreLoadEvent . |
io.jmix.core.LoadContext<E> |
createLoadContext()
Returns
LoadContext which is created by the parameters of this loader. |
CollectionContainer<E> |
getContainer()
Returns the container which accepts loaded entities.
|
io.jmix.core.FetchPlan |
getFetchPlan()
Returns the fetch plan used for loading entities.
|
java.util.function.Function<io.jmix.core.LoadContext<E>,java.util.List<E>> |
getLoadDelegate()
Returns a function which will be used to load data instead of standard implementation.
|
boolean |
isCacheable()
Returns true if the query for loading data is cacheable.
|
void |
setCacheable(boolean cacheable)
Sets the query for loading data cacheable.
|
void |
setContainer(CollectionContainer<E> container)
Sets the container which accepts loaded entities.
|
void |
setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
Sets the fetch plan to use for loading entities.
|
void |
setFetchPlan(java.lang.String fetchPlanName)
Sets the name of the fetch plan to use for loading entities.
|
void |
setLoadDelegate(java.util.function.Function<io.jmix.core.LoadContext<E>,java.util.List<E>> delegate)
Sets a function which will be used to load data instead of standard implementation.
|
getFirstResult, getMaxResults, getSort, setFirstResult, setMaxResults, setSort
getCondition, getDataContext, getHints, getParameter, getParameters, getQuery, load, removeParameter, setCondition, setDataContext, setHint, setParameter, setParameters, setQuery
CollectionContainer<E> getContainer()
getContainer
in interface BaseCollectionLoader
getContainer
in interface DataLoader
void setContainer(CollectionContainer<E> container)
io.jmix.core.LoadContext<E> createLoadContext()
LoadContext
which is created by the parameters of this loader. The LoadContext
can be used with DataManager
to load data by the same conditions.boolean isCacheable()
void setCacheable(boolean cacheable)
io.jmix.core.FetchPlan getFetchPlan()
void setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
void setFetchPlan(java.lang.String fetchPlanName)
java.lang.IllegalStateException
- if the fetch plan has already been set by setFetchPlan(FetchPlan)
java.util.function.Function<io.jmix.core.LoadContext<E>,java.util.List<E>> getLoadDelegate()
void setLoadDelegate(java.util.function.Function<io.jmix.core.LoadContext<E>,java.util.List<E>> delegate)
io.jmix.core.common.event.Subscription addPreLoadListener(java.util.function.Consumer<CollectionLoader.PreLoadEvent<E>> listener)
CollectionLoader.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 }
listener
- listenerio.jmix.core.common.event.Subscription addPostLoadListener(java.util.function.Consumer<CollectionLoader.PostLoadEvent<E>> listener)
CollectionLoader.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 }
listener
- listener