content API: cleanup (MAGNOLIA-3015)

[MAGNOLIA-3022] content API cleanup: improve/align createNodeData(), getNodeData and setNodeData(), respectively make them compliant to JCR Created: 19/Jan/10  Updated: 23/Jan/13  Resolved: 18/Mar/10

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 4.3

Type: Sub-task Priority: Major
Reporter: Philipp Bärfuss Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
depends upon MAGNOLIA-3024 content API cleanup: deprecate create... Closed
Template:

 Description   

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


Generated at Mon Feb 12 03:42:25 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.