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

Carsten Ziegeler commented on SLING-2782:
-----------------------------------------

Right now e.g. creating a "folder" resource looks like

resolver.create(parentResource, "name", 
Collections.singletonMap("jcr:primaryNodeType", "sling:Folder");

however, Sling has no notion of node types, but resource types. So the above 
statement really should look like this:

resolver.create(parentResource, "name", 
Collections.singletonMap("sling:resourceType", "sling:Folder");

Maybe, my initial suggestion is too invasive and looking at the use cases I 
have so far, it usually boils down to folder (nt:folder, sling:Folder, 
sling:OrderedFolder) - and when I have explicitely defined a node type :)

                
> Try to use sling:resourceType as a node type for node creation
> --------------------------------------------------------------
>
>                 Key: SLING-2782
>                 URL: https://issues.apache.org/jira/browse/SLING-2782
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 2.2.4
>            Reporter: Carsten Ziegeler
>             Fix For: JCR Resource 2.2.6
>
>
> Right now, creating resources through the resource API 
> (ResourceResolver#create) still requires some knowledge about the underlying 
> storage especially in the case of JCR - in many cases you need to provide the 
> primary node type.
> We could relax this and use the sling:resourceType as the node - but only if 
> jcr:primaryType is not specified and sling:resourceType contains a valid node 
> type name.
> This is in line with the implementation of the resource type handling for jcr 
> resources: if the node does not have a sling:resourceType, the node type is 
> returned.
> In addition, we defined that e.g. for files all resource providers should 
> return nt:file as the resource type and nt:folder for folders. So making this 
> work the other way round, fits into this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to