T
- type of entityK
- type of entity IDpublic abstract class AbstractCollectionDatasource<T extends Entity<K>,K> extends DatasourceImpl<T> implements CollectionDatasource<T,K>, CollectionDatasource.SupportsRefreshMode<T,K>
CollectionDatasource.Aggregatable<T extends Entity<K>,K>, CollectionDatasource.CollectionChangeEvent<T extends Entity<K>,K>, CollectionDatasource.CollectionChangeListener<T extends Entity<K>,K>, CollectionDatasource.Indexed<T extends Entity<K>,K>, CollectionDatasource.Lazy<T extends Entity<K>,K>, CollectionDatasource.Operation, CollectionDatasource.Ordered<T extends Entity<K>,K>, CollectionDatasource.RefreshMode, CollectionDatasource.Sortable<T extends Entity<K>,K>, CollectionDatasource.SupportsApplyToSelected<T extends Entity<K>,K>, CollectionDatasource.SupportsPaging<T extends Entity<K>,K>, CollectionDatasource.SupportsRefreshMode<T extends Entity<K>,K>, CollectionDatasource.Suspendable<T extends Entity<K>,K>
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>
Constructor and Description |
---|
AbstractCollectionDatasource() |
Modifier and Type | Method and Description |
---|---|
void |
addCollectionChangeListener(CollectionDatasource.CollectionChangeListener<? super T,K> listener) |
void |
addListener(DatasourceListener<T> listener)
Add listener to datasource events.
|
void |
commit()
Performs commit
|
LoadContext |
getCompiledLoadContext() |
int |
getCount()
Return number of rows for the current query set in the datasource.
|
T |
getItemNN(K id) |
java.util.Map<java.lang.String,java.lang.Object> |
getLastRefreshParameters()
Returns the parameters last used in
CollectionDatasource.refresh(Map) method or empty map if there was no refresh with parameters |
int |
getMaxResults() |
java.lang.String |
getQuery() |
QueryFilter |
getQueryFilter() |
CollectionDatasource.RefreshMode |
getRefreshMode() |
boolean |
getRefreshOnComponentValueChange()
Whether to refresh datasource on changing value of a component which it depends on
(through
component$ parameter) |
boolean |
isCacheable() |
boolean |
isSoftDeletion() |
void |
removeCollectionChangeListener(CollectionDatasource.CollectionChangeListener<? super T,K> listener) |
void |
removeListener(DatasourceListener<T> listener)
Remove listener to datasource events
|
void |
resumeListeners()
Resume invocation of
collectionChanged method of registered CollectionDatasource.CollectionChangeListener s
after calling CollectionDatasource.suspendListeners() . |
void |
setCacheable(boolean cacheable)
Indicates that the datasource query results should be cached in the middleware query cache.
|
void |
setItem(T item)
Set current entity in the datasource.
|
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 |
setRefreshMode(CollectionDatasource.RefreshMode refreshMode) |
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.
|
void |
suspendListeners()
Suspend invocation of
collectionChanged method of registered CollectionDatasource.CollectionChangeListener s. |
committed, getDataSupplier, getDsContext, getItem, getItemIfValid, getMetaClass, getState, getView, initialized, invalidate, refresh, setDataSupplier, setDsContext, setMetaClass, setup, setView, setView, valid
addItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, clearCommitLists, deleted, enableListeners, getCommitMode, getId, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getLoadDynamicAttributes, getParent, isAllowCommit, isModified, modified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setCommitMode, setLoadDynamicAttributes, setModified, setParent, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addItem, clear, containsItem, excludeItem, getItem, getItemIds, getItems, includeItem, modifyItem, refresh, removeItem, revert, size, updateItem
addItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, getCommitMode, getDataSupplier, getDsContext, getId, getItem, getItemIfValid, getLoadDynamicAttributes, getMetaClass, getState, getView, invalidate, isAllowCommit, isModified, refresh, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setLoadDynamicAttributes, setup
clearCommitLists, deleted, enableListeners, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getParent, modified, setCommitMode, setModified, setParent
public void setItem(T item)
Datasource
setItem
in interface Datasource<T extends Entity<K>>
setItem
in class DatasourceImpl<T extends Entity<K>>
item
- entity instancepublic java.lang.String getQuery()
public LoadContext getCompiledLoadContext() throws java.lang.UnsupportedOperationException
getCompiledLoadContext
in interface CollectionDatasource<T extends Entity<K>,K>
java.lang.UnsupportedOperationException
public QueryFilter getQueryFilter()
getQueryFilter
in interface CollectionDatasource<T extends Entity<K>,K>
public void setQuery(java.lang.String query)
CollectionDatasource
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 CollectionDatasource.refresh(java.util.Map)
method
public void setQueryFilter(QueryFilter filter)
CollectionDatasource
CollectionDatasource.setQuery(String)
for the list of supported query parameters.setQueryFilter
in interface CollectionDatasource<T extends Entity<K>,K>
public int getMaxResults()
getMaxResults
in interface CollectionDatasource<T extends Entity<K>,K>
public void setMaxResults(int maxResults)
CollectionDatasource
setMaxResults
in interface CollectionDatasource<T extends Entity<K>,K>
public java.util.Map<java.lang.String,java.lang.Object> getLastRefreshParameters()
CollectionDatasource
CollectionDatasource.refresh(Map)
method or empty map if there was no refresh with parametersgetLastRefreshParameters
in interface CollectionDatasource<T extends Entity<K>,K>
public boolean getRefreshOnComponentValueChange()
CollectionDatasource
component$
parameter)getRefreshOnComponentValueChange
in interface CollectionDatasource<T extends Entity<K>,K>
public void setRefreshOnComponentValueChange(boolean refresh)
CollectionDatasource
component$
parameter)setRefreshOnComponentValueChange
in interface CollectionDatasource<T extends Entity<K>,K>
public void setQuery(java.lang.String query, QueryFilter filter)
CollectionDatasource
CollectionDatasource.setQuery(String)
for the list of supported query parameters.public void suspendListeners()
CollectionDatasource
collectionChanged
method of registered CollectionDatasource.CollectionChangeListener
s.
It makes sense in case of massive updates of the datasource by CollectionDatasource.addItem(com.haulmont.cuba.core.entity.Entity)
or similar methods.
After that, collectionChanged
will be invoked once on CollectionDatasource.resumeListeners()
call.
ds.suspendListeners(); try { for (Object item : items) { ds.addItem(item); } } finally { ds.resumeListeners(); }
suspendListeners
in interface CollectionDatasource<T extends Entity<K>,K>
public void resumeListeners()
CollectionDatasource
collectionChanged
method of registered CollectionDatasource.CollectionChangeListener
s
after calling CollectionDatasource.suspendListeners()
.
It will call collectionChanged
just once, doesn't matter how many updates were issued
since the previous CollectionDatasource.suspendListeners()
call.
finally
section.resumeListeners
in interface CollectionDatasource<T extends Entity<K>,K>
public boolean isSoftDeletion()
isSoftDeletion
in interface CollectionDatasource<T extends Entity<K>,K>
public void setSoftDeletion(boolean softDeletion)
CollectionDatasource
setSoftDeletion
in interface CollectionDatasource<T extends Entity<K>,K>
public boolean isCacheable()
isCacheable
in interface CollectionDatasource<T extends Entity<K>,K>
public void setCacheable(boolean cacheable)
CollectionDatasource
setCacheable
in interface CollectionDatasource<T extends Entity<K>,K>
public void commit()
Datasource
commit
in interface Datasource<T extends Entity<K>>
commit
in class DatasourceImpl<T extends Entity<K>>
public int getCount()
dataLoadError
field to the exception objectpublic CollectionDatasource.RefreshMode getRefreshMode()
getRefreshMode
in interface CollectionDatasource.SupportsRefreshMode<T extends Entity<K>,K>
public void setRefreshMode(CollectionDatasource.RefreshMode refreshMode)
setRefreshMode
in interface CollectionDatasource.SupportsRefreshMode<T extends Entity<K>,K>
public void addCollectionChangeListener(CollectionDatasource.CollectionChangeListener<? super T,K> listener)
addCollectionChangeListener
in interface CollectionDatasource<T extends Entity<K>,K>
public void removeCollectionChangeListener(CollectionDatasource.CollectionChangeListener<? super T,K> listener)
removeCollectionChangeListener
in interface CollectionDatasource<T extends Entity<K>,K>
public void addListener(DatasourceListener<T> listener)
Datasource
addListener
in interface Datasource<T extends Entity<K>>
addListener
in class AbstractDatasource<T extends Entity<K>>
public void removeListener(DatasourceListener<T> listener)
Datasource
removeListener
in interface Datasource<T extends Entity<K>>
removeListener
in class AbstractDatasource<T extends Entity<K>>