-
1. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
rhauch Apr 15, 2011 3:04 PM (in response to piascikj)Actually, IIRC, we don't really use that parameter anyway, so it's possible to update an existing node type definition, even when it's been used on nodes.
But there is still one major constraint: the new node type definition cannot make invalid any existing nodes. So for example, imagine the following node type definition has already been registered, with multiple nodes already using that for their primary type:
[foo:person]
- foo:lastName (string) mandatory
- foo:firstName (string) mandatory
- foo:dateOfBirth (date)
Now let's say you want to change this node type definition to be as follows:
[foo:person]
- foo:lastName (string) mandatory
- foo:firstName (string) mandatory
The 'foo:dateOfBirth' property is no longer defined, and if some 'foo:person' node already has a value for that property (and has no other mixins), the updated node type definition will not be sufficient for this node, as there is no property definition in the updated node type definition for a 'foo:person' property of type STRING.
However, if the 'foo:person' nodes also had a mixin that had residual property definitions, then the 'foo:dateOfBirth' property on such nodes would still have a valid property definition (the residual property definition). So you could update the 'foo:person' node type definition as described above.
In short, you just need to be careful about updating node types when you already have nodes that use them. If you do some planning upfront, such as using 'nt:unstructured' (or a similar node type definition with residual definitions) for the primary type of all nodes, the node types and mixin types can change fairly significantly because the nodes always "rely upon" the residual child node and property definitions for existing nodes if the property definitions disappear from the updated node type definitions.
Hopefully this helps.
-
2. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
piascikj Apr 15, 2011 4:43 PM (in response to rhauch)Randall, As always thanks for all the insight. I see how I can update a nodeType through RepositoryNodeTypeManager.registerNodeTypes with the failIfNodeTypeDefinitionsExist set to false, but I can't do this from the JCR api, the boolean allowUpdate doesn't pass through. If I can't update through the JCR api could you give me an example of how I would update a nodeType through RepositoryNodeTypeManager.registerNodeTypes?
-
3. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
piascikj Apr 16, 2011 12:24 PM (in response to piascikj)I just realized RepositoryNodeTypeManager.registerNodeTypes is not visible outside the package. What other programmatic options do I have aside from implementing allowUpdate?
-
4. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
bcarothers Apr 16, 2011 12:37 PM (in response to piascikj)If you post a JIRA for this today, I'll upload a patch for it by Monday. I'm not sure how we ended up implementing it in RNTM and not implementing it in JNTM. It was probably an oversight on my part.
-
5. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
piascikj Apr 16, 2011 2:09 PM (in response to bcarothers)Thanks Brian! The issue I logged is attached.
-
7. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
rhauch Apr 18, 2011 10:22 AM (in response to bcarothers)I'll try to get this merged today, but it definitely will be done before we release 2.5.0.Beta2. Thanks, folks!
-
8. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
rhauch Apr 18, 2011 11:52 AM (in response to rhauch)This is now merged into the 'master' branch, and I've closed the issue. This will be in the forthcoming 2.5.0.Beta2.
-
9. Are there plans to implement allowUpdates in registerNodeType( NodeTypeDefinition template,boolean allowUpdate )?
piascikj Apr 18, 2011 1:11 PM (in response to rhauch)Thanks Guys!