kwin edited a comment on issue #2: SLING-8375 - Allow import if data contains 
protected properties
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-contentloader/pull/2#issuecomment-493159539
 
 
   @ncautotest IIUC at the point where you try to set properties the node(and 
by that also the underlying node definition) is already there, so you get all 
property definitions by calling 
[`NodeType.getPropertyDefinitions()`](https://docs.adobe.com/docs/en/spec/jsr170/javadocs/jcr-2.0/javax/jcr/nodetype/NodeType.html#getPropertyDefinitions())
 on top of `Node.getPrimaryNodeType()` and `Node.getMixinNodeTypes`. Then you 
just iterate for each of the nodetypes over all of the returned property 
definitions and pick the matching one (by evaluating its `name`). That way you 
can figure out if a property is protected before you actually set it. That way 
you prevent relying on an exception. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to