You must follow these steps to implement state transitions using the Persistence Infrastructure helper classes:
- Specify states;
- Specify storage mechanism for the state value;
- Identify transition methods;
- Implement getLifecycleState;
- Create a map to hold the permitted states;
- Create an object for each state;
- Create an object for each permitted transition;
- Create a private getter to retrieve the current State;
- Create a private setter to set the current State;
- Create a private helper method to perform a state transition;
- Implement state transition methods;
- Specify the initial state;
- Add state transition validation logic; and
- Override the modify method (if required).