public class MapEntityStoreMixin extends Object implements EntityStore, EntityStoreSPI, StateStore, MapEntityStoreActivation
Implement MapEntityStore
and add as mixin to the service using this mixin.
See MemoryMapEntityStoreMixin
for reference.
EntityStores based on this mixin gets support for the Migration extension.
MapEntityStore implementations will get their values as JSON.
MapEntityStoreActivation.Activator
Constructor and Description |
---|
MapEntityStoreMixin() |
Modifier and Type | Method and Description |
---|---|
void |
activateMapEntityStore() |
StateCommitter |
applyChanges(EntityStoreUnitOfWork uow,
Iterable<EntityState> state) |
EntityState |
entityStateOf(EntityStoreUnitOfWork uow,
ModuleDescriptor module,
EntityReference reference) |
Stream<EntityState> |
entityStates(ModuleDescriptor module)
Stream of all entity states, must be closed.
|
javax.json.JsonObject |
jsonStateOf(String id) |
EntityState |
newEntityState(EntityStoreUnitOfWork uow,
EntityReference reference,
EntityDescriptor entityDescriptor) |
EntityStoreUnitOfWork |
newUnitOfWork(ModuleDescriptor module,
Usecase usecase,
Instant currentTime) |
protected Identity |
newUnitOfWorkId() |
protected EntityState |
readEntityState(ModuleDescriptor module,
Reader entityState) |
String |
versionOf(EntityStoreUnitOfWork uow,
EntityReference reference) |
protected void |
writeEntityState(DefaultEntityState state,
Writer writer,
String version,
Instant lastModified) |
public void activateMapEntityStore()
activateMapEntityStore
in interface MapEntityStoreActivation
public EntityStoreUnitOfWork newUnitOfWork(ModuleDescriptor module, Usecase usecase, Instant currentTime)
newUnitOfWork
in interface EntityStore
public EntityState newEntityState(EntityStoreUnitOfWork uow, EntityReference reference, EntityDescriptor entityDescriptor)
newEntityState
in interface EntityStoreSPI
public EntityState entityStateOf(EntityStoreUnitOfWork uow, ModuleDescriptor module, EntityReference reference)
entityStateOf
in interface EntityStoreSPI
public String versionOf(EntityStoreUnitOfWork uow, EntityReference reference)
versionOf
in interface EntityStoreSPI
public StateCommitter applyChanges(EntityStoreUnitOfWork uow, Iterable<EntityState> state) throws EntityStoreException
applyChanges
in interface EntityStoreSPI
EntityStoreException
public Stream<EntityState> entityStates(ModuleDescriptor module)
EntityStore
entityStates
in interface EntityStore
module
- Moduleprotected Identity newUnitOfWorkId()
protected void writeEntityState(DefaultEntityState state, Writer writer, String version, Instant lastModified) throws EntityStoreException
EntityStoreException
protected EntityState readEntityState(ModuleDescriptor module, Reader entityState) throws EntityStoreException
EntityStoreException
public javax.json.JsonObject jsonStateOf(String id)
jsonStateOf
in interface StateStore