[ 
https://issues.apache.org/jira/browse/OAK-5229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865459#comment-15865459
 ] 

Alex Parvulescu commented on OAK-5229:
--------------------------------------

bq. I agree with Tobias Bocanegra that protected items should be cleaned up 
automatically instead of becoming regular items. 
I think we have to be really careful with the wording here, if you read this 
comment it actually contradicts this view:
bq. e.g. if you change a nt:folder to nt:unstructured, the jcr:created etc 
should stay. 
So which is it? Should the protected items stay or go?

I strongly believe that the repo should not silently delete data unless it 
absolutely has to, which is: protected properties that have no match in the new 
type. Everything else should stay and become regular properties.
Re. UUID (and probably any protected property outside the mixin context that 
gives it special meaning) you can already manually set it on a node and the 
repo will not complain. Then you can set the corresponding mixin and you'll get 
a validation of the type integrity. Next removing the mixin would only mean the 
special properties are not special any more, but I would not delete them unless 
they are not accepted by the new definition. Setting the primary type is 
already a very rare operation and leaving the properties there has minimal side 
effects. [~mduerig] Is there anything in particular you'd worry about if we go 
with the lazy approach? 





[0] 
https://issues.apache.org/jira/browse/OAK-5229?focusedCommentId=15863061&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15863061

> Using Node.setPrimaryType() should fail if non-matching childnodes
> ------------------------------------------------------------------
>
>                 Key: OAK-5229
>                 URL: https://issues.apache.org/jira/browse/OAK-5229
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.14
>            Reporter: Tobias Bocanegra
>            Assignee: Alex Parvulescu
>            Priority: Critical
>             Fix For: 1.8, 1.6.1
>
>         Attachments: OAK-5229.patch, OAK-5229-tests.patch, OAK-5229-v2.patch, 
> OAK-5229-v3.patch, OAK-5229-v4.patch
>
>
> 1. Assume the following:
> {noformat}
> /testNode [nt:unstructured]
>   /unstructured_child [nt:unstructured]
> {noformat}
> 2. setting "/testNode".setPrimaryType("nt:folder")
> 3. save the session.
> Altering the primary type works, thus leaving the repository in an 
> inconsistent state.
> Interestingly, subsequent calls to 
> "/testNiode/unstructured_child".setProperty() will fail:
> {noformat}
> javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: 
> /test_node[[nt:folder]]: No matching definition found for child node 
> unstructured_child with effective type [nt:unstructured]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to