T - type of entityK - type of entity IDpublic class CollectionDatasourceImpl<T extends Entity<K>,K> extends AbstractCollectionDatasource<T,K> implements CollectionDatasource.Indexed<T,K>, CollectionDatasource.Sortable<T,K>, CollectionDatasource.Aggregatable<T,K>, CollectionDatasource.Suspendable<T,K>, CollectionDatasource.SupportsPaging<T,K>, CollectionDatasource.SupportsApplyToSelected<T,K>
CollectionDatasource implementation.
Contains collection of standalone (not property) entities, and can request data from database and commit changes.
loadData(java.util.Map) method.CollectionDatasource.Sortable.Order, CollectionDatasource.Sortable.SortInfo<P>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 |
|---|
CollectionDatasourceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(T item)
Add an item to the collection.
|
void |
addItemFirst(T item)
Add an item to the collection to the first position.
|
java.util.Map<AggregationInfo,java.lang.String> |
aggregate(AggregationInfo[] aggregationInfos,
java.util.Collection itemIds)
Perform aggregation
|
void |
clear()
Clear the underlying collection.
|
void |
committed(java.util.Set<Entity> entities)
Invoked after commit.
|
boolean |
containsItem(K itemId) |
void |
excludeItem(T item)
Exclude an item from the collection.
|
K |
firstItemId() |
LoadContext |
getCompiledLoadContext() |
int |
getFirstResult() |
K |
getIdByIndex(int index) |
T |
getItem(K id) |
java.util.Collection<K> |
getItemIds() |
java.util.List<K> |
getItemIds(int startIndex,
int numberOfItems) |
java.util.Collection<T> |
getItems()
In standard implementations this is a wrapper method around
CollectionDatasource.getItemIds() and CollectionDatasource.getItem(Object). |
void |
includeItem(T item)
Include an item into the collection.
|
void |
includeItemFirst(T item)
Include an item into the collection to the first position.
|
int |
indexOfId(K itemId) |
boolean |
isFirstId(K itemId) |
boolean |
isLastId(K itemId) |
boolean |
isSuspended() |
K |
lastItemId() |
void |
modifyItem(T item)
Update an item in the collection if it is already there.
|
K |
nextItemId(K itemId) |
void |
pinQuery() |
K |
prevItemId(K itemId) |
void |
refresh()
Refreshes the datasource moving it to the
Datasource.State.VALID state |
void |
refresh(java.util.Map<java.lang.String,java.lang.Object> parameters)
Refresh datasource passing specified parameters to the query.
|
void |
refreshIfNotSuspended() |
void |
refreshIfNotSuspended(java.util.Map<java.lang.String,java.lang.Object> parameters) |
void |
removeItem(T item)
Remove an item from the collection.
|
void |
resetSortOrder()
Remove sort infos
|
void |
revert()
Revert the datasource to its initial state before data modification.
|
void |
setFirstResult(int startPosition) |
void |
setSuspended(boolean suspended) |
int |
size() |
void |
sort(CollectionDatasource.Sortable.SortInfo[] sortInfos)
Perform sorting
|
void |
unpinAllQuery() |
void |
unpinLastQuery() |
void |
updateItem(T item)
Update an item in the collection if it is already there.
|
addCollectionChangeListener, addListener, commit, getCount, getItemNN, getLastRefreshParameters, getMaxResults, getQuery, getQueryFilter, getRefreshMode, getRefreshOnComponentValueChange, isCacheable, isSoftDeletion, removeCollectionChangeListener, removeListener, resumeListeners, setCacheable, setItem, setMaxResults, setQuery, setQuery, setQueryFilter, setRefreshMode, setRefreshOnComponentValueChange, setSoftDeletion, suspendListenersgetDataSupplier, getDsContext, getItem, getItemIfValid, getMetaClass, getState, getView, initialized, invalidate, setDataSupplier, setDsContext, setMetaClass, setup, setView, setView, validaddItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, clearCommitLists, deleted, enableListeners, getCommitMode, getId, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getLoadDynamicAttributes, getParent, isAllowCommit, isModified, modified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setCommitMode, setLoadDynamicAttributes, setModified, setParent, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCollectionChangeListener, getItemNN, getLastRefreshParameters, getMaxResults, getQuery, getQueryFilter, getRefreshOnComponentValueChange, isCacheable, isSoftDeletion, removeCollectionChangeListener, resumeListeners, setCacheable, setMaxResults, setQuery, setQuery, setQueryFilter, setRefreshOnComponentValueChange, setSoftDeletion, suspendListenersaddItemChangeListener, addItemPropertyChangeListener, addListener, addStateChangeListener, commit, getCommitMode, getDataSupplier, getDsContext, getId, getItem, getItemIfValid, getLoadDynamicAttributes, getMetaClass, getState, getView, invalidate, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeListener, removeStateChangeListener, setAllowCommit, setItem, setLoadDynamicAttributes, setupgetCountclearCommitLists, deleted, enableListeners, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getParent, modified, setCommitMode, setModified, setParentpublic void refreshIfNotSuspended()
refreshIfNotSuspended in interface CollectionDatasource.Suspendable<T extends Entity<K>,K>public void refreshIfNotSuspended(java.util.Map<java.lang.String,java.lang.Object> parameters)
refreshIfNotSuspended in interface CollectionDatasource.Suspendable<T extends Entity<K>,K>public void refresh()
DatasourceDatasource.State.VALID staterefresh in interface Datasource<T extends Entity<K>>refresh in class DatasourceImpl<T extends Entity<K>>public void refresh(java.util.Map<java.lang.String,java.lang.Object> parameters)
CollectionDatasourceThese parameters may be referenced in the query text by "custom$" prefix.
public java.util.Collection<K> getItemIds()
getItemIds in interface CollectionDatasource<T extends Entity<K>,K>public java.util.Collection<T> getItems()
CollectionDatasourceCollectionDatasource.getItemIds() and CollectionDatasource.getItem(Object).
Use it only if you really need the collection of items. Otherwise use CollectionDatasource.getItemIds() or CollectionDatasource.size()
directly.public int size()
public void sort(CollectionDatasource.Sortable.SortInfo[] sortInfos)
CollectionDatasource.Sortablepublic void resetSortOrder()
CollectionDatasource.SortableresetSortOrder in interface CollectionDatasource.Sortable<T extends Entity<K>,K>public int indexOfId(K itemId)
public K getIdByIndex(int index)
getIdByIndex in interface CollectionDatasource.Indexed<T extends Entity<K>,K>public java.util.List<K> getItemIds(int startIndex, int numberOfItems)
getItemIds in interface CollectionDatasource.Indexed<T extends Entity<K>,K>public K firstItemId()
firstItemId in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public K lastItemId()
lastItemId in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public K nextItemId(K itemId)
nextItemId in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public K prevItemId(K itemId)
prevItemId in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public boolean isFirstId(K itemId)
public boolean isLastId(K itemId)
public void addItem(T item)
CollectionDatasourcepublic void addItemFirst(T item)
CollectionDatasource.OrderedaddItemFirst in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public void removeItem(T item)
CollectionDatasourceremoveItem in interface CollectionDatasource<T extends Entity<K>,K>public void includeItem(T item)
CollectionDatasourceincludeItem in interface CollectionDatasource<T extends Entity<K>,K>public void includeItemFirst(T item)
CollectionDatasource.OrderedincludeItemFirst in interface CollectionDatasource.Ordered<T extends Entity<K>,K>public void excludeItem(T item)
CollectionDatasourceexcludeItem in interface CollectionDatasource<T extends Entity<K>,K>public void clear()
CollectionDatasourcepublic void revert()
CollectionDatasourcepublic void modifyItem(T item)
CollectionDatasourcemodifyItem in interface CollectionDatasource<T extends Entity<K>,K>public void updateItem(T item)
CollectionDatasourceupdateItem in interface CollectionDatasource<T extends Entity<K>,K>public boolean containsItem(K itemId)
containsItem in interface CollectionDatasource<T extends Entity<K>,K>public void committed(java.util.Set<Entity> entities)
DatasourceImplementationcommitted in interface DatasourceImplementation<T extends Entity<K>>committed in class DatasourceImpl<T extends Entity<K>>entities - committed entities returned from middlewarepublic LoadContext getCompiledLoadContext()
getCompiledLoadContext in interface CollectionDatasource<T extends Entity<K>,K>getCompiledLoadContext in class AbstractCollectionDatasource<T extends Entity<K>,K>public java.util.Map<AggregationInfo,java.lang.String> aggregate(AggregationInfo[] aggregationInfos, java.util.Collection itemIds)
CollectionDatasource.Aggregatablepublic boolean isSuspended()
isSuspended in interface CollectionDatasource.Suspendable<T extends Entity<K>,K>public void setSuspended(boolean suspended)
setSuspended in interface CollectionDatasource.Suspendable<T extends Entity<K>,K>public int getFirstResult()
getFirstResult in interface CollectionDatasource.SupportsPaging<T extends Entity<K>,K>public void setFirstResult(int startPosition)
setFirstResult in interface CollectionDatasource.SupportsPaging<T extends Entity<K>,K>public void pinQuery()
public void unpinLastQuery()
unpinLastQuery in interface CollectionDatasource.SupportsApplyToSelected<T extends Entity<K>,K>public void unpinAllQuery()
unpinAllQuery in interface CollectionDatasource.SupportsApplyToSelected<T extends Entity<K>,K>