public void createNode()

in src/main/java/org/apache/sling/feature/cpconverter/handlers/slinginitialcontent/VaultContentXMLContentCreator.java [120:149]


    public void createNode(String name, String primaryNodeType, String[] mixinNodeTypes) throws RepositoryException {
        final Name currentNodeName;
        if (rootNode == null) {
            currentNodeName = NameConstants.JCR_ROOT;
            if (StringUtils.isNotBlank(name)) {
                // adjust root path in case the first node has an explicit name
                rootPath = Text.getRelativeParent(rootPath, 1) + "/" + name;
            }
        } else {
            currentNodeName = npResolver.getQName(name);
        }

        // if we are dealing with a descriptor file, we should use nt:file as default primaryType. 
        String defaultNtType = isFileDescriptorEntry ? JcrConstants.NT_FILE : JcrConstants.NT_UNSTRUCTURED;
        String toUsePrimaryNodeType = StringUtils.isNotBlank(primaryNodeType) ? primaryNodeType : defaultNtType;
        List<DocViewProperty2> currentProperties = new ArrayList<>();
        currentProperties.add(new DocViewProperty2(NameConstants.JCR_PRIMARYTYPE, toUsePrimaryNodeType));
        if (ArrayUtils.isNotEmpty(mixinNodeTypes)) {
            currentProperties.add(new DocViewProperty2(NameConstants.JCR_MIXINTYPES, Arrays.asList(mixinNodeTypes)));
        }
        final DocViewTreeNode newNode;
        if (rootNode == null) {
            newNode = new DocViewTreeNode(rootPath, currentNodeName, currentProperties);
            rootNode = newNode;
        } else {
            newNode = new DocViewTreeNode(rootNode.getPath(npResolver), currentNodeName, currentProperties);
            currentNodeStack.element().addChild(newNode);
        }
        currentNodeStack.add(newNode);
    }