1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.app.pesi.merging;
|
10
|
|
11
|
import java.io.FileReader;
|
12
|
import java.io.IOException;
|
13
|
import java.util.ArrayList;
|
14
|
import java.util.Arrays;
|
15
|
import java.util.List;
|
16
|
|
17
|
import org.apache.commons.lang3.StringUtils;
|
18
|
|
19
|
import au.com.bytecode.opencsv.CSVReader;
|
20
|
|
21
|
/**
|
22
|
* Base class for PESI merge classes.
|
23
|
*
|
24
|
* @author a.mueller
|
25
|
* @since 20.01.2020
|
26
|
*/
|
27
|
public abstract class PesiMergeBase {
|
28
|
|
29
|
protected static List<List<String>> readCsvFile(String fileName){
|
30
|
List<List<String>> result = new ArrayList<>();
|
31
|
try {
|
32
|
CSVReader reader = new CSVReader(new FileReader(fileName), ';');
|
33
|
String[] row;
|
34
|
while ((row = reader.readNext()) != null){
|
35
|
result.add(Arrays.asList(row));
|
36
|
}
|
37
|
reader.close();
|
38
|
} catch (IOException e1) {
|
39
|
e1.printStackTrace();
|
40
|
return null;
|
41
|
}
|
42
|
return result;
|
43
|
}
|
44
|
|
45
|
protected boolean isBlank(String str) {
|
46
|
return StringUtils.isBlank(str);
|
47
|
}
|
48
|
}
|