use of com.axelor.data.csv.CSVInput in project axelor-open-suite by axelor.
the class DataImportServiceImpl method createCSVInput.
private CSVInput createCSVInput(FileTab fileTab, String fileName) {
boolean update = false;
String searchCall = fileTab.getSearchCall();
if (fileTab.getImportType() != FileFieldRepository.IMPORT_TYPE_FIND_NEW && (CollectionUtils.isNotEmpty(fileTab.getSearchFieldSet()) || StringUtils.notBlank(searchCall))) {
update = true;
}
XStream stream = XStreamUtils.createXStream();
stream.processAnnotations(CSVInput.class);
CSVInput input = (CSVInput) stream.fromXML("<input update=\"" + update + "\" />");
input.setFileName(fileName);
input.setSeparator(CSV_SEPRATOR);
input.setTypeName(fileTab.getMetaModel().getFullName());
input.setCallable(INPUT_CALLABLE);
input.setSearch(null);
input.setBindings(new ArrayList<>());
input.setSearchCall(searchCall);
return input;
}
Aggregations