ITEM - Item typePROPERTY - Item property typepublic interface ItemDataSource<ITEM,PROPERTY> extends QueryConfigurationProviderSupport, Serializable
Items values are accessed using a defined set of properties.
Item set modifications can be persisted in a backend data store using a ItemDataSource.CommitHandler, triggered through the
commit() method.
ItemDataProvider| Modifier and Type | Interface and Description |
|---|---|
static interface |
ItemDataSource.Builder<ITEM,PROPERTY>
Builder to create
ItemDataSource instances. |
static interface |
ItemDataSource.CommitHandler<ITEM>
Data source commit handler to perform concrete persistence operations when data is committed invoking
commit(). |
static interface |
ItemDataSource.Configuration<ITEM,PROPERTY>
Item data source configuration.
|
static class |
ItemDataSource.ItemAction
Item actions enumeration.
|
static interface |
ItemDataSource.ItemSort<PROPERTY>
Item sort directive.
|
static interface |
ItemDataSource.PropertySortGenerator<PROPERTY>
QuerySort generator to provide query sorts for an item property. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BATCH_SIZE
Default batch (page) size for items loading using
ItemDataProvider |
| Modifier and Type | Method and Description |
|---|---|
Object |
add(ITEM item)
Adds an item to the data source.
|
static <ITEM,PROPERTY> |
builder(Class<?> propertyType)
Get a builder to create an
ItemDataSource. |
void |
clear()
Clear data source contents (current item set)
|
void |
commit()
Updates all changes since the previous commit.
|
void |
discard()
Discards all changes since last commit.
|
Optional<ITEM> |
get(Object itemId)
Get the item identified by given
itemId. |
ItemDataSource.Configuration<ITEM,PROPERTY> |
getConfiguration()
Get the data source configuration.
|
Object |
getId(ITEM item)
Get the identifier of given item
|
ITEM |
getItemAt(int index)
Get the item at given index.
|
Collection<?> |
getItemIds()
Get all item ids available from this data source
|
int |
indexOfItem(ITEM item)
Get index of given item
|
void |
refresh()
Refresh data source items.
|
void |
refresh(ITEM item)
Refresh given item in data source
|
boolean |
remove(ITEM item)
Removes given item from the data source.
|
void |
setDataProviderQuery(com.vaadin.data.provider.Query<ITEM,com.holonplatform.core.query.QueryFilter> dataProviderQuery)
Set the data provider
Query to use to obtain filters and sorts. |
int |
size()
Returns current data source size (considering any applied filter), i.e.
|
void |
sort(ItemDataSource.ItemSort<PROPERTY>... sorts)
Sort the data source items using given
ItemDataSource.ItemSort directives. |
void |
update(ITEM item)
Update given item in data source.
|
addQueryConfigurationProviderstatic final int DEFAULT_BATCH_SIZE
ItemDataProviderItemDataSource.Configuration<ITEM,PROPERTY> getConfiguration()
void refresh()
com.holonplatform.core.exceptions.DataAccessException - Error performing concrete items loading operationsvoid clear()
int size()
Collection<?> getItemIds()
Object getId(ITEM item)
item - Item to get the identifier forint indexOfItem(ITEM item)
item - Item-1 if not foundITEM getItemAt(int index)
index - Item indexnull if not availableOptional<ITEM> get(Object itemId)
itemId.itemId - Item id (not null)itemId, empty if not foundObject add(ITEM item)
item - The item to add (not null)void update(ITEM item)
item - Item to update (not null)boolean remove(ITEM item)
item - Item to remove (not null)true if the item was successfully removed from data sourcevoid refresh(ITEM item)
item - Item to refresh (not null)UnsupportedOperationException - If the refresh operation is not supported by concrete data storevoid commit()
void discard()
void sort(ItemDataSource.ItemSort<PROPERTY>... sorts)
ItemDataSource.ItemSort directives.sorts - Item sorts to applyvoid setDataProviderQuery(com.vaadin.data.provider.Query<ITEM,com.holonplatform.core.query.QueryFilter> dataProviderQuery)
Query to use to obtain filters and sorts.dataProviderQuery - the query to setstatic <ITEM,PROPERTY> ItemDataSource.Builder<ITEM,PROPERTY> builder(Class<?> propertyType)
ItemDataSource.ITEM - Item typePROPERTY - Item property typepropertyType - Property representation type (not null)ItemDataSource builderCopyright © 2019 The Holon Platform. All rights reserved.