Class RepositoryStateMachinePersist<M extends RepositoryStateMachine,S,E>
java.lang.Object
org.springframework.statemachine.data.RepositoryStateMachinePersist<M,S,E>
- Type Parameters:
S- the type of stateE- the type of eventM- the type of entity
- All Implemented Interfaces:
StateMachinePersist<S,E, Object>
- Direct Known Subclasses:
JpaRepositoryStateMachinePersist,MongoDbRepositoryStateMachinePersist,RedisRepositoryStateMachinePersist
public abstract class RepositoryStateMachinePersist<M extends RepositoryStateMachine,S,E>
extends Object
implements StateMachinePersist<S,E,Object>
Base implementation of a
StateMachinePersist using Spring Data Repositories.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates a new repository state machine persist.protectedRepositoryStateMachinePersist(StateMachineSerialisationService<S, E> serialisationService) Instantiates a new repository state machine persist. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Mbuild(StateMachineContext<S, E> context, Object contextObj, byte[] serialisedContext) Builds the genericRepositoryStateMachineentity.protected abstract StateMachineRepository<M>Gets the repository.Read aStateMachineContextfrom a persistent store with a context objectT.voidwrite(StateMachineContext<S, E> context, Object contextObj) Write aStateMachineContextinto a persistent store with a context objectT.
-
Constructor Details
-
RepositoryStateMachinePersist
protected RepositoryStateMachinePersist()Instantiates a new repository state machine persist. -
RepositoryStateMachinePersist
Instantiates a new repository state machine persist.- Parameters:
serialisationService- the serialisation service
-
-
Method Details
-
write
Description copied from interface:StateMachinePersistWrite aStateMachineContextinto a persistent store with a context objectT.- Specified by:
writein interfaceStateMachinePersist<M extends RepositoryStateMachine,S, E> - Parameters:
context- the contextcontextObj- the context ojb- Throws:
Exception- the exception
-
read
Description copied from interface:StateMachinePersistRead aStateMachineContextfrom a persistent store with a context objectT.- Specified by:
readin interfaceStateMachinePersist<M extends RepositoryStateMachine,S, E> - Parameters:
contextObj- the context ojb- Returns:
- the state machine context
- Throws:
Exception- the exception
-
getRepository
Gets the repository.- Returns:
- the repository
-
build
protected abstract M build(StateMachineContext<S, E> context, Object contextObj, byte[] serialisedContext) Builds the genericRepositoryStateMachineentity.- Parameters:
context- the contextcontextObj- the context objserialisedContext- the serialised context- Returns:
- the repository state machine entity
-