diff --git a/source/java/org/alfresco/repo/importer/FileImporter.java b/source/java/org/alfresco/repo/importer/FileImporter.java index c3333ad9d5..5e4a2cf8c4 100644 --- a/source/java/org/alfresco/repo/importer/FileImporter.java +++ b/source/java/org/alfresco/repo/importer/FileImporter.java @@ -63,5 +63,15 @@ public interface FileImporter */ public int loadFile(NodeRef container, File file) throws FileImporterException; + /** + * Load a file into a given location, giving it a new name. + * + * @param container the target parent to load into + * @param file the source file to upload + * @param recurse true to recurse into subfolders + * @param name the new name of the file or folder when it gets uploaded + * @return Returns the number of files loaded + * @throws FileImporterException + */ public int loadNamedFile(NodeRef container, File file, boolean recurse, String name) throws FileImporterException; } diff --git a/source/java/org/alfresco/repo/importer/FileImporterTest.java b/source/java/org/alfresco/repo/importer/FileImporterTest.java index 8ad348cb93..40939ebade 100644 --- a/source/java/org/alfresco/repo/importer/FileImporterTest.java +++ b/source/java/org/alfresco/repo/importer/FileImporterTest.java @@ -66,8 +66,6 @@ public class FileImporterTest extends TestCase private ServiceRegistry serviceRegistry; private NodeRef rootNodeRef; - private SearchService searcher; - public FileImporterTest() { super(); @@ -82,7 +80,6 @@ public class FileImporterTest extends TestCase { serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); - searcher = serviceRegistry.getSearchService(); nodeService = serviceRegistry.getNodeService(); searchService = serviceRegistry.getSearchService(); dictionaryService = serviceRegistry.getDictionaryService(); @@ -119,8 +116,8 @@ public class FileImporterTest extends TestCase { FileImporter fileImporter = createFileImporter(); URL url = this.getClass().getClassLoader().getResource(""); - File root = new File(url.getFile()); - int count = fileImporter.loadFile(rootNodeRef, new File(url.getFile())); + File rootFile = new File(url.getFile()); + int count = fileImporter.loadFile(rootNodeRef, rootFile); assertEquals("Expected to load a single file", 1, count); } @@ -168,10 +165,11 @@ public class FileImporterTest extends TestCase /** * @param args *