You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Jorge Flórez (Jira)" <ji...@apache.org> on 2020/03/18 16:17:00 UTC

[jira] [Created] (OAK-8961) Insertion of property definitions with the same name

Jorge Flórez created OAK-8961:
---------------------------------

             Summary: Insertion of property definitions with the same name
                 Key: OAK-8961
                 URL: https://issues.apache.org/jira/browse/OAK-8961
             Project: Jackrabbit Oak
          Issue Type: Bug
    Affects Versions: 1.12.0
            Reporter: Jorge Flórez


Tested on version 1.12.0.

Invoking the following code multiple times (it inserts a new property into an existing node type) 

NodeTypeManager nodeTypeManager =
 session.getWorkspace().getNodeTypeManager();
 
 NodeType repositoryType = nodeTypeManager.getNodeType("testType");
 NodeTypeTemplate repositoryTypeTemplate =
 nodeTypeManager.createNodeTypeTemplate(repositoryType);
 PropertyDefinitionTemplate testProperty =
 nodeTypeManager.createPropertyDefinitionTemplate();
 testProperty.setName("testProperty");
 testProperty.setRequiredType(PropertyType.STRING);
 testProperty.setMandatory(false);
 testProperty.setMultiple(false);
 testProperty.setDefaultValues(new Value[0]);
 testProperty.setValueConstraints(new String[0]);
 repositoryTypeTemplate.getPropertyDefinitionTemplates().add(testProperty);
 
 nodeTypeManager.registerNodeType(repositoryTypeTemplate, true);
 session.save();

results in the node type having multiple jcr:propertyDefinition nodes with the same name in the node type. For example:

{
     "node": "testType",
     "path": "/jcr:system/jcr:nodeTypes/testType",
     "children": [
         {
             "node": "jcr:propertyDefinition",
             "path": "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition",
             "properties": [
                 "jcr:name = testProperty"
             ]
         },
         {
             "node": "jcr:propertyDefinition[2]",
             "path": "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[2]",
            "properties": [
                 "jcr:name = testProperty"
             ]
         },
         {
             "node": "jcr:propertyDefinition[3]",
             "path": "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[3]",
            "properties": [
                 "jcr:name = testProperty"
             ]
         }
    ]
}

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)