Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-13587

Support stable auto created UUID property on Jcr Nodes

    XMLWordPrintable

Details

    Description

      Requirements

      We need to be able to have logical references which CAN'T be based on jcr:uuid and neither on jcr path, since for example the logical reference most be the same for two different nodes. Think about 'content blocks' or hippo document compounds, which are nodes below a document variant : the same representations are typically present between draft, unpublished and published, however, certainly in case of SNS, it is not possible to know for which which nodes are the equivalent between document variants

      Same goes for XPages: For XPages, we need to be able to have a property on the containers of an XPage layout which is stable across different copies (preview|live and branches) of the XPage Layout : this is because an XPage document refers to those containers

      The idea is to support this via a cnd mixin:

      [hippo:identifiable] mixin
      - hippo:identifier (string) autocreated
      

      when having the above mixin on a nodetype, an identifier (uuid) should be auto created. The behavior need to be as follows:

      1. For newly created nodes with mixin hippo:identifiable, the hippo:identifier should be added automatically as with a generated uuid value
      2. When a node is copied with mixin hippo:identifiable and having hippo:identifier, its value should be copied AS-IS
      3. When a node which is not of type hippo:identifier but the backing nodetype in the CND has the mixin hippo:identifier added, then when copying that node, the property hippo:identifier should also be auto created

      Implementation

      The above functionality is very similar to builtin / JCR standard mixins like mix:lastModified which also defines auto created properties, like jcr:lastModified:

       

      [mix:lastModified] mixin
      - jcr:lastModified (date) autocreated
      - jcr:lastModifiedBy (string) autocreated 
      

      The problem however is that:

      1. this is 'builtin' functionality (by spec), and its implementation is internal to the Jackrabbit engine (class org.apache.jackrabbit.core.NodeTypeInstanceHandler)
      2. jackrabbit requires that autocreated properties must have a (static) default value (note: the spec actually is more lenient, but Jackrabbit is not)

      To solve this specific use-case therefore requires 2 specific changes (patches) within Jackrabbit:

      1. Extend/patch its NodeTypeInstanceHandler class to handle the auto generation of the (uuid) value for a hippo:identifier property (when declared by hippo:identifiable)
      2. Patch the NodeTypeRegistry to not require a default value for this property in the nodetype definition
        Note: internally Jackrabbit *is* more lenient on this, but only for the builtin (by spec) autocreated properties like for jcr:lastModified.
        So we must make it also more lenient for our hippo:identifier property of the hippo:identifiable mixin (specifically)

      The above 2 changes and patches are quite trivial to implement, but as said, only can be done within Jackrabbit, so this requires a new hippo-jackrabbit release to be able to use it.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aschrijvers Ard Schrijvers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: