Class NodeTypeDefDiff

java.lang.Object
org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeDefDiff

public class NodeTypeDefDiff extends Object
A NodeTypeDefDiff represents the result of the comparison of two node type definitions.

The result of the comparison can be categorized as one of the following types:

NONE indicates that there is no modification at all.

A TRIVIAL modification has no impact on the consistency of existing content. The following modifications are considered TRIVIAL:

  • changing node type orderableChildNodes flag
  • changing node type primaryItemName value
  • adding non-mandatory property/child node
  • changing property/child node protected flag
  • changing property/child node onParentVersion value
  • changing property/child node mandatory flag to false
  • changing property/child node autoCreated flag
  • changing specific property/child node name to *
  • changing child node defaultPrimaryType
  • changing child node sameNameSiblings flag to true
  • weaken child node requiredPrimaryTypes (e.g. by removing)
  • weaken property valueConstraints (e.g. by removing a constraint or by making a specific constraint less restrictive)
  • changing property defaultValues
  • changing specific property requiredType to undefined
  • changing property multiple flag to true

A MAJOR modification potentially affects the consistency of existing content. All modifications that are not TRIVIAL are considered MAJOR.

This class duplicates code from org.apache.jackrabbit.spi.commons.nodetype.NodeTypeDefDiff; both should be updated in sync, see OAK-2802

  • Field Details

    • NONE

      public static final int NONE
      no modification
      See Also:
    • TRIVIAL

      public static final int TRIVIAL
      trivial modification: does not affect consistency of existing content
      See Also:
    • MAJOR

      public static final int MAJOR
      major modification: does affect consistency of existing content
      See Also:
  • Method Details

    • create

      public static NodeTypeDefDiff create(NodeTypeDefinition oldDef, NodeTypeDefinition newDef)
      Parameters:
      oldDef - old definition
      newDef - new definition
      Returns:
      the diff
    • isModified

      public boolean isModified()
      Returns:
      true if modified
    • isTrivial

      public boolean isTrivial()
      Returns:
      true if trivial
    • isMajor

      public boolean isMajor()
      Returns:
      true if major
    • getType

      public int getType()
      Returns the type of modification as expressed by the following constants:
      • NONE: no modification at all
      • TRIVIAL: does not affect consistency of existing content
      • MAJOR: does affect consistency of existing content
      Returns:
      the type of modification
    • mixinFlagDiff

      public int mixinFlagDiff()
      Returns:
      true if mixin flag diff
    • abstractFlagDiff

      public int abstractFlagDiff()
      Returns:
      true if abstract flag diff
    • supertypesDiff

      public int supertypesDiff()
      Returns:
      true if supertypes diff
    • toString

      public String toString()
      Overrides:
      toString in class Object