Value Stickiness and Reclamation
TODO: value in model context
TODO: value reclamation
Sequence values are retrieved just once for each operation. The values are kept in Model Context and re-used every time the expression is re-evaluated during that operation. This is a mechanism to avoid taking multiple values from the sequence. However, the assigned value is not explicitly remember across operations. Therefore is is strongly recommended to use sequences in weak mappings.
The operation that retrieved a sequence value may fail before it can persistently store the object. In such a case midPoint will take care of returning the value back to the sequence for reclamation. The sequence value is reused on the following attempt. This is the mechanism that conserves the sequence values and this is what is suitable for most of the cases. However, this may lead to a sequence that is not strictly monotonous. If a monotonous sequence is required then this behavior can be disabled by setting the
maxUnusedValues property of the sequence to zero.
Taking a value from the sequence is an operation that is not entirely reversible and sequences can become depleted of the identifiers. Also, it is difficult to explicitly remember sequence values that were taken - and midPoint does NOT do that. The value is only "remembered" in the target property value. Therefore we strongly recommend to use sequence expression in weak mappings. Weak mappings ensure that the sequence value is only assigned once for each object.
The sequence expressions are currently (midPoint 3.3) supported only in object templates and in focus mappings in roles. The use of sequence expressions in outbound, inbound or any other place is not supported.
Example: UNIX systems
See Unix Story Test for a complete example that is using sequences. The test is using sequences to assign Unix UID and GID numbers.