use of com.axelor.apps.tool.reader.DataReaderService in project axelor-open-suite by axelor.
the class DataImportServiceImpl method importData.
@Override
public MetaFile importData(AdvancedImport advancedImport) throws IOException, AxelorException, ClassNotFoundException {
adapterMap = new HashMap<String, DataAdapter>();
importContext = new HashMap<String, Object>();
language = advancedImport.getLanguageSelect();
dataDir = Files.createTempDir();
String extension = Files.getFileExtension(advancedImport.getImportFile().getFileName());
DataReaderService reader = dataReaderFactory.getDataReader(extension);
reader.initialize(advancedImport.getImportFile(), advancedImport.getFileSeparator());
List<CSVInput> inputs = this.process(reader, advancedImport);
if (advancedImport.getAttachment() != null) {
this.processAttachments(advancedImport.getAttachment());
}
MetaFile logFile = this.importData(inputs);
FileUtils.forceDelete(dataDir);
return logFile;
}
Aggregations