public final class DefaultEntityStoreUnitOfWork extends Object implements EntityStoreUnitOfWork
Constructor and Description |
---|
DefaultEntityStoreUnitOfWork(ModuleDescriptor module,
EntityStoreSPI entityStoreSPI,
Identity identity,
Usecase usecase,
Instant currentTime) |
Modifier and Type | Method and Description |
---|---|
StateCommitter |
applyChanges() |
Instant |
currentTime() |
void |
discard() |
EntityState |
entityStateOf(ModuleDescriptor module,
EntityReference anIdentity)
Get the EntityState for a given reference.
|
Identity |
identity() |
ModuleDescriptor |
module() |
EntityState |
newEntityState(EntityReference anIdentity,
EntityDescriptor descriptor)
Create new EntityState for a given reference.
|
Usecase |
usecase() |
String |
versionOf(EntityReference anIdentity) |
public DefaultEntityStoreUnitOfWork(ModuleDescriptor module, EntityStoreSPI entityStoreSPI, Identity identity, Usecase usecase, Instant currentTime)
public Identity identity()
identity
in interface EntityStoreUnitOfWork
public Instant currentTime()
currentTime
in interface EntityStoreUnitOfWork
public Usecase usecase()
usecase
in interface EntityStoreUnitOfWork
public ModuleDescriptor module()
module
in interface EntityStoreUnitOfWork
public EntityState newEntityState(EntityReference anIdentity, EntityDescriptor descriptor) throws EntityStoreException
EntityStoreUnitOfWork
This should only create the EntityState and not insert it into any database, since that should occur during
the EntityStoreUnitOfWork.applyChanges()
call.
newEntityState
in interface EntityStoreUnitOfWork
anIdentity
- the reference of the entitydescriptor
- entity descriptorEntityStoreException
- Thrown if creational fails.public EntityState entityStateOf(ModuleDescriptor module, EntityReference anIdentity) throws EntityNotFoundException
EntityStoreUnitOfWork
EntityNotFoundException
if the entity with given anIdentity
is not found.entityStateOf
in interface EntityStoreUnitOfWork
module
- Module descriptoranIdentity
- The entity reference. This argument must not be null
.EntityNotFoundException
- if requested entity does not existpublic String versionOf(EntityReference anIdentity) throws EntityNotFoundException
versionOf
in interface EntityStoreUnitOfWork
EntityNotFoundException
public StateCommitter applyChanges() throws EntityStoreException
applyChanges
in interface EntityStoreUnitOfWork
EntityStoreException
public void discard()
discard
in interface EntityStoreUnitOfWork