Revision c59ecc4a
Added by Andreas Müller almost 13 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/cyprus/CyprusDistributionImport.java | ||
---|---|---|
80 | 80 |
private boolean areasCreated = false; |
81 | 81 |
private Map<String, NamedArea> divisions = new HashMap<String, NamedArea>(); |
82 | 82 |
|
83 |
private boolean makeAreasAndReference(CyprusImportState state) {
|
|
83 |
private void makeAreasAndReference(CyprusImportState state) {
|
|
84 | 84 |
if (areasCreated == false){ |
85 | 85 |
IInputTransformer transformer = state.getTransformer(); |
86 |
|
|
87 | 86 |
try { |
88 | 87 |
//divisions |
89 | 88 |
makeNewDivisions(state, transformer); |
... | ... | |
93 | 92 |
loadTaxa(); |
94 | 93 |
|
95 | 94 |
areasCreated = true; |
96 |
|
|
97 |
return true; |
|
98 |
|
|
95 |
return; |
|
99 | 96 |
} catch (Exception e) { |
100 | 97 |
e.printStackTrace(); |
101 |
return false; |
|
98 |
state.setUnsuccessfull(); |
|
99 |
return; |
|
102 | 100 |
} |
103 |
|
|
104 | 101 |
} |
105 |
|
|
106 |
|
|
107 |
return true; |
|
108 |
|
|
109 | 102 |
} |
110 | 103 |
|
111 | 104 |
/** |
112 | 105 |
* Stores taxa records in DB |
113 | 106 |
*/ |
114 | 107 |
@Override |
115 |
protected boolean firstPass(CyprusImportState state) {
|
|
108 |
protected void firstPass(CyprusImportState state) {
|
|
116 | 109 |
|
117 |
boolean success = true; |
|
118 |
success &= makeAreasAndReference(state); |
|
110 |
makeAreasAndReference(state); |
|
119 | 111 |
|
120 | 112 |
CyprusDistributionRow taxonLight = state.getCyprusDistributionRow(); |
121 | 113 |
//species name |
122 | 114 |
String taxonStr = taxonLight.getSpecies(); |
123 | 115 |
if ("#entf?llt#".equalsIgnoreCase(taxonStr)){ |
124 | 116 |
logger.warn("entf?llt"); |
125 |
return success;
|
|
117 |
return; |
|
126 | 118 |
} |
127 | 119 |
Taxon taxon = getTaxon(state, taxonStr); |
128 | 120 |
Reference ref = getReference(taxonLight.getReference()); |
... | ... | |
131 | 123 |
getTaxonService().save(taxon); |
132 | 124 |
} |
133 | 125 |
|
134 |
return success;
|
|
126 |
return; |
|
135 | 127 |
} |
136 | 128 |
|
137 | 129 |
|
... | ... | |
387 | 379 |
* @see eu.etaxonomy.cdm.io.excel.common.ExcelImporterBase#analyzeRecord(java.util.HashMap, eu.etaxonomy.cdm.io.excel.common.ExcelImportState) |
388 | 380 |
*/ |
389 | 381 |
@Override |
390 |
protected boolean analyzeRecord(HashMap<String, String> record, CyprusImportState state) {
|
|
382 |
protected void analyzeRecord(HashMap<String, String> record, CyprusImportState state) {
|
|
391 | 383 |
|
392 |
boolean success = true; |
|
393 | 384 |
Set<String> keys = record.keySet(); |
394 |
|
|
395 | 385 |
CyprusDistributionRow cyprusDistributionRow = new CyprusDistributionRow(); |
396 | 386 |
state.setCyprusDistributionRow(cyprusDistributionRow); |
397 | 387 |
|
... | ... | |
429 | 419 |
cyprusDistributionRow.setReference(value); |
430 | 420 |
|
431 | 421 |
} else { |
432 |
success = false;
|
|
422 |
state.setUnsuccessfull();
|
|
433 | 423 |
logger.error("Unexpected column header " + key); |
434 | 424 |
} |
435 | 425 |
} |
436 |
return success;
|
|
426 |
return; |
|
437 | 427 |
} |
438 | 428 |
|
439 | 429 |
|
... | ... | |
441 | 431 |
* |
442 | 432 |
*/ |
443 | 433 |
@Override |
444 |
protected boolean secondPass(CyprusImportState state) {
|
|
445 |
boolean success = true;
|
|
446 |
return success;
|
|
434 |
protected void secondPass(CyprusImportState state) {
|
|
435 |
//no second pass for this import
|
|
436 |
return; |
|
447 | 437 |
} |
448 | 438 |
|
449 | 439 |
@Override |
Also available in: Unified diff
last updates for Taxon Excel Import and moving all success variables to state