Revision aea90ab7
Added by Andreas Müller almost 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/greece/FloraHellenicaSynonymImport.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
import org.apache.log4j.Logger; |
19 | 19 |
import org.springframework.stereotype.Component; |
20 |
import org.springframework.transaction.TransactionStatus; |
|
21 | 20 |
|
22 | 21 |
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState; |
23 | 22 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
... | ... | |
60 | 59 |
return "synonyms"; |
61 | 60 |
} |
62 | 61 |
|
63 |
private boolean isFirst = true; |
|
64 |
private TransactionStatus tx = null; |
|
65 | 62 |
/** |
66 | 63 |
* {@inheritDoc} |
67 | 64 |
*/ |
68 | 65 |
@Override |
69 | 66 |
protected void firstPass(SimpleExcelTaxonImportState<CONFIG> state) { |
70 |
if (isFirst){ |
|
71 |
tx = this.startTransaction(); |
|
72 |
isFirst = false; |
|
73 |
} |
|
74 | 67 |
|
75 | 68 |
String line = state.getCurrentLine() + ": "; |
76 | 69 |
HashMap<String, String> record = state.getOriginalRecord(); |
... | ... | |
84 | 77 |
|
85 | 78 |
String row = "row" + state.getCurrentLine(); |
86 | 79 |
TaxonBase<?> relatedTaxon = makeSynonym(state, line, record, row); |
87 |
getTaxonService().saveOrUpdate(relatedTaxon); |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
protected void secondPass(SimpleExcelTaxonImportState<CONFIG> state) { |
|
92 |
if (tx != null){ |
|
93 |
this.commitTransaction(tx); |
|
94 |
tx = null; |
|
80 |
if (relatedTaxon != null){ |
|
81 |
getTaxonService().saveOrUpdate(relatedTaxon); |
|
95 | 82 |
} |
96 | 83 |
} |
97 | 84 |
|
... | ... | |
141 | 128 |
logger.warn(line + "Nom. status not recognized: " + parsedSynStr[3]); |
142 | 129 |
} |
143 | 130 |
} |
131 |
name = replaceNameAuthorsAndReferences(state, name); |
|
132 |
|
|
144 | 133 |
|
145 | 134 |
TaxonBase<?> result; |
146 | 135 |
if (isMisapplied){ |
... | ... | |
188 | 177 |
split = split.replace("T.", "Taraxacum"); |
189 | 178 |
} |
190 | 179 |
nonName = TaxonNameBase.castAndDeproxy(this.parser.parseFullName(split)); |
180 |
nonName = replaceNameAuthorsAndReferences(state, nonName); |
|
191 | 181 |
name.addRelationshipFromName(nonName, NameRelationshipType.BLOCKING_NAME_FOR(), null); |
192 | 182 |
}else{ |
193 | 183 |
String nameStr = name.getNameCache() + " " + split; |
194 | 184 |
nonName = TaxonNameBase.castAndDeproxy(this.parser.parseFullName(nameStr)); |
185 |
nonName = replaceNameAuthorsAndReferences(state, nonName); |
|
195 | 186 |
name.addRelationshipToName(nonName, NameRelationshipType.LATER_HOMONYM(), null); |
196 | 187 |
} |
197 | 188 |
getNameService().saveOrUpdate(nonName); |
Also available in: Unified diff
ref #6286 updates for Flora Hellenica import (including new image import)