public class ImportExport extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE |
protected ErrorHelper |
errorHelper |
protected ExportService |
exportService |
protected ImportService |
importService |
static String |
JAVA_IO_TMPDIR |
protected Component |
viewComponent
Parent view.
|
| Constructor and Description |
|---|
ImportExport(Component view) |
| Modifier and Type | Method and Description |
|---|---|
String |
chooseFile(Boolean importMode,
ImportExportEnum importExportMethod)
open choose file dialog with appropriate file mode view
folders for export or folders+files for import
|
protected void |
ComputeExportResultMessage(List<ExportResult> exportResults) |
protected void |
ComputeImportResultMessage(List<ImportResult> resultList) |
protected File |
createFile(String filePath,
String charset,
String data)
Get csv datas in string and write file.
|
protected StringBuilder |
displayErrorMessage(Map<Integer,LimaException> exceptionsByLine) |
protected void |
DisplayImportExportResultMessage(StringBuilder message,
Boolean importMode) |
protected ImportExportResults |
exportBackup(String path,
String charset) |
protected ImportResult |
extractZipFile(String filePath,
String tmpDir,
String determinant) |
protected String |
getFromSourceMessage(Class fromSource)
Return with entities have been imported/exported.
|
protected ImportExportResults |
importAllFromZipFile(String filePath) |
void |
importExport(ImportExportEnum importExportChoice,
String path,
boolean verbose)
Call the appropriate method in business service.
|
protected String |
loadFile(String filePath,
String charset)
Open csv file and get his data on a string.
|
protected ImportExportResults |
processBackup(ImportResult result,
String tmpDir,
String determinant) |
protected void |
processImport(boolean verboseMode,
ImportExportEnum importExportMethod,
Charset defaultCharset,
String filePath) |
public static final int BUFFER_SIZE
protected Component viewComponent
protected ImportService importService
protected ExportService exportService
protected ErrorHelper errorHelper
public static final String JAVA_IO_TMPDIR
public ImportExport(Component view)
public void importExport(ImportExportEnum importExportChoice, String path, boolean verbose)
importExportChoice - determine what to import/export and export type (CSV, EBP, PDF)path - file path for import/export file, if null a dialog will ask for itverbose - if true a dialog show resultprotected void processImport(boolean verboseMode,
ImportExportEnum importExportMethod,
Charset defaultCharset,
String filePath)
protected void ComputeExportResultMessage(List<ExportResult> exportResults)
protected void ComputeImportResultMessage(List<ImportResult> resultList)
protected void DisplayImportExportResultMessage(StringBuilder message, Boolean importMode)
protected StringBuilder displayErrorMessage(Map<Integer,LimaException> exceptionsByLine)
protected String getFromSourceMessage(Class fromSource)
fromSource - The imported target classpublic String chooseFile(Boolean importMode, ImportExportEnum importExportMethod)
importMode - true = import mode false = exportimportExportMethod - Inport/export to processprotected File createFile(String filePath, String charset, String data)
filePath - path to filecharset - charset to usedata - data to write on fileprotected String loadFile(String filePath, String charset)
filePath - path to targeted filecharset - charset to use for importprotected ImportExportResults exportBackup(String path, String charset)
protected ImportExportResults importAllFromZipFile(String filePath)
protected ImportResult extractZipFile(String filePath, String tmpDir, String determinant)
protected ImportExportResults processBackup(ImportResult result, String tmpDir, String determinant)
Copyright © 2008–2015 CodeLutin. All rights reserved.