public interface Datastore extends ExpressionResolver.ExpressionResolverSupport, DataContextBound, Serializable
This is the central interface to be used for persitent data management in a platform/vendor independent way.
To preserve abstraction and independence from the underlying persistence context, query and persistence methods rely
on Property to represent data attributes and PropertyBox to transport data values int both
directions.
In addition to default data manipulation methods, a Datastore can provide a set of commodities which can be
used to perform specific data operations. The default Query Datastore commodity is provided by any Datastore
implementation and it is the main interface to configure and execute queries on the data model using the default and
implementation-independent DataTarget, QueryFilter, QuerySort and QueryAggregation
expressions. To obtain a Query builder, the query() method is made available.
Query,
DatastoreCommodityFactory| Modifier and Type | Interface and Description |
|---|---|
static interface |
Datastore.Builder<D extends Datastore,B extends Datastore.Builder<D,B>>
Base
Datastore builder. |
static interface |
Datastore.OperationResult
Represents the result of a
Datastore operation, providing informatons about the operation outcome. |
static class |
Datastore.OperationType
Enumeration of
Datastore operation types. |
static interface |
Datastore.WriteOption
Represents a write operation option.
|
| Modifier and Type | Method and Description |
|---|---|
BulkDelete |
bulkDelete(DataTarget<?> target,
Datastore.WriteOption... options)
Create a
BulkDelete clause for bulk DELETE operations. |
BulkInsert |
bulkInsert(DataTarget<?> target,
PropertySet<?> propertySet,
Datastore.WriteOption... options)
Create a
BulkInsert clause for bulk INSERT operations. |
BulkUpdate |
bulkUpdate(DataTarget<?> target,
Datastore.WriteOption... options)
Create a
BulkUpdate clause for bulk UPDATE operations. |
<C extends DatastoreCommodity> |
create(Class<C> commodityType)
Create a new
DatastoreCommodity of given commodityType type. |
Datastore.OperationResult |
delete(DataTarget<?> target,
PropertyBox propertyBox,
Datastore.WriteOption... options)
Remove a persistent element from datastore, using given
target to denote persistent entity to delete
and given PropertyBox to provide key property values |
Collection<Class<? extends DatastoreCommodity>> |
getAvailableCommodities()
Get the available
DatastoreCommodity types for this Datastore. |
Datastore.OperationResult |
insert(DataTarget<?> target,
PropertyBox propertyBox,
Datastore.WriteOption... options)
Insert a
PropertyBox using given target to denote persistent entity of datastore. |
default Query |
query()
Convenience method to create the default
Query Datastore commodity, to be used to query the data store
using default DataTarget, QueryFilter, QuerySort and QueryAggregation
expressions. |
PropertyBox |
refresh(DataTarget<?> target,
PropertyBox propertyBox)
Refresh a
PropertyBox, updating all its model properties to current value in datastore and using given
target to denote persistent entity of datastore |
Datastore.OperationResult |
save(DataTarget<?> target,
PropertyBox propertyBox,
Datastore.WriteOption... options)
Save a
PropertyBox using given target to denote persistent entity of datastore: insert data
if not exists, update it otherwise. |
Datastore.OperationResult |
update(DataTarget<?> target,
PropertyBox propertyBox,
Datastore.WriteOption... options)
Update a
PropertyBox using given target to denote persistent entity of datastore. |
addExpressionResolver, getExpressionResolvers, removeExpressionResolvergetDataContextIdPropertyBox refresh(DataTarget<?> target, PropertyBox propertyBox)
PropertyBox, updating all its model properties to current value in datastore and using given
target to denote persistent entity of datastoretarget - DataTarget to identify data entity to refreshpropertyBox - PropertyBox to refreshDataAccessException - If underlying Datastore implementation throws an Exception executing operationDatastore.OperationResult insert(DataTarget<?> target, PropertyBox propertyBox, Datastore.WriteOption... options)
PropertyBox using given target to denote persistent entity of datastore.target - DataTarget to identify data entity to insertpropertyBox - PropertyBox to insertoptions - Optional write options. The write options are specific for each concrete Datastore implementation.DataAccessException - If underlying Datastore implementation throws an Exception executing operationDatastore.OperationResult update(DataTarget<?> target, PropertyBox propertyBox, Datastore.WriteOption... options)
PropertyBox using given target to denote persistent entity of datastore.target - DataTarget to identify data entity to updatepropertyBox - PropertyBox to updateoptions - Optional write options. The write options are specific for each concrete Datastore implementation.DataAccessException - If underlying Datastore implementation throws an Exception executing operationDatastore.OperationResult save(DataTarget<?> target, PropertyBox propertyBox, Datastore.WriteOption... options)
PropertyBox using given target to denote persistent entity of datastore: insert data
if not exists, update it otherwise.target - DataTarget to identify data entity to savepropertyBox - PropertyBox to saveoptions - Optional write options. The write options are specific for each concrete Datastore implementation.DataAccessException - If underlying Datastore implementation throws an Exception executing operationDatastore.OperationResult delete(DataTarget<?> target, PropertyBox propertyBox, Datastore.WriteOption... options)
target to denote persistent entity to delete
and given PropertyBox to provide key property valuestarget - DataTarget to identify data entity to deletepropertyBox - PropertyBox which contains key property values to identify element to deleteoptions - Optional write options. The write options are specific for each concrete Datastore implementation.DataAccessException - If underlying Datastore implementation throws an Exception executing operationBulkInsert bulkInsert(DataTarget<?> target, PropertySet<?> propertySet, Datastore.WriteOption... options)
BulkInsert clause for bulk INSERT operations.target - DataTarget to identify data entity to insertpropertySet - The property set to use to perform insert operations. Only the properties contained in given
property set will be taken into account to insert the PropertyBox valuesoptions - Optional write options. The write options are specific for each concrete Datastore implementation.BulkInsert clauseBulkUpdate bulkUpdate(DataTarget<?> target, Datastore.WriteOption... options)
BulkUpdate clause for bulk UPDATE operations.target - DataTarget to identify data entity to updateoptions - Optional write options. The write options are specific for each concrete Datastore implementation.BulkUpdate clauseBulkDelete bulkDelete(DataTarget<?> target, Datastore.WriteOption... options)
BulkDelete clause for bulk DELETE operations.target - DataTarget to identify data entity to deleteoptions - Optional write options. The write options are specific for each concrete Datastore implementation.BulkDelete clauseCollection<Class<? extends DatastoreCommodity>> getAvailableCommodities()
DatastoreCommodity types for this Datastore.DatastoreCommodity types collection, empty if none<C extends DatastoreCommodity> C create(Class<C> commodityType)
DatastoreCommodity of given commodityType type.C - Commodity typecommodityType - Commodity type to create (not null)DatastoreCommodityContext.CommodityNotAvailableException - If a commodity of the required type is not available for this DatastoreDatastoreCommodityContext.CommodityConfigurationException - If a commodity configuration error occurreddefault Query query()
Query Datastore commodity, to be used to query the data store
using default DataTarget, QueryFilter, QuerySort and QueryAggregation
expressions.Copyright © 2017 The Holon Platform. All rights reserved.