Class ParameterizedEquivalenceStrategy

java.lang.Object
com.evolveum.midpoint.prism.equivalence.ParameterizedEquivalenceStrategy
All Implemented Interfaces:
EquivalenceStrategy, Cloneable

public class ParameterizedEquivalenceStrategy extends Object implements EquivalenceStrategy, Cloneable
Implementation of EquivalenceStrategy that uses a parametrization of built-in equals/hashCode/diff methods. These strategies are still in progress and (most probably) will be changed. L = literalDomComparison Compares DOM nodes literally. Currently, this means that the comparison considers namespace prefixes. Also, (a bit unrelated to DOM): when comparing relations, treats "null" and "org:default" relations as different. E = consideringElementNames Takes item names into account. So, for example, "c:user ..." is different from "x:dummy xsi:type=UserType ...". It looks like a negligible difference that is good to ignore, but beware: this also ensures that uid=jack attribute is different from name=jack attribute, when comparing attributes as prism properties. (When comparing them in their containers, element names are treated as different automatically.) O = consideringOperationalData Takes operational items into account (when comparing PCVs). Assumes that the definition is set, otherwise operational status cannot be determined. Currently, when calling operationalItem1.equals(operationalItem2), the fact that "root" items are operational, does not play any role. This could change in the future. See TestParseDiffPath.checkComparisonOfOperationalItems. I = consideringContainerIds When comparing PCVs we require their IDs are equal. So (e.g.) null vs. null is OK, 123 vs. 123 is OK, null vs. 123 is not OK, 123 vs. 456 is not OK. i = consideringDifferentContainerIds When comparing PCVs we require their IDs are not contradicting. So (e.g.) null vs. 123 is OK, null vs. null is OK, 123 vs. 456 is not OK. F = consideringReferenceFilters When comparing references, should we compare also reference filters? (An exception is the case when both OIDs are null: in that case we always compare the references.) r = consideringReferenceOptions (resolution time, reference integrity) When comparing references, should we compare also resolution options, i.e. resolution time and referential integrity? M = consideringValueMetadata When comparing prism values, should we take into account value metadata? If yes, we apply the same strategy to them as was used for data comparison. n = consideringNaturalKeys When comparing prism values, should we take into account natural keys? Summary of individual strategies: LITERAL L E O I i F r M - DATA - E O I i F r M - DATA_ALLOW_MISSING_IDS - E O - i F r M - IGNORE_METADATA - E - - - F r - - REAL_VALUE_CONSIDER_DIFFERENT_IDS - - - - i - - - - REAL_VALUE - - - - - - - - - REAL_VALUE_CONSIDER_DIFFERENT_IDS_NATURAL_KEYS - - - - i - - - n Open questions ============== The difference between REAL_VALUE and IGNORE_METADATA is to be established yet. Basically, REAL_VALUE is oriented towards the effective content of the item or value. Contrary to IGNORE_METADATA it ignores reference filters (if OID is present) and reference resolution options (resolution time, reference integrity).
  • Field Details

  • Constructor Details

    • ParameterizedEquivalenceStrategy

      public ParameterizedEquivalenceStrategy()
  • Method Details

    • getLiteral

      public static ParameterizedEquivalenceStrategy getLiteral()
    • getDescription

      public String getDescription()
    • equals

      public boolean equals(Item<?,?> first, Item<?,?> second)
      Specified by:
      equals in interface EquivalenceStrategy
    • equals

      public boolean equals(PrismValue first, PrismValue second)
      Specified by:
      equals in interface EquivalenceStrategy
    • hashCode

      public int hashCode(Item<?,?> item)
      Specified by:
      hashCode in interface EquivalenceStrategy
    • hashCode

      public int hashCode(PrismValue value)
      Specified by:
      hashCode in interface EquivalenceStrategy
    • isConsideringDefinitions

      public boolean isConsideringDefinitions()
    • isConsideringElementNames

      public boolean isConsideringElementNames()
    • setConsideringElementNames

      public void setConsideringElementNames(boolean compareElementNames)
    • isLiteralDomComparison

      public boolean isLiteralDomComparison()
    • setLiteralDomComparison

      public void setLiteralDomComparison(boolean literalDomComparison)
    • isConsideringContainerIds

      public boolean isConsideringContainerIds()
    • setConsideringContainerIds

      public void setConsideringContainerIds(boolean consideringContainerIds)
    • isConsideringDifferentContainerIds

      public boolean isConsideringDifferentContainerIds()
    • setConsideringDifferentContainerIds

      public void setConsideringDifferentContainerIds(boolean consideringDifferentContainerIds)
    • isConsideringOperationalData

      public boolean isConsideringOperationalData()
    • setConsideringOperationalData

      public void setConsideringOperationalData(boolean consideringOperationalData)
    • isConsideringReferenceFilters

      public boolean isConsideringReferenceFilters()
    • setConsideringReferenceFilters

      public void setConsideringReferenceFilters(boolean consideringReferenceFilters)
    • isConsideringReferenceOptions

      public boolean isConsideringReferenceOptions()
    • setConsideringReferenceOptions

      public void setConsideringReferenceOptions(boolean consideringReferenceOptions)
    • isHashRuntimeSchemaItems

      public boolean isHashRuntimeSchemaItems()
    • setHashRuntimeSchemaItems

      public void setHashRuntimeSchemaItems(boolean hashRuntimeSchemaItems)
    • isConsideringValueMetadata

      public boolean isConsideringValueMetadata()
    • setConsideringValueMetadata

      public void setConsideringValueMetadata(boolean consideringValueMetadata)
    • isConsideringNaturalKeys

      public boolean isConsideringNaturalKeys()
    • setConsideringNaturalKeys

      public void setConsideringNaturalKeys(boolean consideringNaturalKeys)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      Overrides:
      clone in class Object
    • exceptForValueMetadata

      public ParameterizedEquivalenceStrategy exceptForValueMetadata()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object