This is an automated email from the git hooks/post-receive script. New commit to branch feature/1377-Amélioration_import_export_tous in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit 8c15145492a0e6bfff76e576f29ea143759e5d91 Author: David Cossé <cosse@codelutin.com> Date: Fri Dec 23 15:02:28 2016 +0100 refs #1314 mise à jour du mavenpom --- .../chorem/lima/ui/importexport/ImportExport.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index 3c61f72..e2a39fa 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -100,6 +100,8 @@ public class ImportExport { private static final Log log = LogFactory.getLog(ImportExport.class); public static final int BUFFER_SIZE = 1024; + public static final String CSV = ".csv"; + public static final String EXPORT_DATE_PATTERN = "dd-MM-yyyy HH:mm:ss"; /** Parent view. */ protected Component viewComponent; @@ -113,6 +115,8 @@ public class ImportExport { protected ErrorHelper errorHelper; public static final String JAVA_IO_TMPDIR = System.getProperty("java.io.tmpdir")+"/"; + public static final String EXPORT_ALL_ZIP_FILE_NAME = "%s/LIMA-BACKUP-%s.zip"; + public static final String TEMPORARY_EXTRACT_CSV_FILE_PATH = JAVA_IO_TMPDIR + "%s" + CSV; public ImportExport(Component view) { viewComponent = view; @@ -601,19 +605,21 @@ public class ImportExport { return result; } - protected ImportExportResults exportBackup(String path, String charset){ - ImportExportResults streamData = exportService.exportBackup(charset); + protected ImportExportResults exportAll(String path, String charset){ + ImportExportResults streamData = exportService.exportAll(charset); ZipOutputStream export = null; FileOutputStream result = null; try { - SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); - result = new FileOutputStream(path + "/LIMA-BACKUP-"+ dateFormat.format(new Date())); + SimpleDateFormat dateFormat = new SimpleDateFormat(EXPORT_DATE_PATTERN); + result = new FileOutputStream(String.format(EXPORT_ALL_ZIP_FILE_NAME, path, dateFormat.format(new Date()))); export = new ZipOutputStream(result); - for (ExportResult exportedData : streamData.getExportResults()) { + List<ExportResult> exportResults = streamData.getExportResults(); + for (ExportResult exportedData : exportResults) { if (exportedData != null && StringUtils.isNotBlank(exportedData.getExportData())) { String data = exportedData.getExportData(); - File file = createFile(JAVA_IO_TMPDIR + exportedData.getFromSource().getSimpleName(), charset, data); + String entityFileName = exportedData.getFromSource().getSimpleName(); + File file = createFile(String.format(TEMPORARY_EXTRACT_CSV_FILE_PATH, entityFileName), charset, data); if (file != null) { FileInputStream stream = null; try { @@ -630,9 +636,6 @@ public class ImportExport { FileUtils.forceDelete(file); } } - } else { - // export failed - break; } } export.flush(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.