Improve migration
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 5 Sep 2022 06:29:55 +0000 (08:29 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 5 Sep 2022 06:29:55 +0000 (08:29 +0200)
jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentUtils.java

index af2d782e8fc9592bd61ff1e5ae230bd140df82ea..b8d9e70dec1b6734fedc766a925156d4fc4a8b45 100644 (file)
@@ -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) {