Add repository config substates

- Add parent state to RepositoryState
  and use it in model factory.
- Relates to #262
This commit is contained in:
Janne Valkealahti
2016-10-01 09:34:31 +01:00
parent 27d67bfd47
commit de556f0d54
8 changed files with 261 additions and 8 deletions

View File

@@ -23,6 +23,13 @@ package org.springframework.statemachine.data;
*/
public interface RepositoryState {
/**
* Gets the parent state.
*
* @return the parent state
*/
String getParentState();
/**
* Gets the machine id.
*

View File

@@ -62,7 +62,7 @@ public class RepositoryStateMachineModelFactory implements StateMachineModelFact
Collection<StateData<String, String>> stateData = new ArrayList<>();
for (RepositoryState s : stateRepository.findByMachineId(machineId)) {
stateData.add(new StateData<String, String>(s.getState(), s.isInitial()));
stateData.add(new StateData<String, String>(s.getParentState(), null, s.getState(), s.isInitial()));
}
StatesData<String, String> statesData = new StatesData<>(stateData);