return lastExportDate;
}
public String exportData(Component parent, Module module, String exporterKey) {
DataExporter exporter = module.getModuleExporter(exporterKey);
// check whether we got an exporter class defined
if (exporter == null) {
throw new RuntimeException("Exporter not found");
}
if (exporter.getDataService() == null) {
exporter.setDataService(dataService);
}
dataService.setMessages(messages);
exporter.setMessages(messages);
// session index to export from
int fromSessionIndex = -1;
// check whether we should export incrementally
boolean incremental = exporter.isIncrementalExport();
if (incremental) {
// find out about the last exported session index
String s = module.getModuleProperties().get(exporterKey + "." + DataExportService.PROPERTY_LAST_EXPORTED_SESSION);
if (s != null) {
try {
fromSessionIndex = Integer.parseInt(s);
fromSessionIndex++;
} catch (NumberFormatException nfe) {
logger.warn("Unable to cast last session index to a number. Exporting all sessions", nfe);
}
}
}
// now perform the export
DataExporterErrorImpl exporterError = new DataExporterErrorImpl();
exporterError.setMessages(messages);
try {
exporter.exportData(parent, module, fromSessionIndex, exporterError);
if (exporterError.getErrorType() != 0) {
dataService.saveModule(module);
return exporterError.getErrorMessage();
}
// update the export information