public class KeyValueInstanceLoaderImpl extends java.lang.Object implements KeyValueInstanceLoader
KeyValueInstanceLoader.PostLoadEvent, KeyValueInstanceLoader.PreLoadEvent
Modifier and Type | Field and Description |
---|---|
protected io.jmix.core.querycondition.Condition |
condition |
protected KeyValueContainer |
container |
protected DataContext |
dataContext |
protected io.jmix.core.DataManager |
dataManager |
protected java.util.function.Function<io.jmix.core.ValueLoadContext,io.jmix.core.entity.KeyValueEntity> |
delegate |
protected io.jmix.core.common.event.EventHub |
events |
protected java.util.Map<java.lang.String,java.io.Serializable> |
hints |
protected java.util.Map<java.lang.String,java.lang.Object> |
parameters |
protected java.lang.String |
query |
protected java.lang.String |
storeName |
Constructor and Description |
---|
KeyValueInstanceLoaderImpl() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addPostLoadListener(java.util.function.Consumer<KeyValueInstanceLoader.PostLoadEvent> listener)
Adds a listener to
KeyValueInstanceLoader.PostLoadEvent . |
io.jmix.core.common.event.Subscription |
addPreLoadListener(java.util.function.Consumer<KeyValueInstanceLoader.PreLoadEvent> listener)
Adds a listener to
KeyValueInstanceLoader.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.
|
KeyValueContainer |
getContainer()
Returns the container which accepts loaded entities.
|
DataContext |
getDataContext()
Returns data context.
|
java.util.Map<java.lang.String,java.io.Serializable> |
getHints() |
java.util.function.Function<io.jmix.core.ValueLoadContext,io.jmix.core.entity.KeyValueEntity> |
getLoadDelegate()
Returns a function which will be used to load data instead of standard implementation.
|
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.
|
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(io.jmix.core.entity.KeyValueEntity entity) |
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(KeyValueContainer container)
Sets the container which accepts loaded entities.
|
void |
setDataContext(DataContext dataContext)
Sets the data context for the loader.
|
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,io.jmix.core.entity.KeyValueEntity> delegate)
Sets a function which will be used to load data instead of standard implementation.
|
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 |
setStoreName(java.lang.String name)
Sets the data store name.
|
@Autowired protected io.jmix.core.DataManager dataManager
protected DataContext dataContext
protected KeyValueContainer 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 java.util.Map<java.lang.String,java.io.Serializable> hints
protected java.lang.String storeName
protected java.util.function.Function<io.jmix.core.ValueLoadContext,io.jmix.core.entity.KeyValueEntity> delegate
protected io.jmix.core.common.event.EventHub events
@Nullable public DataContext getDataContext()
DataLoader
getDataContext
in interface DataLoader
public void setDataContext(@Nullable DataContext dataContext)
DataLoader
setDataContext
in interface DataLoader
public void load()
DataLoader
load
in interface DataLoader
public io.jmix.core.ValueLoadContext createLoadContext()
KeyValueInstanceLoader
ValueLoadContext
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 KeyValueInstanceLoader
protected boolean sendPreLoadEvent(io.jmix.core.ValueLoadContext loadContext)
protected void sendPostLoadEvent(@Nullable io.jmix.core.entity.KeyValueEntity entity)
public KeyValueContainer getContainer()
KeyValueInstanceLoader
getContainer
in interface DataLoader
getContainer
in interface KeyValueInstanceLoader
public void setContainer(KeyValueContainer container)
KeyValueInstanceLoader
setContainer
in interface KeyValueInstanceLoader
public java.lang.String getQuery()
DataLoader
getQuery
in interface DataLoader
public void setQuery(java.lang.String query)
DataLoader
setQuery
in interface DataLoader
@Nullable public io.jmix.core.querycondition.Condition getCondition()
DataLoader
getCondition
in interface DataLoader
public void setCondition(io.jmix.core.querycondition.Condition condition)
DataLoader
setCondition
in interface DataLoader
public java.util.Map<java.lang.String,java.lang.Object> getParameters()
DataLoader
getParameters
in interface DataLoader
public void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
DataLoader
setParameters
in interface DataLoader
public java.lang.Object getParameter(java.lang.String name)
DataLoader
getParameter
in interface DataLoader
public void setParameter(java.lang.String name, @Nullable java.lang.Object value)
DataLoader
setParameter
in interface DataLoader
public void removeParameter(java.lang.String name)
DataLoader
removeParameter
in interface DataLoader
public void setHint(java.lang.String hintName, java.io.Serializable value)
DataLoader
setHint
in interface DataLoader
public java.util.Map<java.lang.String,java.io.Serializable> getHints()
getHints
in interface DataLoader
public java.util.function.Function<io.jmix.core.ValueLoadContext,io.jmix.core.entity.KeyValueEntity> getLoadDelegate()
KeyValueInstanceLoader
getLoadDelegate
in interface KeyValueInstanceLoader
public void setLoadDelegate(java.util.function.Function<io.jmix.core.ValueLoadContext,io.jmix.core.entity.KeyValueEntity> delegate)
KeyValueInstanceLoader
setLoadDelegate
in interface KeyValueInstanceLoader
public io.jmix.core.common.event.Subscription addPreLoadListener(java.util.function.Consumer<KeyValueInstanceLoader.PreLoadEvent> listener)
KeyValueInstanceLoader
KeyValueInstanceLoader.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(KeyValueInstanceLoader.PreLoadEvent event) { // handle event here }
addPreLoadListener
in interface KeyValueInstanceLoader
listener
- listenerpublic io.jmix.core.common.event.Subscription addPostLoadListener(java.util.function.Consumer<KeyValueInstanceLoader.PostLoadEvent> listener)
KeyValueInstanceLoader
KeyValueInstanceLoader.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(KeyValueInstanceLoader.PostLoadEvent event) { // handle event here }
addPostLoadListener
in interface KeyValueInstanceLoader
listener
- listenerpublic java.lang.String getStoreName()
KeyValueInstanceLoader
getStoreName
in interface KeyValueInstanceLoader
public void setStoreName(java.lang.String name)
KeyValueInstanceLoader
setStoreName
in interface KeyValueInstanceLoader