org.qi4j.spi.entitystore

## Interface EntityStoreUnitOfWork

- All Known Implementing Classes:
    DefaultEntityStoreUnitOfWork, ModuleEntityStoreUnitOfWork

      public interface EntityStoreUnitOfWork

  EntityStore UnitOfWork.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `StateCommitter` | `applyChanges()`
    `long` | `currentTime()`
    `void` | `discard()`
    `EntityState` | `entityStateOf(ModuleSpi module, EntityReference anIdentity)` Get the EntityState for a given identity.
    `String` | `identity()`
    `EntityState` | `newEntityState(ModuleSpi module, EntityReference anIdentity, EntityDescriptor entityDescriptor)` Create new EntityState for a given identity.
    `Usecase` | `usecase()`

- - ### Method Detail

    - #### identity

          String identity()

    - #### currentTime

          long currentTime()

    - #### newEntityState

          EntityState newEntityState(ModuleSpi module,
                                   EntityReference anIdentity,
                                   EntityDescriptor entityDescriptor)
                                     throws EntityStoreException

      Create new EntityState for a given identity.

      This should only create the EntityState and not insert it into any database, since that should occur during the `applyChanges()` call.

      Parameters:
        `anIdentity` - the identity of the entity
        `entityDescriptor` - entity descriptor
      Returns:
        The new entity state.
      Throws:
        `EntityStoreException` - Thrown if creational fails.

    - #### entityStateOf

          EntityState entityStateOf(ModuleSpi module,
                                  EntityReference anIdentity)
                                    throws EntityStoreException,
                                           EntityNotFoundException

      Get the EntityState for a given identity. Throws `EntityNotFoundException` if the entity with given `anIdentity` is not found.
      Parameters:
        `anIdentity` - The entity identity. This argument must not be `null`.
      Returns:
        Entity state given the composite descriptor and identity.
      Throws:
        `EntityStoreException` - thrown if retrieval failed.
        `EntityNotFoundException` - if requested entity does not exist

    - #### applyChanges

          StateCommitter applyChanges()
                                      throws EntityStoreException

      Throws:
        `EntityStoreException`

    - #### discard

          void discard()

    - #### usecase

          Usecase usecase()