Revision c56148f4
Added by Katja Luther almost 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java | ||
---|---|---|
315 | 315 |
} else if (result.getExportData().getType().equals(ExportResultType.MAP_BYTE_ARRAY)){ |
316 | 316 |
Map<String, byte[]> resultMap = (Map<String, byte[]>)data.getExportData(); |
317 | 317 |
Set<String> keySet = resultMap.keySet(); |
318 |
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); |
|
319 |
Calendar cal = Calendar.getInstance(); |
|
320 |
|
|
321 |
|
|
322 |
File file = new File(urlString+File.separator + "csv_light_" + sdf.format(cal.getTime())+ ".zip"); |
|
323 |
FileOutputStream stream = new FileOutputStream(file); |
|
324 |
ZipOutputStream zos = new ZipOutputStream(stream); |
|
325 |
for (String key: keySet){ |
|
318 |
for (String key: keySet){ |
|
326 | 319 |
byte[] fileData = resultMap.get(key); |
327 | 320 |
String fileEnding =""; |
328 | 321 |
if (configurator instanceof CdmLightExportConfigurator){ |
329 | 322 |
fileEnding = ".csv"; |
330 | 323 |
} |
331 | 324 |
|
332 |
ZipEntry entry = new ZipEntry( key + fileEnding);
|
|
333 |
zos.putNextEntry(entry);
|
|
334 |
zos.write(fileData);
|
|
335 |
zos.closeEntry();
|
|
336 |
}
|
|
337 |
|
|
338 |
zos.close();
|
|
325 |
File file = new File(urlString+File.separator + key + fileEnding);
|
|
326 |
FileOutputStream stream = new FileOutputStream(file);
|
|
327 |
Writer out = new BufferedWriter(new OutputStreamWriter(
|
|
328 |
stream, "UTF8"));
|
|
329 |
stream.write(fileData);
|
|
330 |
stream.close(); |
|
331 |
}
|
|
339 | 332 |
|
340 | 333 |
|
341 | 334 |
}else{ |
Also available in: Unified diff
revert creation of zip file for cdmlight export, save the export folder