com.holonplatform.core.datastore

## Interface Datastore

- All Superinterfaces:
    ConfigurableDatastore, DataContextBound, DatastoreCommodityHandler, DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>, ExpressionResolver.ExpressionResolverSupport, Serializable

      public interface Datastore
      extends DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>, ConfigurableDatastore, Serializable

  Datastore interface represents a generic data store abstraction and provides methods to perform data manipulation operations.

  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 in both directions.

  Extends `DatastoreCommodityHandler` to support `DatastoreCommodity` creation by type.

  Extends `ExpressionResolver.ExpressionResolverSupport` to allow `ExpressionResolver`s registration, which can be used to extend and/or customize the datastore operations.

  Since:
    5.0.0
  See Also:
    `DatastoreCommodityFactory`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `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.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.datastore.DatastoreOperations

      `DatastoreOperations.Builder<D extends DatastoreOperations,B extends DatastoreOperations.Builder<D,B>>, DatastoreOperations.WriteOption`

  - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default BulkDelete` | `bulkDelete(DataTarget<?> target, DatastoreOperations.WriteOption... options)` Create a `BulkDelete` operation, which can be used to configure and execute a bulk `DELETE` operation.
    `default BulkInsert` | `bulkInsert(DataTarget<?> target, PropertySet<?> propertySet, DatastoreOperations.WriteOption... options)` Create a `BulkInsert` operation, which can be used to configure and execute a bulk `INSERT` operation.
    `default BulkUpdate` | `bulkUpdate(DataTarget<?> target, DatastoreOperations.WriteOption... options)` Create a `BulkUpdate` operation, which can be used to configure and execute a bulk `UPDATE` operation.
    `default Datastore.OperationResult` | `delete(DataTarget<?> target, PropertyBox propertyBox, DatastoreOperations.WriteOption... options)` Remove a `PropertyBox` from the data store, using given `target` to denote the data store persistent entity from which the data has to be deleted.
    `default Datastore.OperationResult` | `insert(DataTarget<?> target, PropertyBox propertyBox, DatastoreOperations.WriteOption... options)` Insert a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be inserted.
    `default Optional<Transactional>` | `isTransactional()` Check if this Datastore is `Transactional`, i.e. supports execution of transactional operations.
    `default Query` | `query()` Create a `Query` commodity, which can be used to configure and execute a query on the data managed by this Datastore.
    `default Query` | `query(DataTarget<?> target)` Create a `Query` commodity, setting given `target` as query data target.
    `default PropertyBox` | `refresh(DataTarget<?> target, PropertyBox propertyBox)` Refresh a `PropertyBox`, updating all its model properties to current value in data store and using given `target` to denote the data store persistent entity to use.
    `default Transactional` | `requireTransactional()` Requires this Datastore to be `Transactional`, i.e. to support execution of transactional operations, throwing an `IllegalStateException` if this Datastore is not transactional.
    `default Datastore.OperationResult` | `save(DataTarget<?> target, PropertyBox propertyBox, DatastoreOperations.WriteOption... options)` Save a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be saved.
    `default Datastore.OperationResult` | `update(DataTarget<?> target, PropertyBox propertyBox, DatastoreOperations.WriteOption... options)` Update a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be updated.

    - ### Methods inherited from interface com.holonplatform.core.datastore.DatastoreCommodityHandler

      `create, getAvailableCommodities, hasCommodity`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolver, addExpressionResolvers, removeExpressionResolver`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DataContextBound

      `getDataContextId`

- - ### Method Detail

    - #### refresh

          default PropertyBox refresh(DataTarget<?> target,
                                      PropertyBox propertyBox)

      Description copied from interface: `DatastoreOperations`
      Refresh a `PropertyBox`, updating all its model properties to current value in data store and using given `target` to denote the data store persistent entity to use.
      Specified by:
        `refresh` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to declare the data store persistent entity from which data has to be refreshed
        `propertyBox` - The data to refresh, represented using a `PropertyBox` (not null)
      Returns:
        The refresh operation result, which should provide the refreshed PropertyBox instance

    - #### insert

          default Datastore.OperationResult insert(DataTarget<?> target,
                                                   PropertyBox propertyBox,
                                                   DatastoreOperations.WriteOption... options)

      Description copied from interface: `DatastoreOperations`
      Insert a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be inserted.
      Specified by:
        `insert` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to declare the data store persistent entity into which the data has to be inserted (not null)
        `propertyBox` - The data to insert, represented using a `PropertyBox` (not null)
        `options` - Optional write options. The write options are specific for each concrete `DatastoreOperations` implementation.
      Returns:
        the operation execution result

    - #### update

          default Datastore.OperationResult update(DataTarget<?> target,
                                                   PropertyBox propertyBox,
                                                   DatastoreOperations.WriteOption... options)

      Description copied from interface: `DatastoreOperations`
      Update a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be updated.
      Specified by:
        `update` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to declare the data store persistent entity into which the data has to be updated (not null)
        `propertyBox` - The data to update, represented using a `PropertyBox` (not null)
        `options` - Optional write options. The write options are specific for each concrete `DatastoreOperations` implementation.
      Returns:
        the operation execution result

    - #### save

          default Datastore.OperationResult save(DataTarget<?> target,
                                                 PropertyBox propertyBox,
                                                 DatastoreOperations.WriteOption... options)

      Description copied from interface: `DatastoreOperations`
      Save a `PropertyBox` in the data store, using given `target` to denote the data store persistent entity into which the data has to be saved. The save operation semantics is: insert data if not exists, update it otherwise.
      Specified by:
        `save` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to declare the data store persistent entity into which the data has to be saved (not null)
        `propertyBox` - The data to save, represented using a `PropertyBox` (not null)
        `options` - Optional write options. The write options are specific for each concrete `DatastoreOperations` implementation.
      Returns:
        the operation execution result

    - #### delete

          default Datastore.OperationResult delete(DataTarget<?> target,
                                                   PropertyBox propertyBox,
                                                   DatastoreOperations.WriteOption... options)

      Description copied from interface: `DatastoreOperations`
      Remove a `PropertyBox` from the data store, using given `target` to denote the data store persistent entity from which the data has to be deleted.
      Specified by:
        `delete` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to declare the data store persistent entity from which the data has to be deleted (not null)
        `propertyBox` - The data to delete, represented using a `PropertyBox` (not null)
        `options` - Optional write options. The write options are specific for each concrete `DatastoreOperations` implementation.
      Returns:
        the operation execution result

    - #### bulkInsert

          default BulkInsert bulkInsert(DataTarget<?> target,
                                        PropertySet<?> propertySet,
                                        DatastoreOperations.WriteOption... options)

      Create a `BulkInsert` operation, which can be used to configure and execute a bulk `INSERT` operation.
      Specified by:
        `bulkInsert` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to identify the data entity to insert (not null)
        `propertySet` - 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` values
        `options` - Optional write options. The write options are specific for each concrete `Datastore` implementation.
      Returns:
        A new `BulkInsert` operation

    - #### bulkUpdate

          default BulkUpdate bulkUpdate(DataTarget<?> target,
                                        DatastoreOperations.WriteOption... options)

      Create a `BulkUpdate` operation, which can be used to configure and execute a bulk `UPDATE` operation.
      Specified by:
        `bulkUpdate` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to identify the data entity to update (not null)
        `options` - Optional write options. The write options are specific for each concrete `Datastore` implementation.
      Returns:
        A new `BulkUpdate` operation

    - #### bulkDelete

          default BulkDelete bulkDelete(DataTarget<?> target,
                                        DatastoreOperations.WriteOption... options)

      Create a `BulkDelete` operation, which can be used to configure and execute a bulk `DELETE` operation.
      Specified by:
        `bulkDelete` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Parameters:
        `target` - `DataTarget` to identify the data entity to delete (not null)
        `options` - Optional write options. The write options are specific for each concrete `Datastore` implementation.
      Returns:
        A new `BulkDelete` operation

    - #### query

          default Query query()

      Create a `Query` commodity, which can be used to configure and execute a query on the data managed by this Datastore.
      Specified by:
        `query` in interface `DatastoreOperations<Datastore.OperationResult,PropertyBox,BulkInsert,BulkUpdate,BulkDelete,Query>`
      Returns:
        A new `Query` instance, which can be used to configure and execute a query

    - #### query

          default Query query(DataTarget<?> target)

      Create a `Query` commodity, setting given `target` as query data target.
      Parameters:
        `target` - Query data target (not null)
      Returns:
        A new `Query` instance, which can be used to configure and execute a query

    - #### isTransactional

          default Optional<Transactional> isTransactional()

      Check if this Datastore is `Transactional`, i.e. supports execution of transactional operations.
      Returns:
        If this Datastore is transactional, return the Datastore as `Transactional`, or an empty Optional otherwise

    - #### requireTransactional

          default Transactional requireTransactional()

      Requires this Datastore to be `Transactional`, i.e. to support execution of transactional operations, throwing an `IllegalStateException` if this Datastore is not transactional.
      Returns:
        the Datastore as `Transactional`
      Throws:
        `IllegalStateException` - If this Datastore is not transactional

Copyright © 2019 The Holon Platform. All rights reserved.