use of com.mercedesbenz.sechub.developertools.admin.importer.SimpleCSVExporter in project sechub by mercedes-benz.
the class ExportJSONToCSVAdapterDialogAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
/* convert to rows */
String json = getMappingUI().getJSON();
List<CSVRow> rows = csvSupport.toCSVRows(MappingData.fromString(json));
/* select */
String defaultPath = ConfigurationSetup.SECHUB_MASS_OPERATION_PARENTDIRECTORY.getStringValue(System.getProperty("user.home"));
File defaultFile = new File(defaultPath, getMappingUI().getMappingId() + ".csv");
File file = getDialogUI().getContext().getDialogUI().selectFile(defaultFile.getAbsolutePath());
if (file == null) {
return;
}
/* export */
SimpleCSVExporter exporter = new SimpleCSVExporter();
exporter.exportCSVFile(file, rows, 3);
/* inform */
getDialogUI().getContext().getOutputUI().output("Exported to CSV file:" + file.getAbsolutePath());
}
Aggregations