Hi,
I see a difference in spec and API JSR-170 with property definition
value constraints case-sensitivity in node type creation/validation.
E.g. constant has PropertyType.TYPENAME_STRING = "String" (lower case
string with leading upper case 'S')
but nt:propertyDefinition (6.7.22.11 nt:propertyDefinition) has prop
definition for jcr:requiredType
....
PropertyDefinition
Name jcr:requiredType
RequiredType STRING
ValueConstraints ["STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN",
"DATE", "NAME", "PATH", "REFERENCE", "UNDEFINED"]
DefaultValue null
AutoCreated false
Mandatory true
OnParentVersion COPY
Protected false
Multiple false
....
Where ValueConstraints "STRING" - whole string in upper case.
So, if I run next code using JCR API (must be any of implementation):
Node root = session.getRootNode();
Node propDef = root.addNode("propertyDefNode", "nt:propertyDefinition");
propDef.setProperty("jcr:name", valueFactory.createValue("test",
PropertyType.NAME));
propDef.setProperty("jcr:autoCreated", false);
propDef.setProperty("jcr:mandatory", false);
propDef.setProperty("jcr:onParentVersion",
OnParentVersionAction.ACTIONNAME_COPY);
propDef.setProperty("jcr:protected", false);
propDef.setProperty("jcr:multiple", false);
propDef.setProperty("jcr:requiredType",
PropertyType.TYPENAME_STRING); <<<<< !!!!!
....
I'll have a ConstraintViolationException with jcr:requiredType property
setter.
Question: Can I use PropertyType.TYPENAME_STRING constant as for value
of jcr:requiredType for nt:propertyDefinition type nodes?
I think - yes. But, why PropertyType contains constants differs from
spec nt:propertyDefinition nodetype definition.
Thanks.
BR.
Peter Nedonosko,
eXo Platform UA.