Although in most cases the model context lives in memory only, there are situations where it has to be stored persistently. A typical example is an approval workflow: a user requests an operation that has to be made, but the operation (or some parts of it) may be subject of an approval. Therefore, the whole model operation context has to be stored until the approval is obtained. Then it is revived, and the operation is allowed to continue.
Originally the storage of model context was implemented using java serialization. From midPoint 2.2 onwards, we have developed an XML serialization format for the context, in order to be able to easily upgrade midPoint even with some of workflows being in-progress.
The serialized context looks like this: