use of org.alfresco.repo.exporter.ACPExportPackageHandler in project alfresco-remote-api by Alfresco.
the class SiteExportGet method doUserACPExport.
protected void doUserACPExport(List<NodeRef> userNodes, SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException {
// Build the parameters
ExporterCrawlerParameters parameters = new ExporterCrawlerParameters();
parameters.setExportFrom(new Location(userNodes.toArray(new NodeRef[userNodes.size()])));
parameters.setCrawlChildNodes(true);
parameters.setCrawlSelf(true);
parameters.setCrawlContent(true);
// And the export handler
ACPExportPackageHandler handler = new ACPExportPackageHandler(writeTo, new File(site.getShortName() + "-users.xml"), new File(site.getShortName() + "-users"), mimetypeService);
// Do the export
exporterService.exportView(handler, parameters, null);
}
use of org.alfresco.repo.exporter.ACPExportPackageHandler in project alfresco-remote-api by Alfresco.
the class SiteExportGet method doSiteACPExport.
protected void doSiteACPExport(SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException {
// Build the parameters
ExporterCrawlerParameters parameters = new ExporterCrawlerParameters();
parameters.setExportFrom(new Location(site.getNodeRef()));
parameters.setCrawlChildNodes(true);
parameters.setCrawlSelf(true);
parameters.setCrawlContent(true);
// And the export handler
ACPExportPackageHandler handler = new ACPExportPackageHandler(writeTo, new File(site.getShortName() + ".xml"), new File(site.getShortName()), mimetypeService);
// Do the export
exporterService.exportView(handler, parameters, null);
}
use of org.alfresco.repo.exporter.ACPExportPackageHandler in project alfresco-remote-api by Alfresco.
the class StreamACP method createACP.
/**
* Returns an ACP file containing the nodes represented by the given list of NodeRefs.
*
* @param params The parameters for the ACP exporter
* @param extension The file extenstion to use for the ACP file
* @param keepFolderStructure Determines whether the folder structure is maintained for
* the content inside the ACP file
* @return File object representing the created ACP
*/
protected File createACP(ExporterCrawlerParameters params, String extension, boolean keepFolderStructure) {
try {
// generate temp file and folder name
File dataFile = new File(GUID.generate());
File contentDir = new File(GUID.generate());
// setup export package handler
File acpFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, "." + extension);
ACPExportPackageHandler handler = new ACPExportPackageHandler(new FileOutputStream(acpFile), dataFile, contentDir, this.mimetypeService);
handler.setExportAsFolders(keepFolderStructure);
handler.setNodeService(this.nodeService);
// perform the actual export
this.exporterService.exportView(handler, params, null);
if (logger.isDebugEnabled())
logger.debug("Created temporary archive: " + acpFile.getAbsolutePath());
return acpFile;
} catch (FileNotFoundException fnfe) {
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create archive", fnfe);
}
}
use of org.alfresco.repo.exporter.ACPExportPackageHandler in project alfresco-remote-api by Alfresco.
the class SiteExportGet method doPeopleACPExport.
protected void doPeopleACPExport(final List<NodeRef> peopleNodes, SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException {
if (!peopleNodes.isEmpty()) {
// Build the parameters
ExporterCrawlerParameters parameters = new ExporterCrawlerParameters();
parameters.setExportFrom(new Location(peopleNodes.toArray(new NodeRef[peopleNodes.size()])));
parameters.setCrawlChildNodes(true);
parameters.setCrawlSelf(true);
parameters.setCrawlContent(true);
// And the export handler
ACPExportPackageHandler handler = new ACPExportPackageHandler(writeTo, new File(site.getShortName() + "-people.xml"), new File(site.getShortName() + "-people"), mimetypeService);
// Do the export
exporterService.exportView(handler, parameters, null);
}
}
Aggregations