com.holonplatform.core.datastore.beans

## Interface BeanDatastore

- All Superinterfaces:
    BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>, DataContextBound, DatastoreCommodityHandler, ExpressionResolver.ExpressionResolverSupport

      public interface BeanDatastore
      extends BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>, DatastoreCommodityHandler, ExpressionResolver.ExpressionResolverSupport, DataContextBound

  A `Datastore` adapter which uses Java Beans as persistent data representation.

  The operations data target (i.e. the persistence entity identifier) is obtained by default using the bean class simple name. The `DataPath` annotation can be used on bean class to declare a specific data target name.

  The bean property names are used as data model attribute names. The `DataPath` annotation can be used on bean property fields or getter methods to specify a different data model attribute name.

  The `of(Datastore)` builder method can be used to obtain a `BeanDatastore` from a concrete `Datastore` instance.

  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `BeanDatastore.BeanOperationResult<T>` Represents the result of a `BeanDatastore` operation, providing informatons about the operation outcome.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> BeanBulkDelete<T>` | `bulkDelete(Class<T> beanClass, DatastoreOperations.WriteOption... options)` Create a `BulkDeleteOperation` actuator, which can be used to configure and execute a bulk `DELETE` operation.
    `<T> BeanBulkInsert<T>` | `bulkInsert(Class<T> beanClass, DatastoreOperations.WriteOption... options)` Create a `BulkInsertOperation` actuator, which can be used to configure and execute a bulk `INSERT` operation.
    `<T> BeanBulkUpdate<T>` | `bulkUpdate(Class<T> beanClass, DatastoreOperations.WriteOption... options)` Create a `BulkUpdateOperation` actuator, which can be used to configure and execute a bulk `UPDATE` operation.
    `<T> BeanDatastore.BeanOperationResult<T>` | `delete(T bean, DatastoreOperations.WriteOption... options)` Remove a bean instance from the data store.
    `<T> BeanDatastore.BeanOperationResult<T>` | `insert(T bean, DatastoreOperations.WriteOption... options)` Insert a bean instance in the data store.
    `Optional<Transactional>` | `isTransactional()` Check if the concrete `Datastore` is `Transactional`, i.e. supports execution of transactional operations.
    `static BeanDatastore` | `of(Datastore datastore)` Get a `BeanDatastore` adapter using given `datastore` as concrete `Datastore`.
    `<T> BeanQuery<T>` | `query(Class<T> beanClass)` Create a `QueryBuilder` actuator, which can be used to configure and execute a query on the data managed by this Datastore.
    `Transactional` | `requireTransactional()` Requires the concrete `Datastore` to be `Transactional`, i.e. to support execution of transactional operations, throwing an `IllegalStateException` if this Datastore is not transactional.
    `<T> BeanDatastore.BeanOperationResult<T>` | `save(T bean, DatastoreOperations.WriteOption... options)` Save a bean instance in the data store.
    `<T> BeanDatastore.BeanOperationResult<T>` | `update(T bean, DatastoreOperations.WriteOption... options)` Update a bean instance in the data store.

    - ### Methods inherited from interface com.holonplatform.core.datastore.beans.BeanDatastoreOperations

      `refresh`

    - ### 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

    - #### insert

          <T> BeanDatastore.BeanOperationResult<T> insert(T bean,
                                                          DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Insert a bean instance in the data store.

      The operation data target (i.e. the persistence entity identifier) is obtained by default using the bean class simple name. The `DataPath` annotation can be used on bean class to declare a specific data target name.

      The bean property names are used as data model attribute names. The `DataPath` annotation can be used on bean property fields or getter methods to specify a different data model attribute name.

      Specified by:
        `insert` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `bean` - The bean instance to insert (not null)
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        the operation execution result

    - #### update

          <T> BeanDatastore.BeanOperationResult<T> update(T bean,
                                                          DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Update a bean instance in the data store.

      The operation data target (i.e. the persistence entity identifier) is obtained by default using the bean class simple name. The `DataPath` annotation can be used on bean class to declare a specific data target name.

      The bean property names are used as data model attribute names. The `DataPath` annotation can be used on bean property fields or getter methods to specify a different data model attribute name.

      Specified by:
        `update` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `bean` - The bean instance to insert (not null)
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        the operation execution result

    - #### save

          <T> BeanDatastore.BeanOperationResult<T> save(T bean,
                                                        DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Save a bean instance in the data store. The save operation semantics is: insert data if not exists, update it otherwise.

      The operation data target (i.e. the persistence entity identifier) is obtained by default using the bean class simple name. The `DataPath` annotation can be used on bean class to declare a specific data target name.

      The bean property names are used as data model attribute names. The `DataPath` annotation can be used on bean property fields or getter methods to specify a different data model attribute name.

      Specified by:
        `save` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `bean` - The bean instance to save (not null)
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        the operation execution result

    - #### delete

          <T> BeanDatastore.BeanOperationResult<T> delete(T bean,
                                                          DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Remove a bean instance from the data store.

      The operation data target (i.e. the persistence entity identifier) is obtained by default using the bean class simple name. The `DataPath` annotation can be used on bean class to declare a specific data target name.

      The bean property names are used as data model attribute names. The `DataPath` annotation can be used on bean property fields or getter methods to specify a different data model attribute name.

      Specified by:
        `delete` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `bean` - The bean instance to delete (not null)
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        the operation execution result

    - #### bulkInsert

          <T> BeanBulkInsert<T> bulkInsert(Class<T> beanClass,
                                           DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Create a `BulkInsertOperation` actuator, which can be used to configure and execute a bulk `INSERT` operation.
      Specified by:
        `bulkInsert` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `beanClass` - The bean class to insert
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        A new bulk `INSERT` operation

    - #### bulkUpdate

          <T> BeanBulkUpdate<T> bulkUpdate(Class<T> beanClass,
                                           DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Create a `BulkUpdateOperation` actuator, which can be used to configure and execute a bulk `UPDATE` operation.
      Specified by:
        `bulkUpdate` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `beanClass` - The bean class to update
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        A new bulk `UPDATE` operation

    - #### bulkDelete

          <T> BeanBulkDelete<T> bulkDelete(Class<T> beanClass,
                                           DatastoreOperations.WriteOption... options)

      Description copied from interface: `BeanDatastoreOperations`
      Create a `BulkDeleteOperation` actuator, which can be used to configure and execute a bulk `DELETE` operation.
      Specified by:
        `bulkDelete` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `beanClass` - The bean class to delete
        `options` - Optional write options. The write options are specific for each concrete implementation.
      Returns:
        A new bulk `DELETE` operation

    - #### query

          <T> BeanQuery<T> query(Class<T> beanClass)

      Description copied from interface: `BeanDatastoreOperations`
      Create a `QueryBuilder` actuator, which can be used to configure and execute a query on the data managed by this Datastore.
      Specified by:
        `query` in interface `BeanDatastoreOperations<BeanDatastore.BeanOperationResult<?>,BeanBulkInsert<?>,BeanBulkUpdate<?>,BeanBulkDelete<?>,BeanQuery<?>>`
      Type Parameters:
        `T` - Bean type
      Parameters:
        `beanClass` - The bean class to query (not null)
      Returns:
        A new query builder

    - #### isTransactional

          Optional<Transactional> isTransactional()

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

    - #### requireTransactional

          Transactional requireTransactional()

      Requires the concrete `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

    - #### of

          static BeanDatastore of(Datastore datastore)

      Get a `BeanDatastore` adapter using given `datastore` as concrete `Datastore`.
      Parameters:
        `datastore` - The concrete `Datastore` to use for persistence operations (not null)
      Returns:
        A new `BeanDatastore` adapter which uses given `Datastore`

Copyright © 2019 The Holon Platform. All rights reserved.