-
D = ( Da, Dd, Dr ) be the delta,
-
Da, Dd, Dr being add, delete, and replace sets, respectively,
-
-
I be the set of item values before D application,
-
I' be the set of values after D application.
Item delta
Item delta content
Just to summarize, an item delta consists of three sets of values:
-
values/yields to add (
add
set), -
values/yields to delete (
delete
set), -
values to replace (
replace
set).[2]
Any given item delta is either of "add/delete" type or of "replace" type. It is not possible to specify
add
and/or delete
and replace
sets at the same time.
Item delta application
Let us describe the application of an item delta on given prism item. There are two cases:
-
Application of "add/delete" deltas.
-
Application of "replace" deltas.
For the specification below, let:
(And if needed, please see also the notation.)
Application of "replace" deltas
A "replace" delta is applied by clearing item values and replacing them with the values in delta
replace
set.
Application of "add/delete" deltas
The application is a two-step process:
-
Existing item values or yields matching the delta
delete
set are deleted. -
Values or yields from
add
set are added.
Mathematical description is divided into two parts:
-
Model without metadata
-
Model with metadata
Model without metadata
In fact, Dd does not contain values to be deleted but "deletion patterns" instead. Each value in I is compared with Dd and deleted if it matches any value there. This can be written as I -del/RVDI Dd.
Also, when adding values that have equivalents already present in I, we first remove those equivalents. (Effectively, it is a kind of "add-or-update" operation.) Let’s denote equivalents existing in I as Ir = I ∩RVDI Da.
So:
Note that this is a slight difference introduced in midPoint 4.2. Before 4.2 we simply ignored values from Da that were present in I (under RVDI), i.e. the old behavior was:
Finally, as a special rule: If we are adding a single value va to a single-valued item I = {vi}, and va is different from vi (va ≁RVDI vi) then we consider I to be ∅ i.e. we "clear" the item before applying the delta. Then:
Model with metadata
Short description of Dd treatment:
-
If vd∈Dd has no metadata, simply remove vd from I. This is to ensure backward compatibility.
-
If vd∈Dd has metadata, find an equivalent value vi∼vd and remove these metadata from vi. (And remove vi if no metadata values remain.)
Short description of Da treatment:
-
If va ∉RVDI I, add va to I.
-
If va ∈RVDI I, find an equivalent value vi∼vd, and add yields from va to vi.
Exact description:
It is not feasible to provide a specification of delta application using set operations. Let us resort to a pseudocode instead.
Let:
Then:
For each vd ∈ Dd:
(See Item.removeRespectingMetadata
method.)
For each va ∈ Da:
(See Item.addRespectingMetadataAndCloning
method.)
add
and delete
sets are sufficient to describe an item change. The replace
set is a convenient way how to tell "clear everything and replace by me", without having to deal with existing values. This also means that it is a big difference between null
replace set (meaning replace is not being applied) and empty replace set (meaning "delete everything").