From: Mathieu Baudier Date: Mon, 5 Sep 2022 06:29:55 +0000 (+0200) Subject: Improve migration X-Git-Tag: v2.3.10~52 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=d6894b1198d1f0780f9c13fb7b18bf367f5433f1 Improve migration --- diff --git a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentUtils.java b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentUtils.java index af2d782e8..b8d9e70de 100644 --- a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentUtils.java +++ b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentUtils.java @@ -44,6 +44,7 @@ public class JcrContentUtils { public static void copyFiles(Node folder, Content collection, String... additionalCollectionTypes) { try { + log.debug("Copy collection " + collection); nodes: for (NodeIterator it = folder.getNodes(); it.hasNext();) { Node node = it.nextNode(); String name = node.getName(); @@ -65,25 +66,23 @@ public class JcrContentUtils { } QName qName = NamespaceUtils.parsePrefixedName(name); - if (NamespaceUtils.hasNamespace(qName)) { - if (node.getIndex() > 1) { - log.warn("Same name siblings not supported, skipping " + node); - continue nodes; - } - Content content = collection.add(qName, qName); - Source source = toSource(node); - ((ProvidedContent) content).getSession().edit((s) -> { - ((ProvidedSession) s).notifyModification((ProvidedContent) content); - content.write(Source.class).complete(source); -// ContentUtils.traverse(content, -// (c, depth) -> ContentUtils.print(c, System.out, depth, false)); - }).toCompletableFuture().join(); - - } else { - // ignore - log.debug(() -> "Ignored " + node); +// if (NamespaceUtils.hasNamespace(qName)) { + if (node.getIndex() > 1) { + log.warn("Same name siblings not supported, skipping " + node); continue nodes; } + Content content = collection.add(qName, qName); + Source source = toSource(node); + ((ProvidedContent) content).getSession().edit((s) -> { + ((ProvidedSession) s).notifyModification((ProvidedContent) content); + content.write(Source.class).complete(source); + }).toCompletableFuture().join(); + +// } else { +// // ignore +// log.debug(() -> "Ignored " + node); +// continue nodes; +// } } } } catch (RepositoryException e) {