Project

General

Profile

« Previous | Next » 

Revision 6b217d8c

Added by Andreas Müller over 3 years ago

ref #9204 some adaptation to latest dependencies to app-import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/UseImport.java
25 25
import org.apache.log4j.Logger;
26 26
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
27 27
import org.apache.poi.ss.usermodel.Cell;
28
import org.apache.poi.ss.usermodel.CellType;
28 29
import org.apache.poi.ss.usermodel.Row;
29 30
import org.apache.poi.ss.usermodel.Sheet;
30 31
import org.apache.poi.ss.usermodel.Workbook;
......
145 146
				Row row = rows.next();
146 147
				System.out.println("Row No.: " + row.getRowNum());
147 148
				Iterator<Cell> cells = row.cellIterator();
148
				ArrayList<String> lstTaxon = new ArrayList<String>();
149
				ArrayList<String> lstTaxon = new ArrayList<>();
149 150
				while (cells.hasNext()) {
150 151
					Cell cell = cells.next();
151 152

  
152
					int intCellType = cell.getCellType();
153
					switch (intCellType) {
154
						case 0:
153
					CellType cellType = cell.getCellType();
154
					switch (cellType) {
155
						case NUMERIC:
155 156
							int cellValue = (int) cell.getNumericCellValue();
156 157
							lstTaxon.add(Integer.toString(cellValue));
157 158
							break;
158
						case 1:
159
						case STRING:
159 160
							lstTaxon.add(cell.getStringCellValue());
160 161
							break;
162
					    default:
163
					        throw new RuntimeException("CellType not yet handled: " + cellType);
161 164
					}
162 165
				}
163 166
				lstUpdates.add(lstTaxon);
......
518 521
				while (cells.hasNext()) {
519 522
					Cell cell = cells.next();
520 523

  
521
					int intCellType = cell.getCellType();
522
					switch (intCellType) {
523
						case 0:
524
					CellType cellType = cell.getCellType();
525
					switch (cellType) {
526
						case NUMERIC:
524 527
							int cellValue = (int) cell.getNumericCellValue();
525 528
							lstTerms.add(Integer.toString(cellValue));
526 529
							break;
527
						case 1:
530
						case STRING:
528 531
							lstTerms.add(cell.getStringCellValue());
529 532
							break;
533
	                    default:
534
	                        throw new RuntimeException("CellType not yet handled: " + cellType);
530 535
					}
531 536
				}
532 537
				lstUpdates.add(lstTerms);
......
660 665
				while (cells.hasNext()) {
661 666
					Cell cell = cells.next();
662 667

  
663
					int intCellType = cell.getCellType();
664
					switch (intCellType) {
665
						case 0:
668
					CellType cellType = cell.getCellType();
669
					switch (cellType) {
670
						case NUMERIC:
666 671
							int cellValue = (int) cell.getNumericCellValue();
667 672
							lstTerms.add(Integer.toString(cellValue));
668 673
							break;
669
						case 1:
674
						case STRING:
670 675
							lstTerms.add(cell.getStringCellValue());
671 676
							break;
677
	                    default:
678
	                            throw new RuntimeException("CellType not yet handled: " + cellType);
672 679
					}
673 680
				}
674 681
				lstUpdates.add(lstTerms);

Also available in: Unified diff