You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/06/20 21:53:34 UTC

svn commit: r1604267 - /sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java

Author: rombert
Date: Fri Jun 20 19:53:34 2014
New Revision: 1604267

URL: http://svn.apache.org/r1604267
Log:
SLING-3656 - nested nodes below file/jcr:content cause problems on
import and export

Handle child nodes of nt:resource nodes under nt:file nodes in the
ImportRepositoryContentAction

Modified:
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1604267&r1=1604266&r2=1604267&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Fri Jun 20 19:53:34 2014
@@ -26,6 +26,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.util.Text;
 import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer;
 import org.apache.sling.ide.eclipse.core.ProjectUtil;
 import org.apache.sling.ide.eclipse.core.ResourceUtil;
@@ -204,7 +205,7 @@ public class ImportRepositoryContentActi
 
         final List<ResourceProxy> resourceChildren = new LinkedList<ResourceProxy>(resource.getChildren());
 		if (serializationData != null) {
-	
+
             IPath fileOrFolderPath = contentSyncRootDir.getProjectRelativePath().append(
                     serializationData.getFileOrFolderNameHint());
 	
@@ -225,6 +226,30 @@ public class ImportRepositoryContentActi
 								.hasNext();) {
 	                    	ResourceProxy child = it.next();
 	                        if (Repository.NT_RESOURCE.equals(child.getProperties().get(Repository.JCR_PRIMARY_TYPE))) {
+
+                                ResourceProxy reloadedChildResource = executeCommand(repository
+                                        .newListChildrenNodeCommand(child.getPath()));
+
+                                logger.trace(
+                                        "Skipping direct handling of {0} node at {1} ; will additionally handle {2} direct children",
+                                        Repository.NT_RESOURCE, child.getPath(), reloadedChildResource.getChildren()
+                                                .size());
+
+                                if (reloadedChildResource.getChildren().size() != 0) {
+                                    // 1. create holder directory ; needs platform name format
+
+                                    String pathName = Text.getName(reloadedChildResource.getPath());
+                                    pathName = serializationManager.getOsPath(pathName);
+
+                                    createFolder(project, directoryPath.append(pathName));
+
+                                    // 2. recursively handle all resources
+                                    for (ResourceProxy grandChild : reloadedChildResource.getChildren()) {
+                                        crawlChildrenAndImport(repository, filter, grandChild.getPath(), project,
+                                                projectRelativePath);
+                                    }
+                                }
+	                            
 	                        	it.remove();
 	                        	break;
 	                        }