<artifactId>resteasy-multipart-provider</artifactId>
</dependency>
+ <!-- Nuxeo -->
<dependency>
<groupId>org.nuxeo.shell</groupId>
<artifactId>nuxeo-shell-core</artifactId>
<version>${nuxeo.shell.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.nuxeo.ecm.platform</groupId>
+ <artifactId>nuxeo-importer-core</artifactId>
+ <version>${nuxeo.platform.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.nuxeo.ecm.platform</groupId>
+ <artifactId>nuxeo-importer-xml-parser</artifactId>
+ <version>${nuxeo.platform.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.nuxeo.ecm.core</groupId>
<artifactId>nuxeo-core-api</artifactId>
package org.collectionspace.services.imports.nuxeo;
import java.io.File;
+import java.io.IOException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import org.collectionspace.services.nuxeo.client.java.NuxeoClientEmbedded;
import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded;
import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-
+import org.nuxeo.common.utils.FileUtils;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentRef;
+import org.nuxeo.ecm.core.api.IdRef;
+import org.nuxeo.ecm.core.api.PathRef;
import org.nuxeo.ecm.core.io.DocumentPipe;
import org.nuxeo.ecm.core.io.DocumentReader;
import org.nuxeo.ecm.core.io.DocumentTranslationMap;
import org.nuxeo.ecm.core.io.DocumentWriter;
import org.nuxeo.ecm.core.io.impl.DocumentPipeImpl;
import org.nuxeo.ecm.core.io.impl.plugins.DocumentModelWriter;
+import org.nuxeo.ecm.platform.importer.service.DefaultImporterService;
+import org.nuxeo.ecm.platform.importer.service.DefaultImporterServiceImpl;
+import org.nuxeo.ecm.platform.importer.xml.parser.XMLImporterService;
+import org.nuxeo.runtime.api.Framework;
// we use our own override of this: import org.nuxeo.ecm.core.io.impl.plugins.XMLDirectoryReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
String msg = String.format("Start of import is Local time: %tT", Calendar.getInstance());
logger.debug(msg);
}
- return importTree(repoSession, file, workspacesPath, timeout);
+ return newImportTree(repoSession, file, workspacesPath, timeout);
} catch (Exception e) {
throw e;
} finally {
client.releaseRepository(repoSession);
}
}
+
+// DocumentModel root = session.getRootDocument();
+// File xml = File("/where/is/my/umbrella");
+// XMLImporterService importer = Framework.getLocalService(XMLImporterService.class);
+// importer.importDocuments(root, xml);
+
+ private String newImportTree(CoreSessionInterface repoSession, File file, String toPath, int timeout) throws IOException {
+ File source = new File("C:/dev/tools/apache-tomcat-7.0.64/temp/imports-2014210770025398386/Personauthorities.zip");
+ if (source.exists()) {
+ String targetPath = "/core-domain/Workspaces/Personauthorities/"; ///core-domain/Workspaces/Personauthorities
+ DocumentRef docRef = new PathRef(targetPath);
+ DocumentModel root = repoSession.getDocument(docRef);
+ XMLImporterService importerService = Framework.getLocalService(XMLImporterService.class);
+ importerService.importDocuments(root, source);
+ } else {
+ System.err.println("Could not find file: " + source.getAbsolutePath());
+ }
+
+ return "New Import Service Run";
+ }
/*
* If the import exceeds the number of seconds in 'timeout', we'll thrown an exception and rollback all import work