A Context is created by your application to provide the right dependencies
('context') for the statemachine to work with.
It seperates the concerns for the statemachine of how you are reading/writing
state data and of how you access your domain models.
Important are:
- the entity id, which references an application domain specific object
like 'Order' or 'Customer' that goes through some finite states in it's
lifecycle.
- the machine name, which is the type identifier for the machine and related
to the entity (eg: 'order-machine')
- persistence adapter, which reads/writes to/from a storage facility
- entity_builder, which constructs the stateful entity.
The entity is the object that will be acted upon by the
Statemachine. This stateful object will be uniquely identified by it's id,
which will mostly be some sort of primary key for that object that is defined
by the application specific implementation.
A reference to the stateful object can be obtained via the factory method
getEntity().
This class delegates reading and writing states to specific implementations
of the Adapter classes. this is useful for
testing and creating specific behaviour for statemachines that need extra
functionality to get and set the correct states.