Comparing prism values

Last modified 27 Oct 2021 12:21 +02:00

Prism values are compared in various contexts, requiring different definitions of what "equality" means. Such definitions are called "equivalence strategies" in midPoint code.

The two mostly used strategies are:

Data

Captures the full meaning of the data, while ignoring minor (mostly serialization-related) aspects that are not relevant for the parsed data, like namespace prefixes or null vs. default relation value in references.

The Data strategy is used for equals and hashCode methods in Java code.

Real value (with or without considering different IDs)

Captures the "real value" of the data: it is something that we consider equivalent so that if prism values A and B have the same real value, we do not want to be both present in the same multi-valued item (like assignment, roleMembershipRef, or whatever).

However, in reality, we usually take container IDs (if both are present) into account, so if PCV A1 and A2 have equal content but different IDs they are treated as different. This is reflected in "Real value considering different IDs" variant of this strategy.

"Real value considering different IDs" strategy is used for delta application.

Other equivalence strategies

Strategy Description

Literal

Currently the highest level of recognition. Roughly corresponds to comparing serialized forms of the data. Useful e.g. for comparing values for the purpose of XML editing.

Ignores aspects that are not covered by serialization e.g. definitions, parent objects, origin, immutability flag, etc. (These aspects are ignored by all equivalence strategies.)

Ignore metadata

Something between Data and Real value: ignores operational items and values, container IDs, value metadata (just like Real value) but takes reference filters and reference resolution options (time, integrity) into account (like Data).

It is not quite clear whether and when to use this strategy.

Was this page helpful?
YES NO
Thanks for your feedback