public class KeyValueCollectionLoaderImpl extends java.lang.Object implements KeyValueCollectionLoader
KeyValueCollectionLoader.PostLoadEvent, KeyValueCollectionLoader.PreLoadEvent| Modifier and Type | Field and Description |
|---|---|
protected io.jmix.core.querycondition.Condition |
condition |
protected KeyValueCollectionContainer |
container |
protected DataContext |
dataContext |
protected io.jmix.core.DataManager |
dataManager |
protected java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> |
delegate |
protected io.jmix.core.common.event.EventHub |
events |
protected int |
firstResult |
protected java.util.Map<java.lang.String,java.io.Serializable> |
hints |
protected int |
maxResults |
protected java.util.Map<java.lang.String,java.lang.Object> |
parameters |
protected java.lang.String |
query |
protected io.jmix.core.Sort |
sort |
protected SorterFactory |
sorterFactory |
protected java.lang.String |
storeName |
| Constructor and Description |
|---|
KeyValueCollectionLoaderImpl() |
| Modifier and Type | Method and Description |
|---|---|
io.jmix.core.common.event.Subscription |
addPostLoadListener(java.util.function.Consumer<KeyValueCollectionLoader.PostLoadEvent> listener)
Adds a listener to
KeyValueCollectionLoader.PostLoadEvent. |
io.jmix.core.common.event.Subscription |
addPreLoadListener(java.util.function.Consumer<KeyValueCollectionLoader.PreLoadEvent> listener)
Adds a listener to
KeyValueCollectionLoader.PreLoadEvent. |
io.jmix.core.ValueLoadContext |
createLoadContext()
Returns
ValueLoadContext which is created by the parameters of this loader. |
io.jmix.core.querycondition.Condition |
getCondition()
Returns the root condition which is used together with the query when loading entities.
|
KeyValueCollectionContainer |
getContainer()
Returns the container which accepts loaded entities.
|
DataContext |
getDataContext()
Returns data context.
|
java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> |
getDelegate()
Returns a function which will be used to load data instead of standard implementation.
|
int |
getFirstResult()
The position of the first instance to load, numbered from 0.
|
java.util.Map<java.lang.String,java.io.Serializable> |
getHints() |
int |
getMaxResults()
The maximum number of instances to load.
|
java.lang.Object |
getParameter(java.lang.String name)
Returns a query parameter by its name.
|
java.util.Map<java.lang.String,java.lang.Object> |
getParameters()
Returns the map of query parameters.
|
java.lang.String |
getQuery()
Returns the query which is used for loading entities.
|
io.jmix.core.Sort |
getSort()
Returns the sort object which is used when loading.
|
java.lang.String |
getStoreName()
Returns data store name.
|
void |
load()
Loads data to the connected container.
|
void |
removeParameter(java.lang.String name)
Removes a query parameter.
|
protected void |
sendPostLoadEvent(java.util.List<io.jmix.core.entity.KeyValueEntity> entities) |
protected boolean |
sendPreLoadEvent(io.jmix.core.ValueLoadContext loadContext) |
void |
setCondition(io.jmix.core.querycondition.Condition condition)
Sets the root condition which will be used together with the query when loading entities.
|
void |
setContainer(KeyValueCollectionContainer container)
Sets the container which accepts loaded entities.
|
void |
setDataContext(DataContext dataContext)
Sets the data context for the loader.
|
void |
setFirstResult(int firstResult)
Sets the position of the first instance to load, numbered from 0.
|
void |
setHint(java.lang.String hintName,
java.io.Serializable value)
Sets custom hint that should be used by the query for loading data.
|
void |
setLoadDelegate(java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> delegate)
Sets a function which will be used to load data instead of standard implementation.
|
void |
setMaxResults(int maxResults)
Sets the maximum number of instances to load.
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Sets a query parameter.
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Sets the map of query parameters.
|
void |
setQuery(java.lang.String query)
Sets a query which will be used for loading entities.
|
void |
setSort(io.jmix.core.Sort sort)
Sets the sort object which is used when loading.
|
void |
setStoreName(java.lang.String name)
Sets the data store name.
|
@Autowired protected io.jmix.core.DataManager dataManager
@Autowired protected SorterFactory sorterFactory
protected DataContext dataContext
protected KeyValueCollectionContainer container
protected java.lang.String query
protected io.jmix.core.querycondition.Condition condition
protected java.util.Map<java.lang.String,java.lang.Object> parameters
protected int firstResult
protected int maxResults
protected io.jmix.core.Sort sort
protected java.util.Map<java.lang.String,java.io.Serializable> hints
protected java.lang.String storeName
protected java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> delegate
protected io.jmix.core.common.event.EventHub events
@Nullable public DataContext getDataContext()
DataLoadergetDataContext in interface DataLoaderpublic void setDataContext(@Nullable
DataContext dataContext)
DataLoadersetDataContext in interface DataLoaderpublic void load()
DataLoaderload in interface DataLoaderpublic io.jmix.core.ValueLoadContext createLoadContext()
KeyValueCollectionLoaderValueLoadContext which is created by the parameters of this loader. The ValueLoadContext
can be used with DataManager to load data by the same conditions.createLoadContext in interface KeyValueCollectionLoaderprotected boolean sendPreLoadEvent(io.jmix.core.ValueLoadContext loadContext)
protected void sendPostLoadEvent(java.util.List<io.jmix.core.entity.KeyValueEntity> entities)
public KeyValueCollectionContainer getContainer()
KeyValueCollectionLoadergetContainer in interface BaseCollectionLoadergetContainer in interface DataLoadergetContainer in interface KeyValueCollectionLoaderpublic void setContainer(KeyValueCollectionContainer container)
KeyValueCollectionLoadersetContainer in interface KeyValueCollectionLoaderpublic java.lang.String getQuery()
DataLoadergetQuery in interface DataLoaderpublic void setQuery(java.lang.String query)
DataLoadersetQuery in interface DataLoader@Nullable public io.jmix.core.querycondition.Condition getCondition()
DataLoadergetCondition in interface DataLoaderpublic void setCondition(io.jmix.core.querycondition.Condition condition)
DataLoadersetCondition in interface DataLoaderpublic java.util.Map<java.lang.String,java.lang.Object> getParameters()
DataLoadergetParameters in interface DataLoaderpublic void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
DataLoadersetParameters in interface DataLoaderpublic java.lang.Object getParameter(java.lang.String name)
DataLoadergetParameter in interface DataLoaderpublic void setParameter(java.lang.String name,
@Nullable
java.lang.Object value)
DataLoadersetParameter in interface DataLoaderpublic void removeParameter(java.lang.String name)
DataLoaderremoveParameter in interface DataLoaderpublic int getMaxResults()
BaseCollectionLoaderInteger.MAX_VALUE if BaseCollectionLoader.setMaxResults(int) was not called.getMaxResults in interface BaseCollectionLoaderpublic void setMaxResults(int maxResults)
BaseCollectionLoadersetMaxResults in interface BaseCollectionLoader@Nullable public io.jmix.core.Sort getSort()
BaseCollectionLoadergetSort in interface BaseCollectionLoaderpublic void setSort(@Nullable
io.jmix.core.Sort sort)
BaseCollectionLoadersetSort in interface BaseCollectionLoaderpublic void setHint(java.lang.String hintName,
java.io.Serializable value)
DataLoadersetHint in interface DataLoaderpublic java.util.Map<java.lang.String,java.io.Serializable> getHints()
getHints in interface DataLoaderpublic java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> getDelegate()
KeyValueCollectionLoadergetDelegate in interface KeyValueCollectionLoaderpublic void setLoadDelegate(java.util.function.Function<io.jmix.core.ValueLoadContext,java.util.List<io.jmix.core.entity.KeyValueEntity>> delegate)
KeyValueCollectionLoadersetLoadDelegate in interface KeyValueCollectionLoaderpublic io.jmix.core.common.event.Subscription addPreLoadListener(java.util.function.Consumer<KeyValueCollectionLoader.PreLoadEvent> listener)
KeyValueCollectionLoaderKeyValueCollectionLoader.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(KeyValueCollectionLoader.PreLoadEvent event) {
// handle event here
}
addPreLoadListener in interface KeyValueCollectionLoaderlistener - listenerpublic io.jmix.core.common.event.Subscription addPostLoadListener(java.util.function.Consumer<KeyValueCollectionLoader.PostLoadEvent> listener)
KeyValueCollectionLoaderKeyValueCollectionLoader.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(KeyValueCollectionLoader.PostLoadEvent event) {
// handle event here
}
addPostLoadListener in interface KeyValueCollectionLoaderlistener - listenerpublic java.lang.String getStoreName()
KeyValueCollectionLoadergetStoreName in interface KeyValueCollectionLoaderpublic void setStoreName(@Nullable
java.lang.String name)
KeyValueCollectionLoadersetStoreName in interface KeyValueCollectionLoaderpublic int getFirstResult()
BaseCollectionLoaderBaseCollectionLoader.setFirstResult(int) was not called.getFirstResult in interface BaseCollectionLoaderpublic void setFirstResult(int firstResult)
BaseCollectionLoadersetFirstResult in interface BaseCollectionLoader