Revision 30878586
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java | ||
---|---|---|
79 | 79 |
import eu.etaxonomy.cdm.io.common.ExportDataWrapper; |
80 | 80 |
import eu.etaxonomy.cdm.io.common.ExportResult; |
81 | 81 |
import eu.etaxonomy.cdm.io.common.ExportResultType; |
82 |
import eu.etaxonomy.cdm.io.common.ExportType; |
|
83 |
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator; |
|
82 | 84 |
import eu.etaxonomy.cdm.model.common.IEnumTerm; |
83 | 85 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
84 | 86 |
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator; |
... | ... | |
445 | 447 |
} |
446 | 448 |
zos.close(); |
447 | 449 |
}else{ |
448 |
for (String key: keySet){ |
|
449 |
byte[] fileData = resultMap.get(key); |
|
450 |
File file = new File(urlString+File.separator + key + fileEnding); |
|
451 |
FileOutputStream stream = new FileOutputStream(file); |
|
452 |
Writer out = new BufferedWriter(new OutputStreamWriter( |
|
453 |
stream, "UTF8")); |
|
454 |
stream.write(fileData); |
|
455 |
stream.close(); |
|
456 |
} |
|
450 |
if(result.getExportType().equals(ExportType.DWCA)){ |
|
451 |
|
|
452 |
File file = new File(urlString); |
|
453 |
FileOutputStream stream = new FileOutputStream(file); |
|
454 |
ZipOutputStream zos = new ZipOutputStream(stream); |
|
455 |
for (String key: keySet){ |
|
456 |
byte[] fileData = resultMap.get(key); |
|
457 |
ZipEntry entry = new ZipEntry( key + fileEnding); |
|
458 |
zos.putNextEntry(entry); |
|
459 |
zos.write(fileData); |
|
460 |
zos.closeEntry(); |
|
461 |
} |
|
462 |
zos.close(); |
|
463 |
}else{ |
|
464 |
for (String key: keySet){ |
|
465 |
byte[] fileData = resultMap.get(key); |
|
466 |
File file = new File(urlString+File.separator + key + fileEnding); |
|
467 |
FileOutputStream stream = new FileOutputStream(file); |
|
468 |
Writer out = new BufferedWriter(new OutputStreamWriter( |
|
469 |
stream, "UTF8")); |
|
470 |
stream.write(fileData); |
|
471 |
stream.close(); |
|
472 |
} |
|
473 |
} |
|
457 | 474 |
} |
458 | 475 |
}else{ |
459 | 476 |
logger.error("This kind of result data is not supported yet." + result.getExportData().getType().toString()); |
Also available in: Unified diff
fix #6801:fix writing of dwca file