Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3015 content API: cleanup
  3. MAGNOLIA-3022

content API cleanup: improve/align createNodeData(), getNodeData and setNodeData(), respectively make them compliant to JCR

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3
    • None
    • core
    • None

      The JCR specification does not support empty properties:

      • only the setProperty() method exists
      • setting a property to null removes it

      But the content API has both createNodeData() and setNodeData() methods but since they use JCR properties they behave which I consider being wrong:

      • createNodeData(name) will not fail if a node data already exist
      • setNodeData(name) will not fail it the node data doesn't exist yet
      • getNodeData(name) will never fail but return an nodeData where isExists() might return false
      • createNodeData(name, type) creates a property by setting an empty string value (null would not create a property) no matter what type you specify

      So there are two solutions possible:

      A) differentiate the creation and setting

      • means throw exception if you are doing wrong

      B) drop the explicit creation (as in JCR)

      I am very much in favor of B) and would like to deprecate all createNodeData() methods

            pbaerfuss Philipp Bärfuss
            pbaerfuss Philipp Bärfuss
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: