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 and return map with formatted string values.
|
java.util.Map<AggregationInfo,java.lang.Object> |
aggregateValues(AggregationInfo[] aggregationInfos,
java.util.Collection<K> itemIds)
Perform aggregation and return map with aggregation info and aggregation column type, i.e.
|
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, suspendListeners
getDataSupplier, getDsContext, getItem, getItemIfValid, getMetaClass, getState, getView, initialized, invalidate, 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
addCollectionChangeListener, getItemNN, getLastRefreshParameters, getMaxResults, getQuery, getQueryFilter, getRefreshOnComponentValueChange, isCacheable, isSoftDeletion, removeCollectionChangeListener, resumeListeners, setCacheable, setMaxResults, setQuery, setQuery, setQueryFilter, setRefreshOnComponentValueChange, setSoftDeletion, suspendListeners
addItemChangeListener, addItemPropertyChangeListener, addListener, addStateChangeListener, commit, getCommitMode, getDataSupplier, getDsContext, getId, getItem, getItemIfValid, getLoadDynamicAttributes, getMetaClass, getState, getView, invalidate, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeListener, removeStateChangeListener, setAllowCommit, setItem, setLoadDynamicAttributes, setup
getCount
clearCommitLists, deleted, enableListeners, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getParent, modified, setCommitMode, setModified, setParent
public 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()
Datasource
Datasource.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)
CollectionDatasource
These 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()
CollectionDatasource
CollectionDatasource.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.Sortable
public void resetSortOrder()
CollectionDatasource.Sortable
resetSortOrder
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)
CollectionDatasource
public void addItemFirst(T item)
CollectionDatasource.Ordered
addItemFirst
in interface CollectionDatasource.Ordered<T extends Entity<K>,K>
public void removeItem(T item)
CollectionDatasource
removeItem
in interface CollectionDatasource<T extends Entity<K>,K>
public void includeItem(T item)
CollectionDatasource
includeItem
in interface CollectionDatasource<T extends Entity<K>,K>
public void includeItemFirst(T item)
CollectionDatasource.Ordered
includeItemFirst
in interface CollectionDatasource.Ordered<T extends Entity<K>,K>
public void excludeItem(T item)
CollectionDatasource
excludeItem
in interface CollectionDatasource<T extends Entity<K>,K>
public void clear()
CollectionDatasource
public void revert()
CollectionDatasource
public void modifyItem(T item)
CollectionDatasource
modifyItem
in interface CollectionDatasource<T extends Entity<K>,K>
public void updateItem(T item)
CollectionDatasource
updateItem
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)
DatasourceImplementation
committed
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.Aggregatable
public java.util.Map<AggregationInfo,java.lang.Object> aggregateValues(AggregationInfo[] aggregationInfos, java.util.Collection<K> itemIds)
CollectionDatasource.Aggregatable
aggregateValues
in interface CollectionDatasource.Aggregatable<T extends Entity<K>,K>
aggregationInfos
- aggregation infositemIds
- collection of item idspublic 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>