public class JSONMapEntityStoreMixin extends Object implements EntityStore, EntityStoreSPI, StateStore, JSONMapEntityStoreActivation
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 and Cache extensions.
MapEntityStore implementations will get their values as JSON.
Modifier and Type | Class and Description |
---|---|
static class |
JSONMapEntityStoreMixin.CacheState |
JSONMapEntityStoreActivation.Activator
Constructor and Description |
---|
JSONMapEntityStoreMixin() |
Modifier and Type | Method and Description |
---|---|
StateCommitter |
applyChanges(EntityStoreUnitOfWork unitOfWork,
Iterable<EntityState> state) |
EntityState |
entityStateOf(EntityStoreUnitOfWork unitOfWork,
ModuleSpi module,
EntityReference identity) |
Input<EntityState,EntityStoreException> |
entityStates(ModuleSpi module) |
JSONObject |
jsonStateOf(String id) |
EntityState |
newEntityState(EntityStoreUnitOfWork unitOfWork,
ModuleSpi module,
EntityReference identity,
EntityDescriptor entityDescriptor) |
EntityStoreUnitOfWork |
newUnitOfWork(Usecase usecaseMetaInfo,
ModuleSpi module,
long currentTime) |
protected String |
newUnitOfWorkId() |
protected JSONEntityState |
readEntityState(ModuleSpi module,
Reader entityState) |
void |
setUpJSONMapES() |
void |
tearDownJSONMapES() |
protected void |
writeEntityState(JSONEntityState state,
Writer writer,
String identity,
long lastModified) |
protected String uuid
public void setUpJSONMapES() throws Exception
setUpJSONMapES
in interface JSONMapEntityStoreActivation
Exception
public void tearDownJSONMapES() throws Exception
tearDownJSONMapES
in interface JSONMapEntityStoreActivation
Exception
public EntityStoreUnitOfWork newUnitOfWork(Usecase usecaseMetaInfo, ModuleSpi module, long currentTime)
newUnitOfWork
in interface EntityStore
public EntityState newEntityState(EntityStoreUnitOfWork unitOfWork, ModuleSpi module, EntityReference identity, EntityDescriptor entityDescriptor)
newEntityState
in interface EntityStoreSPI
public EntityState entityStateOf(EntityStoreUnitOfWork unitOfWork, ModuleSpi module, EntityReference identity)
entityStateOf
in interface EntityStoreSPI
public StateCommitter applyChanges(EntityStoreUnitOfWork unitOfWork, Iterable<EntityState> state) throws EntityStoreException
applyChanges
in interface EntityStoreSPI
EntityStoreException
public Input<EntityState,EntityStoreException> entityStates(ModuleSpi module)
entityStates
in interface EntityStore
protected String newUnitOfWorkId()
protected void writeEntityState(JSONEntityState state, Writer writer, String identity, long lastModified) throws EntityStoreException
EntityStoreException
protected JSONEntityState readEntityState(ModuleSpi module, Reader entityState) throws EntityStoreException
EntityStoreException
public JSONObject jsonStateOf(String id) throws IOException
jsonStateOf
in interface StateStore
IOException