T
- type of entityK
- type of entity IDpublic interface CollectionDatasource<T extends Entity<K>,K> extends Datasource<T>
setQuery(String)
Modifier and Type | Interface and Description |
---|---|
static interface |
CollectionDatasource.Aggregatable<T extends Entity<K>,K>
CollectionDatasource which supports data aggregation.
|
static class |
CollectionDatasource.CollectionChangeEvent<T extends Entity<K>,K> |
static interface |
CollectionDatasource.CollectionChangeListener<T extends Entity<K>,K> |
static interface |
CollectionDatasource.Indexed<T extends Entity<K>,K> |
static interface |
CollectionDatasource.Lazy<T extends Entity<K>,K>
CollectionDatasource with lazy loading.
|
static class |
CollectionDatasource.Operation
Operation which caused the datasource change.
|
static interface |
CollectionDatasource.Ordered<T extends Entity<K>,K>
CollectionDatasource which underlying collection is ordered.
|
static class |
CollectionDatasource.RefreshMode
Mode of loading data from database:
CollectionDatasource.RefreshMode.ALWAYS , CollectionDatasource.RefreshMode.NEVER |
static interface |
CollectionDatasource.Sortable<T extends Entity<K>,K>
Ordered CollectionDatasource supporting order change.
|
static interface |
CollectionDatasource.SupportsApplyToSelected<T extends Entity<K>,K>
CollectionDatasource that supports applying filter to previously selected data.
|
static interface |
CollectionDatasource.SupportsPaging<T extends Entity<K>,K>
CollectionDatasource that supports counting records in database and loading by pages.
|
static interface |
CollectionDatasource.SupportsRefreshMode<T extends Entity<K>,K> |
static interface |
CollectionDatasource.Suspendable<T extends Entity<K>,K>
CollectionDatasource that supports deferred refresh.
|
Datasource.CommitMode, Datasource.ItemChangeEvent<T extends Entity>, Datasource.ItemChangeListener<T extends Entity>, Datasource.ItemPropertyChangeEvent<T extends Entity>, Datasource.ItemPropertyChangeListener<T extends Entity>, Datasource.State, Datasource.StateChangeEvent<T extends Entity>, Datasource.StateChangeListener<T extends Entity>
Modifier and Type | Method and Description |
---|---|
void |
addCollectionChangeListener(CollectionDatasource.CollectionChangeListener<T,K> listener) |
void |
addItem(T item)
Add an item to the collection.
|
void |
clear()
Clear the underlying collection.
|
boolean |
containsItem(K itemId) |
void |
excludeItem(T item)
Exclude an item from the collection.
|
LoadContext |
getCompiledLoadContext() |
T |
getItem(K id) |
java.util.Collection<K> |
getItemIds() |
T |
getItemNN(K id) |
java.util.Collection<T> |
getItems()
In standard implementations this is a wrapper method around
getItemIds() and getItem(Object) . |
java.util.Map<java.lang.String,java.lang.Object> |
getLastRefreshParameters()
Returns the parameters last used in
refresh(Map) method or empty map if there was no refresh with parameters |
int |
getMaxResults() |
java.lang.String |
getQuery() |
QueryFilter |
getQueryFilter() |
boolean |
getRefreshOnComponentValueChange()
Whether to refresh datasource on changing value of a component which it depends on
(through
component$ parameter) |
void |
includeItem(T item)
Include an item into the collection.
|
boolean |
isCacheable() |
boolean |
isSoftDeletion() |
void |
modifyItem(T item)
Update an item in the collection if it is already there.
|
void |
refresh(java.util.Map<java.lang.String,java.lang.Object> parameters)
Refresh datasource passing specified parameters to the query.
|
void |
removeCollectionChangeListener(CollectionDatasource.CollectionChangeListener<T,K> listener) |
void |
removeItem(T item)
Remove an item from the collection.
|
void |
resumeListeners()
Resume invocation of
collectionChanged method of registered CollectionDatasource.CollectionChangeListener s
after calling suspendListeners() . |
void |
revert()
Revert the datasource to its initial state before data modification.
|
void |
setCacheable(boolean cacheable)
Indicates that the datasource query results should be cached in the middleware query cache.
|
void |
setMaxResults(int maxResults)
Set max number of rows.
|
void |
setQuery(java.lang.String query)
Set query string which is used to load data.
|
void |
setQuery(java.lang.String query,
QueryFilter filter)
Set query string and associated filter which is used to load data.
|
void |
setQueryFilter(QueryFilter filter)
Set query filter which is used to load data.
|
void |
setRefreshOnComponentValueChange(boolean refresh)
Whether to refresh datasource on changing value of a component which it depends on
(through
component$ parameter) |
void |
setSoftDeletion(boolean softDeletion)
Switch on/off Soft Deletion.
|
int |
size() |
void |
suspendListeners()
Suspend invocation of
collectionChanged method of registered CollectionDatasource.CollectionChangeListener s. |
void |
updateItem(T item)
Update an item in the collection if it is already there.
|
addItemChangeListener, addItemPropertyChangeListener, addListener, addStateChangeListener, commit, getCommitMode, getDataSupplier, getDsContext, getId, getItem, getItemIfValid, getLoadDynamicAttributes, getMetaClass, getState, getView, invalidate, isAllowCommit, isModified, refresh, removeItemChangeListener, removeItemPropertyChangeListener, removeListener, removeStateChangeListener, setAllowCommit, setItem, setLoadDynamicAttributes, setup
java.util.Collection<K> getItemIds()
java.util.Collection<T> getItems()
getItemIds()
and getItem(Object)
.
Use it only if you really need the collection of items. Otherwise use getItemIds()
or size()
directly.int size()
void addItem(T item)
void removeItem(T item)
void excludeItem(T item)
void includeItem(T item)
void clear()
void revert()
void modifyItem(T item)
void updateItem(T item)
void suspendListeners()
collectionChanged
method of registered CollectionDatasource.CollectionChangeListener
s.
It makes sense in case of massive updates of the datasource by addItem(com.haulmont.cuba.core.entity.Entity)
or similar methods.
After that, collectionChanged
will be invoked once on resumeListeners()
call.
ds.suspendListeners(); try { for (Object item : items) { ds.addItem(item); } } finally { ds.resumeListeners(); }
void resumeListeners()
collectionChanged
method of registered CollectionDatasource.CollectionChangeListener
s
after calling suspendListeners()
.
It will call collectionChanged
just once, doesn't matter how many updates were issued
since the previous suspendListeners()
call.
finally
section.boolean isSoftDeletion()
void setSoftDeletion(boolean softDeletion)
boolean isCacheable()
void setCacheable(boolean cacheable)
boolean containsItem(K itemId)
java.lang.String getQuery()
LoadContext getCompiledLoadContext()
QueryFilter getQueryFilter()
void setQuery(java.lang.String query)
ds$
- current item in the specified datasource
component$
- value of the specified UI component
param$
- value of parameter passed to the window when opening it
session$
- userId
represents current or substituted user ID,
userLogin
represents current or substituted user login in lower case,
any other string represents a user session attribute with this name
custom$
- value of parameter passed to the refresh(java.util.Map)
method
void setQuery(java.lang.String query, QueryFilter filter)
setQuery(String)
for the list of supported query parameters.void setQueryFilter(QueryFilter filter)
setQuery(String)
for the list of supported query parameters.int getMaxResults()
void setMaxResults(int maxResults)
void refresh(java.util.Map<java.lang.String,java.lang.Object> parameters)
These parameters may be referenced in the query text by "custom$" prefix.
parameters
- parameters mapjava.util.Map<java.lang.String,java.lang.Object> getLastRefreshParameters()
refresh(Map)
method or empty map if there was no refresh with parametersboolean getRefreshOnComponentValueChange()
component$
parameter)void setRefreshOnComponentValueChange(boolean refresh)
component$
parameter)void addCollectionChangeListener(CollectionDatasource.CollectionChangeListener<T,K> listener)
void removeCollectionChangeListener(CollectionDatasource.CollectionChangeListener<T,K> listener)