private static void writeItemDefinitions(@NotNull Tree nodeTypeTree, @Nullable List<? extends ItemDefinitionTemplate> itemDefTemplates, @NotNull String nodeName, @NotNull String primaryTypeName) throws RepositoryException { // first remove existing for (Tree t : filter(nodeTypeTree.getChildren(), new SameNamePredicate(nodeName))) { t.remove(); } // now write definitions int index = 1; if (itemDefTemplates != null) { for (ItemDefinitionTemplate template : itemDefTemplates) { String name = nodeName(nodeName, index); Tree tree = nodeTypeTree.getChild(name); if (!tree.exists()) { tree = nodeTypeTree.addChild(name); tree.setProperty( JCR_PRIMARYTYPE, primaryTypeName, NAME); } template.writeTo(tree); index++; } } }
private static void writeItemDefinitions(@NotNull Tree nodeTypeTree, @Nullable List<? extends ItemDefinitionTemplate> itemDefTemplates, @NotNull String nodeName, @NotNull String primaryTypeName) throws RepositoryException { // first remove existing for (Tree t : filter(nodeTypeTree.getChildren(), new SameNamePredicate(nodeName))) { t.remove(); } // now write definitions int index = 1; if (itemDefTemplates != null) { for (ItemDefinitionTemplate template : itemDefTemplates) { String name = nodeName(nodeName, index); Tree tree = nodeTypeTree.getChild(name); if (!tree.exists()) { tree = nodeTypeTree.addChild(name); tree.setProperty( JCR_PRIMARYTYPE, primaryTypeName, NAME); } template.writeTo(tree); index++; } } }
private static void writeItemDefinitions(@Nonnull Tree nodeTypeTree, @CheckForNull List<? extends ItemDefinitionTemplate> itemDefTemplates, @Nonnull String nodeName, @Nonnull String primaryTypeName) throws RepositoryException { // first remove existing for (Tree t : filter(nodeTypeTree.getChildren(), new SameNamePredicate(nodeName))) { t.remove(); } // now write definitions int index = 1; if (itemDefTemplates != null) { for (ItemDefinitionTemplate template : itemDefTemplates) { String name = nodeName(nodeName, index); Tree tree = nodeTypeTree.getChild(name); if (!tree.exists()) { tree = nodeTypeTree.addChild(name); tree.setProperty( JCR_PRIMARYTYPE, primaryTypeName, NAME); } template.writeTo(tree); index++; } } }