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
- depends upon
-
MAGNOLIA-3024 content API cleanup: deprecate createNodeData() methods
- Closed