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.- Author:
- Janne Valkealahti
-
Constructor Summary
ModifierConstructorDescriptionprotected
Instantiates a new repository state machine persist.protected
RepositoryStateMachinePersist
(StateMachineSerialisationService<S, E> serialisationService) Instantiates a new repository state machine persist. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract M
build
(StateMachineContext<S, E> context, Object contextObj, byte[] serialisedContext) Builds the genericRepositoryStateMachine
entity.protected abstract StateMachineRepository<M>
Gets the repository.Read aStateMachineContext
from a persistent store with a context objectT
.void
write
(StateMachineContext<S, E> context, Object contextObj) Write aStateMachineContext
into 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:StateMachinePersist
Write aStateMachineContext
into a persistent store with a context objectT
.- Specified by:
write
in interfaceStateMachinePersist<M extends RepositoryStateMachine,
S, E> - Parameters:
context
- the contextcontextObj
- the context ojb- Throws:
Exception
- the exception
-
read
Description copied from interface:StateMachinePersist
Read aStateMachineContext
from a persistent store with a context objectT
.- Specified by:
read
in 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 genericRepositoryStateMachine
entity.- Parameters:
context
- the contextcontextObj
- the context objserialisedContext
- the serialised context- Returns:
- the repository state machine entity
-