Revision e6fcf4e8
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.io.File; |
13 | 13 |
import java.io.FileOutputStream; |
14 |
import java.util.List; |
|
15 | 14 |
|
16 | 15 |
import org.eclipse.core.runtime.Assert; |
17 | 16 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
167 | 166 |
public Job createIOServiceJob(final IExportConfigurator configurator, final File exportFile) { |
168 | 167 |
Assert.isNotNull(configurator, "Configuration may not be null"); |
169 | 168 |
|
170 |
final Display display = Display.getCurrent(); |
|
169 |
// final Display display = Display.getCurrent();
|
|
171 | 170 |
|
172 |
Job job = new Job("Export: " + configurator.getClass().getSimpleName()) { |
|
171 |
Job job = new Job("Export: " + configurator.getClass().getSimpleName()) { //$NON-NLS-1$
|
|
173 | 172 |
@Override |
174 | 173 |
protected IStatus run(IProgressMonitor monitor) { |
175 | 174 |
monitor.beginTask("Exporting database. This will take some time.", IProgressMonitor.UNKNOWN); |
... | ... | |
177 | 176 |
IIOService ioService = CdmApplicationState.getIOService(); |
178 | 177 |
|
179 | 178 |
ExportResult result = ioService.export(configurator); |
180 |
List<byte[]> dataList = result.getExportData(); |
|
181 |
byte[] exportData = dataList.get(0); |
|
182 |
|
|
183 |
FileOutputStream stream = new FileOutputStream(exportFile); |
|
184 |
try { |
|
185 |
stream.write(exportData); |
|
186 |
} finally { |
|
187 |
stream.close(); |
|
179 |
ExportDataWrapper data = result.getExportData(); |
|
180 |
try{ |
|
181 |
byte[] exportData = (byte[])data.getExportData(); |
|
182 |
if(exportData != null){ |
|
183 |
FileOutputStream stream = new FileOutputStream(exportFile); |
|
184 |
stream.write(exportData); |
|
185 |
stream.close(); |
|
186 |
} |
|
187 |
} catch(Exception e){ |
|
188 |
logger.error(e.getStackTrace()); |
|
188 | 189 |
} |
189 | 190 |
|
191 |
|
|
192 |
|
|
193 |
|
|
190 | 194 |
} catch (Exception e) { |
191 | 195 |
MessagingUtils.errorDialog("Error exporting data", |
192 | 196 |
this, |
Also available in: Unified diff
adapt editor to the changes in exportResult