Revision 7d882578
Added by Andreas Müller about 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/SalvadorActivator.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.io.common.ImportResult; |
28 | 28 |
import eu.etaxonomy.cdm.io.common.Source; |
29 | 29 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
30 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
30 | 31 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
31 | 32 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
32 | 33 |
|
... | ... | |
244 | 245 |
|
245 | 246 |
//used by BerlinModelImportConfigurator |
246 | 247 |
@SuppressWarnings("unused") |
247 |
private static boolean handleNameRelationshipType(Integer relQualifierFk, NonViralName nameTo, NonViralName nameFrom){ |
|
248 |
private static boolean handleNameRelationshipType(Integer relQualifierFk, INonViralName nameTo, NonViralName nameFrom){
|
|
248 | 249 |
if (relQualifierFk == 72){ |
249 | 250 |
nameTo.getHomotypicalGroup().merge(nameFrom.getHomotypicalGroup()); |
250 | 251 |
return true; |
app-import/src/main/java/eu/etaxonomy/cdm/app/caryophyllales/CaryophyllalesCacheUpdater.java | ||
---|---|---|
69 | 69 |
// static final boolean doSequence = true; |
70 | 70 |
// |
71 | 71 |
// //Names |
72 |
// static final boolean doViralName = true; |
|
73 |
// static final boolean doNonViralName = true; |
|
74 |
// static final boolean doBotanicalName = true; |
|
75 |
// static final boolean doZoologicalName = true; |
|
76 |
// static final boolean doCultivarPlantName = true; |
|
72 |
// static final boolean doTaxonNameBase = true; |
|
77 | 73 |
// |
78 | 74 |
// static final boolean doClassification = true; |
79 | 75 |
// |
app-import/src/main/java/eu/etaxonomy/cdm/app/common/CacheUpdater.java | ||
---|---|---|
126 | 126 |
// static final boolean doSequence = true; |
127 | 127 |
// |
128 | 128 |
// //Names |
129 |
// static final boolean doViralName = true; |
|
130 |
// static final boolean doNonViralName = true; |
|
131 |
// static final boolean doBotanicalName = true; |
|
132 |
// static final boolean doZoologicalName = true; |
|
133 |
// static final boolean doCultivarPlantName = true; |
|
129 |
// static final boolean doTaxonName = true; |
|
134 | 130 |
// |
135 | 131 |
// static final boolean doClassification = true; |
136 | 132 |
// |
app-import/src/main/java/eu/etaxonomy/cdm/app/edaphobase/EdaphobaseActivator.java | ||
---|---|---|
58 | 58 |
private static final boolean doReferences = true; |
59 | 59 |
|
60 | 60 |
|
61 |
|
|
62 | 61 |
//check - import |
63 | 62 |
static CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
64 | 63 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/synthesysImport/SynthesysCacheActivator.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.location.Country; |
36 | 36 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
37 | 37 |
import eu.etaxonomy.cdm.model.location.Point; |
38 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
|
38 | 39 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
39 | 40 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
40 | 41 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent; |
... | ... | |
164 | 165 |
derivedThing = DerivedUnit.NewInstance(SpecimenOrObservationType.Observation); |
165 | 166 |
} |
166 | 167 |
|
167 |
TaxonNameBase<?,?> taxonName = null;
|
|
168 |
ITaxonNameBase taxonName = null;
|
|
168 | 169 |
Taxon taxon = null; |
169 | 170 |
DeterminationEvent determinationEvent = null; |
170 | 171 |
List<TaxonNameBase> names = null; |
171 | 172 |
NonViralNameParserImpl nvnpi = NonViralNameParserImpl.NewInstance(); |
172 | 173 |
String scientificName=""; |
173 | 174 |
boolean preferredFlag=false; |
174 |
System.out.println(this.identificationList); |
|
175 |
// System.out.println(this.identificationList);
|
|
175 | 176 |
for (int i = 0; i < this.identificationList.size(); i++) { |
176 | 177 |
this.fullScientificNameString = this.identificationList.get(i); |
177 | 178 |
this.fullScientificNameString = this.fullScientificNameString.replaceAll(" et ", " & "); |
... | ... | |
187 | 188 |
scientificName = this.fullScientificNameString; |
188 | 189 |
} |
189 | 190 |
|
190 |
// taxonName = nvnpi.parseFullName(this.fullScientificNameString,NomenclaturalCode.ICZN(),null); |
|
191 |
// if (taxonName.hasProblem()){ |
|
192 |
// System.out.println("pb ICZN"); |
|
193 |
// taxonName = nvnpi.parseFullName(this.fullScientificNameString,NomenclaturalCode.ICBN(),null); |
|
194 |
// if (taxonName.hasProblem()){ |
|
195 |
// System.out.println("pb ICBN"); |
|
196 |
// taxonName = nvnpi.parseFullName(this.fullScientificNameString,NomenclaturalCode.ICNB(), null); |
|
197 |
// if (taxonName.hasProblem()){ |
|
198 |
// System.out.println("pb ICNB"); |
|
199 |
// taxonName = nvnpi.parseFullName(this.fullScientificNameString,NomenclaturalCode.ICNCP(), null); |
|
200 |
// if (taxonName.hasProblem()){ |
|
201 |
// System.out.println("pb ICNCP"); |
|
202 |
// } |
|
203 |
// } |
|
204 |
// } |
|
205 |
// } |
|
206 | 191 |
taxonName = nvnpi.parseFullName(scientificName); |
207 | 192 |
if (withCdm){ |
208 | 193 |
names = app.getNameService().findByName(null, scientificName, null, null, null, null, null, null).getRecords(); |
... | ... | |
219 | 204 |
|
220 | 205 |
|
221 | 206 |
// tx = app.startTransaction(); |
222 |
app.getNameService().saveOrUpdate(taxonName);
|
|
207 |
app.getNameService().saveOrUpdate(TaxonNameBase.castAndDeproxy(taxonName));
|
|
223 | 208 |
taxon = Taxon.NewInstance(taxonName, sec); //TODO use real reference for sec |
224 | 209 |
// app.commitTransaction(tx); |
225 | 210 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/util/TestDatabase.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
39 | 39 |
import eu.etaxonomy.cdm.model.location.Country; |
40 | 40 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
41 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
42 | 41 |
import eu.etaxonomy.cdm.model.name.Rank; |
43 | 42 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
44 | 43 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
... | ... | |
145 | 144 |
List<AnnotatableEntity> homotypicalGroups; |
146 | 145 |
|
147 | 146 |
Reference citRef, sec; |
148 |
BotanicalName name1, name2, name21, nameRoot1, nameFree, synName11, synName12, synName2, synNameFree;
|
|
149 |
BotanicalName nameRoot2, nameR2_1, nameR2_2;
|
|
147 |
TaxonNameBase<?,?> name1, name2, name21, nameRoot1, nameFree, synName11, synName12, synName2, synNameFree;
|
|
148 |
TaxonNameBase<?,?> nameRoot2, nameR2_1, nameR2_2;
|
|
150 | 149 |
Taxon child1, child2, child21, root1T, root2T, freeT; |
151 | 150 |
Taxon childR2_1, childR2_2; |
152 | 151 |
TaxonNode child1Node, child2Node, child21Node, root1TNode, root2TNode, freeTNode; |
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/IopiActivator.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES; |
27 | 27 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR; |
28 | 28 |
import eu.etaxonomy.cdm.io.common.Source; |
29 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
30 | 29 |
import eu.etaxonomy.cdm.model.common.ExtensionType; |
30 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
31 | 31 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
32 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
33 | 32 |
import eu.etaxonomy.cdm.model.name.Rank; |
34 | 33 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
35 | 34 |
|
... | ... | |
255 | 254 |
String taxonName = ""; |
256 | 255 |
String rankStr = ""; |
257 | 256 |
|
258 |
NonViralName<?> name = CdmBase.deproxy(taxon.getName(), NonViralName.class);
|
|
257 |
INonViralName name = taxon.getName();
|
|
259 | 258 |
Rank rank = name.getRank(); |
260 | 259 |
rankStr = transformFeRanks(rank); |
261 | 260 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/viennaImport/ViennaActivator.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.model.common.IdentifiableSource; |
29 | 29 |
import eu.etaxonomy.cdm.model.media.ImageFile; |
30 | 30 |
import eu.etaxonomy.cdm.model.media.Media; |
31 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
31 | 32 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
32 | 33 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
33 | 34 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
... | ... | |
102 | 103 |
Reference sec = ReferenceFactory.newDatabase(); |
103 | 104 |
sec.setTitleCache("Vienna Asteraceae Images", true); |
104 | 105 |
|
105 |
TaxonNameBase<?,?> taxonName = NonViralNameParserImpl.NewInstance().parseFullName(strTaxonName);
|
|
106 |
INonViralName taxonName = NonViralNameParserImpl.NewInstance().parseFullName(strTaxonName);
|
|
106 | 107 |
if (withCdm){ |
107 | 108 |
List<TaxonNameBase> names = app.getNameService().findByName(null, strTaxonName, null, null, null, null, null, null).getRecords(); |
108 | 109 |
if (names.size() == 0){ |
... | ... | |
121 | 122 |
DerivedUnitFacade specimen = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.PreservedSpecimen); |
122 | 123 |
|
123 | 124 |
specimen.setCatalogNumber(catalogNumber); |
124 |
specimen.setStoredUnder(taxonName); //??
|
|
125 |
specimen.setStoredUnder(TaxonNameBase.castAndDeproxy(taxonName)); //??
|
|
125 | 126 |
//TODO |
126 | 127 |
//specimen.setCollection(collection); |
127 | 128 |
specimen.addAnnotation(Annotation.NewDefaultLanguageInstance(annotation)); |
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/diptera/DipteraPostImportUpdater.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.description.Feature; |
34 | 34 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
35 | 35 |
import eu.etaxonomy.cdm.model.description.TextData; |
36 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
37 | 36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
38 | 37 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
39 | 38 |
|
... | ... | |
131 | 130 |
|
132 | 131 |
|
133 | 132 |
private void fillNameMaps(List<TaxonNameBase> nameList, Map<String, TaxonNameBase> nameMap, Map<String, TaxonNameBase> duplicateMap) { |
134 |
for (TaxonNameBase name : nameList){ |
|
135 |
NonViralName nvn = name.deproxy(name, NonViralName.class); |
|
136 |
String nameCache = nvn.getNameCache(); |
|
133 |
for (TaxonNameBase<?,?> name : nameList){ |
|
134 |
String nameCache = name.getNameCache(); |
|
137 | 135 |
if (nameMap.containsKey(nameCache)){ |
138 |
duplicateMap.put(nameCache, nvn);
|
|
136 |
duplicateMap.put(nameCache, name);
|
|
139 | 137 |
}else{ |
140 |
nameMap.put(nameCache, nvn);
|
|
138 |
nameMap.put(nameCache, name);
|
|
141 | 139 |
} |
142 | 140 |
} |
143 | 141 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelTaxonNameImport.java | ||
---|---|---|
40 | 40 |
import eu.etaxonomy.cdm.model.common.Representation; |
41 | 41 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
42 | 42 |
import eu.etaxonomy.cdm.model.name.CultivarPlantName; |
43 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
44 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
45 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
43 | 46 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
44 | 47 |
import eu.etaxonomy.cdm.model.name.Rank; |
45 | 48 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
... | ... | |
263 | 266 |
|
264 | 267 |
//NonViralName |
265 | 268 |
if (taxonNameBase instanceof NonViralName){ |
266 |
NonViralName<?> nonViralName = (NonViralName<?>)taxonNameBase;
|
|
269 |
INonViralName nonViralName = taxonNameBase;
|
|
267 | 270 |
|
268 | 271 |
//authorTeams |
269 | 272 |
if (teamMap != null ){ |
... | ... | |
281 | 284 |
|
282 | 285 |
//zoologicalName |
283 | 286 |
if (taxonNameBase instanceof ZoologicalName){ |
284 |
ZoologicalName zooName = (ZoologicalName)taxonNameBase;
|
|
287 |
IZoologicalName zooName = taxonNameBase;
|
|
285 | 288 |
makeZoologialName(rs, zooName, nameId); |
286 | 289 |
} |
287 | 290 |
//botanicalName |
288 | 291 |
else if (taxonNameBase instanceof BotanicalName){ |
289 |
BotanicalName botName = (BotanicalName)taxonNameBase;
|
|
292 |
IBotanicalName botName = taxonNameBase;
|
|
290 | 293 |
success &= makeBotanicalNamePart(rs, botName) ; |
291 | 294 |
|
292 | 295 |
} |
... | ... | |
299 | 302 |
taxonNameBase.setTitleCache(fullNameCache, true); |
300 | 303 |
taxonNameBase.setFullTitleCache(taxonNameBase.getFullTitleCache(), true); |
301 | 304 |
if (taxonNameBase instanceof NonViralName){ |
302 |
NonViralName<?> nvn = (NonViralName<?>)taxonNameBase;
|
|
305 |
INonViralName nvn = taxonNameBase;
|
|
303 | 306 |
nvn.setNameCache(nameCache, true); |
304 | 307 |
nvn.setAuthorshipCache(nvn.getAuthorshipCache(), true); |
305 | 308 |
} |
... | ... | |
390 | 393 |
return result; |
391 | 394 |
} |
392 | 395 |
|
393 |
private boolean makeZoologialName(ResultSet rs, ZoologicalName zooName, int nameId) |
|
396 |
private boolean makeZoologialName(ResultSet rs, IZoologicalName zooName, int nameId)
|
|
394 | 397 |
throws SQLException{ |
395 | 398 |
boolean success = true; |
396 | 399 |
//publicationYear |
... | ... | |
416 | 419 |
return success; |
417 | 420 |
} |
418 | 421 |
|
419 |
private boolean makeBotanicalNamePart(ResultSet rs, BotanicalName botanicalName)throws SQLException{ |
|
422 |
private boolean makeBotanicalNamePart(ResultSet rs, IBotanicalName botanicalName)throws SQLException{
|
|
420 | 423 |
boolean success = true; |
421 | 424 |
String dbAttrName; |
422 | 425 |
String cdmAttrName; |
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelTaxonNameRelationImport.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.cdm.model.agent.Person; |
48 | 48 |
import eu.etaxonomy.cdm.model.common.AnnotatableEntity; |
49 | 49 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
50 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
51 | 50 |
import eu.etaxonomy.cdm.model.name.HybridRelationshipType; |
51 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
52 | 52 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
53 | 53 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
54 | 54 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
... | ... | |
255 | 255 |
} |
256 | 256 |
try { |
257 | 257 |
HybridRelationshipType hybridRelType = BerlinModelTransformer.relNameId2HybridRel(relQualifierFk); |
258 |
BotanicalName parent = (BotanicalName)nameFrom;
|
|
259 |
BotanicalName child = (BotanicalName)nameTo;
|
|
258 |
IBotanicalName parent = nameFrom;
|
|
259 |
IBotanicalName child = nameTo;
|
|
260 | 260 |
|
261 | 261 |
nameRelationship = parent.addHybridChild(child, hybridRelType, rule); |
262 | 262 |
|
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/out/BerlinModelTaxonNameExport.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
36 | 36 |
import eu.etaxonomy.cdm.model.common.ExtensionType; |
37 | 37 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
38 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
38 | 39 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
39 | 40 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
40 | 41 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
... | ... | |
138 | 139 |
//publicationYear |
139 | 140 |
//originalPublicationYear |
140 | 141 |
//breed |
141 |
NonViralName<?> n = null;
|
|
142 |
// INonViralName n = null;
|
|
142 | 143 |
//n.getNomenclaturalMicroReference() |
143 | 144 |
return mapping; |
144 | 145 |
} |
... | ... | |
246 | 247 |
|
247 | 248 |
//called by MethodMapper |
248 | 249 |
@SuppressWarnings("unused") |
249 |
private static Integer getRankFk(NonViralName<?> name){
|
|
250 |
private static Integer getRankFk(INonViralName name){
|
|
250 | 251 |
Integer result = BerlinModelTransformer.rank2RankId(name.getRank()); |
251 | 252 |
if (result == null){ |
252 | 253 |
logger.warn ("Rank = null is not allowed in Berlin Model. Rank was changed to KINGDOM: " + name); |
... | ... | |
263 | 264 |
|
264 | 265 |
//called by MethodMapper |
265 | 266 |
@SuppressWarnings("unused") |
266 |
private static String getSupraGenericName(NonViralName<?> name){
|
|
267 |
private static String getSupraGenericName(INonViralName name){
|
|
267 | 268 |
if (name.isSupraGeneric()){ |
268 | 269 |
return name.getGenusOrUninomial(); |
269 | 270 |
}else{ |
... | ... | |
273 | 274 |
|
274 | 275 |
//called by MethodMapper |
275 | 276 |
@SuppressWarnings("unused") |
276 |
private static String getGenus(NonViralName<?> name){
|
|
277 |
private static String getGenus(INonViralName name){
|
|
277 | 278 |
if (! name.isSupraGeneric()){ |
278 | 279 |
return name.getGenusOrUninomial(); |
279 | 280 |
}else{ |
... | ... | |
283 | 284 |
|
284 | 285 |
//called by MethodMapper |
285 | 286 |
@SuppressWarnings("unused") |
286 |
private static String getNameCache(NonViralName<?> name){
|
|
287 |
private static String getNameCache(INonViralName name){
|
|
287 | 288 |
if (name.isProtectedNameCache()){ |
288 | 289 |
return name.getNameCache(); |
289 | 290 |
}else{ |
... | ... | |
293 | 294 |
|
294 | 295 |
//called by MethodMapper |
295 | 296 |
@SuppressWarnings("unused") |
296 |
private static String getFullNameCache(NonViralName<?> name){
|
|
297 |
private static String getFullNameCache(INonViralName name){
|
|
297 | 298 |
if (name.isProtectedTitleCache()){ |
298 | 299 |
return name.getTitleCache(); |
299 | 300 |
}else{ |
... | ... | |
303 | 304 |
|
304 | 305 |
//called by MethodMapper |
305 | 306 |
@SuppressWarnings("unused") |
306 |
private static Boolean getPreliminaryFlag(NonViralName<?> name){
|
|
307 |
private static Boolean getPreliminaryFlag(INonViralName name){
|
|
307 | 308 |
if (name.isProtectedTitleCache() || name.isProtectedNameCache()){ |
308 | 309 |
if (name.isProtectedTitleCache() && name.isProtectedNameCache()){ |
309 | 310 |
logger.warn("protectedTitleCache and protectedNameCache do not have the same value for name " + name.getTitleCache() + ". This can not be mapped appropriately to the Berlin Model "); |
app-import/src/main/java/eu/etaxonomy/cdm/io/caryo/CaryoTaxonImport.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.common.Language; |
32 | 32 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
33 | 33 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
34 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
34 |
import eu.etaxonomy.cdm.model.name.IBotanicalName;
|
|
35 | 35 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
36 | 36 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
37 | 37 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
38 | 38 |
import eu.etaxonomy.cdm.model.name.Rank; |
39 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
39 | 40 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
40 | 41 |
import eu.etaxonomy.cdm.model.reference.IArticle; |
41 | 42 |
import eu.etaxonomy.cdm.model.reference.IBook; |
... | ... | |
160 | 161 |
// ,[OriginalCitation] |
161 | 162 |
|
162 | 163 |
|
163 |
BotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS()); |
|
164 |
IBotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS());
|
|
164 | 165 |
name.setGenusOrUninomial(genus); |
165 | 166 |
makeAuthors(name, autoren, id); |
166 | 167 |
INomenclaturalReference nomRef = makeNomRef(state, rs, id); |
... | ... | |
197 | 198 |
|
198 | 199 |
private void handleBasionym(CaryoImportState state, ResultSet rs, Taxon taxon, String basioStr, Integer id) { |
199 | 200 |
if (StringUtils.isNotBlank(basioStr)){ |
200 |
BotanicalName name = (BotanicalName) taxon.getName();
|
|
201 |
BotanicalName basionym = TaxonNameFactory.PARSED_BOTANICAL_REFERENCE(basioStr);
|
|
201 |
IBotanicalName name = taxon.getName();
|
|
202 |
TaxonNameBase<?,?> basionym = TaxonNameFactory.PARSED_BOTANICAL_REFERENCE(basioStr);
|
|
202 | 203 |
if (basionym.hasProblem()){ |
203 | 204 |
logger.warn("Problem when parsing basionym ("+id+"): " + basioStr); |
204 | 205 |
} |
... | ... | |
219 | 220 |
if (StringUtils.isBlank(type) || "to be designated".equalsIgnoreCase(type)){ |
220 | 221 |
return; |
221 | 222 |
}else{ |
222 |
BotanicalName name = (BotanicalName)taxon.getName();
|
|
223 |
BotanicalName typeName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
223 |
IBotanicalName name = taxon.getName();
|
|
224 |
TaxonNameBase<?,?> typeName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
224 | 225 |
if ("not designated".equalsIgnoreCase(type)){ |
225 | 226 |
desig.setNotDesignated(true); |
226 | 227 |
}else{ |
... | ... | |
270 | 271 |
|
271 | 272 |
|
272 | 273 |
|
273 |
private String makeTypeNomStatus(BotanicalName typeName, String type) { |
|
274 |
private String makeTypeNomStatus(IBotanicalName typeName, String type) {
|
|
274 | 275 |
if (type.endsWith(", nom. illeg.")){ |
275 | 276 |
type = type.replaceAll(", nom. illeg.", ""); |
276 | 277 |
typeName.addStatus(NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ILLEGITIMATE())); |
... | ... | |
281 | 282 |
|
282 | 283 |
|
283 | 284 |
|
284 |
private void makeStatus(BotanicalName name, String nomStatusStr, Integer id) throws SQLException { |
|
285 |
private void makeStatus(IBotanicalName name, String nomStatusStr, Integer id) throws SQLException {
|
|
285 | 286 |
// ,[NomenclaturalStatus] |
286 | 287 |
|
287 | 288 |
if (StringUtils.isNotBlank(nomStatusStr)){ |
... | ... | |
455 | 456 |
|
456 | 457 |
|
457 | 458 |
|
458 |
private void makeAuthors(BotanicalName name, String autoren, Integer id) { |
|
459 |
private void makeAuthors(IBotanicalName name, String autoren, Integer id) {
|
|
459 | 460 |
String[] parsedAuthorTeams = getParsedAuthors(autoren); |
460 | 461 |
name.setBasionymAuthorship(getTeam(parsedAuthorTeams[0], id)); |
461 | 462 |
name.setExBasionymAuthorship(getTeam(parsedAuthorTeams[1], id)); |
... | ... | |
749 | 750 |
String family = rs.getString("family"); |
750 | 751 |
if (familyMap.get(family) == null ){ |
751 | 752 |
|
752 |
BotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.FAMILY()); |
|
753 |
IBotanicalName name = TaxonNameFactory.NewBotanicalInstance(Rank.FAMILY());
|
|
753 | 754 |
name.setGenusOrUninomial(family); |
754 | 755 |
Taxon taxon = Taxon.NewInstance(name, state.getTransactionalSourceReference()); |
755 | 756 |
classification.addChildTaxon(taxon, null, null); |
app-import/src/main/java/eu/etaxonomy/cdm/io/cuba/CubaExcelImport.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
48 | 48 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
49 | 49 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
50 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
50 | 51 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
51 | 52 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
52 | 53 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
... | ... | |
391 | 392 |
Matcher heterotypicMatcher = heterotypicRegEx.matcher(synonymStr); |
392 | 393 |
Matcher sphalmMatcher = sphalmRegEx.matcher(synonymStr); |
393 | 394 |
|
394 |
List<BotanicalName> homonyms = new ArrayList<>(); |
|
395 |
List<IBotanicalName> homonyms = new ArrayList<>();
|
|
395 | 396 |
if (missapliedMatcher.matches()){ |
396 | 397 |
boolean doubtful = missapliedMatcher.group(1) != null; |
397 | 398 |
String firstPart = missapliedMatcher.group(2); |
... | ... | |
446 | 447 |
}else if (acceptedMatcher.matches()){ |
447 | 448 |
String firstPart = acceptedMatcher.group(1); |
448 | 449 |
String homonymPart = acceptedMatcher.groupCount() < 2 ? null : acceptedMatcher.group(2); |
449 |
List<BotanicalName> list = handleHomotypicGroup(firstPart, state, (BotanicalName)state.getCurrentTaxon().getName(), false, homonyms, homonymPart, false);
|
|
450 |
List<IBotanicalName> list = handleHomotypicGroup(firstPart, state, state.getCurrentTaxon().getName(), false, homonyms, homonymPart, false);
|
|
450 | 451 |
checkFirstSynonym(state, list, isFirstSynonym, synonymStr, false); |
451 | 452 |
}else if(heterotypicMatcher.matches()){ |
452 | 453 |
String firstPart = heterotypicMatcher.group(1).trim(); |
... | ... | |
465 | 466 |
Synonym syn = state.getCurrentTaxon().addHeterotypicSynonymName(synName); |
466 | 467 |
syn.setDoubtful(isDoubtful); |
467 | 468 |
syn.addSource(makeOriginalSource(state)); |
468 |
List<BotanicalName> list = handleHomotypicGroup(secondPart, state, synName, true, homonyms, homonymPart, isDoubtful); |
|
469 |
List<IBotanicalName> list = handleHomotypicGroup(secondPart, state, synName, true, homonyms, homonymPart, isDoubtful);
|
|
469 | 470 |
checkFirstSynonym(state, list, isFirstSynonym, synonymStr, true); |
470 | 471 |
|
471 | 472 |
}else if (isSpecialHeterotypic(synonymStr)){ |
... | ... | |
487 | 488 |
* @param synonymStr |
488 | 489 |
* @param b |
489 | 490 |
*/ |
490 |
private void checkFirstSynonym(CubaImportState state, List<BotanicalName> list, boolean isFirstSynonym, String synonymStr, boolean isHeterotypicMatcher) { |
|
491 |
private void checkFirstSynonym(CubaImportState state, List<IBotanicalName> list, boolean isFirstSynonym, String synonymStr, boolean isHeterotypicMatcher) {
|
|
491 | 492 |
if (!isFirstSynonym){ |
492 | 493 |
return; |
493 | 494 |
} |
494 | 495 |
String line = state.getCurrentLine() + ": "; |
495 |
BotanicalName currentName = isHeterotypicMatcher? (BotanicalName)state.getCurrentTaxon().getName(): list.get(0);
|
|
496 |
IBotanicalName currentName = isHeterotypicMatcher? (IBotanicalName)state.getCurrentTaxon().getName(): list.get(0);
|
|
496 | 497 |
boolean currentHasBasionym = currentName.getBasionymAuthorship() != null; |
497 |
BotanicalName firstSynonym = isHeterotypicMatcher ? list.get(0): list.get(1); |
|
498 |
IBotanicalName firstSynonym = isHeterotypicMatcher ? list.get(0): list.get(1);
|
|
498 | 499 |
// if (list.size() <= 1){ |
499 | 500 |
// logger.error(line + "homotypic list size is 1 but shouldn't"); |
500 | 501 |
// return; |
... | ... | |
584 | 585 |
* @param taxon |
585 | 586 |
* @param homotypicalGroup |
586 | 587 |
*/ |
587 |
private List<BotanicalName> handleHomotypicGroup(String homotypicStrOrig, |
|
588 |
private List<IBotanicalName> handleHomotypicGroup(String homotypicStrOrig,
|
|
588 | 589 |
CubaImportState state, |
589 |
BotanicalName homotypicName, |
|
590 |
IBotanicalName homotypicName,
|
|
590 | 591 |
boolean isHeterotypic, |
591 |
List<BotanicalName> homonyms, |
|
592 |
List<IBotanicalName> homonyms,
|
|
592 | 593 |
String homonymPart, |
593 | 594 |
boolean isDoubtful) { |
594 | 595 |
|
595 |
List<BotanicalName> homotypicNameList = new ArrayList<>(); |
|
596 |
List<IBotanicalName> homotypicNameList = new ArrayList<>();
|
|
596 | 597 |
homotypicNameList.add(homotypicName); |
597 | 598 |
|
598 | 599 |
String homotypicStr = homotypicStrOrig; |
... | ... | |
607 | 608 |
for (String split : splits){ |
608 | 609 |
split = replaceHomonIlleg(split); |
609 | 610 |
boolean isHomonym = split.matches(".*" + HOMONYM_MARKER); |
610 |
BotanicalName newName = makeName(state, split);
|
|
611 |
TaxonNameBase<?,?> newName = makeName(state, split);
|
|
611 | 612 |
newName.setHomotypicalGroup(homotypicGroup); //not really necessary as this is later set anyway |
612 | 613 |
if (newName.isProtectedTitleCache()){ |
613 | 614 |
logger.warn(state.getCurrentLine() + ": homotypic name part could not be parsed: " + split); |
... | ... | |
647 | 648 |
* @param state |
648 | 649 |
* @param currentBasionym |
649 | 650 |
*/ |
650 |
private void makeHomonyms(List<BotanicalName> homonyms, String homonymPartOrig, CubaImportState state, |
|
651 |
private void makeHomonyms(List<IBotanicalName> homonyms, String homonymPartOrig, CubaImportState state,
|
|
651 | 652 |
HomotypicalGroup homotypicGroup) { |
652 | 653 |
String line = state.getCurrentLine() + ": "; |
653 | 654 |
String homonymPart = homonymPartOrig == null ? "" : homonymPartOrig.trim(); |
... | ... | |
688 | 689 |
private void handleSimpleBlockingNames(String[] splitsi, |
689 | 690 |
CubaImportState state, |
690 | 691 |
HomotypicalGroup homotypicGroup) { |
691 |
List<BotanicalName> replacementNameCandidates = new ArrayList<>(); |
|
692 |
List<IBotanicalName> replacementNameCandidates = new ArrayList<>();
|
|
692 | 693 |
for (String spliti : splitsi){ |
693 | 694 |
|
694 | 695 |
String split = spliti.replaceAll("^non\\s+", ""); |
... | ... | |
696 | 697 |
if (newName.isProtectedTitleCache()){ |
697 | 698 |
logger.warn(state.getCurrentLine() + ": blocking name could not be parsed: " + split); |
698 | 699 |
} |
699 |
Set<BotanicalName> typifiedNames = (Set)homotypicGroup.getTypifiedNames(); |
|
700 |
Set<BotanicalName> candidates = new HashSet<>(); |
|
701 |
for (BotanicalName name : typifiedNames){ |
|
700 |
Set<IBotanicalName> typifiedNames = (Set)homotypicGroup.getTypifiedNames();
|
|
701 |
Set<IBotanicalName> candidates = new HashSet<>();
|
|
702 |
for (IBotanicalName name : typifiedNames){
|
|
702 | 703 |
if (name.getGenusOrUninomial() != null && name.getGenusOrUninomial().equals(newName.getGenusOrUninomial())){ |
703 | 704 |
if (name.getStatus().isEmpty() || ! name.getStatus().iterator().next().getType().equals(NomenclaturalStatusType.ILLEGITIMATE())){ |
704 | 705 |
candidates.add(name); |
... | ... | |
706 | 707 |
} |
707 | 708 |
} |
708 | 709 |
if (candidates.size() == 1){ |
709 |
BotanicalName blockedName = candidates.iterator().next();
|
|
710 |
TaxonNameBase<?,?> blockedName = (TaxonNameBase<?,?>)candidates.iterator().next();
|
|
710 | 711 |
newName.addRelationshipToName(blockedName, NameRelationshipType.BLOCKING_NAME_FOR(), null); |
711 | 712 |
replacementNameCandidates.add(blockedName); |
712 | 713 |
}else{ |
... | ... | |
722 | 723 |
*/ |
723 | 724 |
private void makeReplacedSynonymIfPossible(CubaImportState state, |
724 | 725 |
HomotypicalGroup homotypicGroup, |
725 |
List<BotanicalName> replacementNameCandidates) { |
|
726 |
List<IBotanicalName> replacementNameCandidates) {
|
|
726 | 727 |
String line = state.getCurrentLine() +": "; |
727 | 728 |
List<BotanicalName> replacedCandidates = new ArrayList<>(); |
728 | 729 |
for (TaxonNameBase<?, ?> typifiedName : homotypicGroup.getTypifiedNames()){ |
... | ... | |
736 | 737 |
} |
737 | 738 |
} |
738 | 739 |
if (replacedCandidates.size() == 1){ |
739 |
BotanicalName replacedSynonym = replacedCandidates.iterator().next();
|
|
740 |
for (BotanicalName replacementName : replacementNameCandidates){ |
|
740 |
TaxonNameBase<?,?> replacedSynonym = replacedCandidates.iterator().next();
|
|
741 |
for (IBotanicalName replacementName : replacementNameCandidates){
|
|
741 | 742 |
replacementName.addReplacedSynonym(replacedSynonym, null, null, null); |
742 | 743 |
} |
743 | 744 |
}else if (replacedCandidates.size() < 1){ |
... | ... | |
752 | 753 |
* @param homotypicGroup |
753 | 754 |
* @param newName |
754 | 755 |
*/ |
755 |
private void handleBasionym(CubaImportState state, List<BotanicalName> homotypicNameList, |
|
756 |
List<BotanicalName> homonyms, BotanicalName newName) {
|
|
757 |
for (BotanicalName existingName : homotypicNameList){ |
|
756 |
private void handleBasionym(CubaImportState state, List<IBotanicalName> homotypicNameList,
|
|
757 |
List<IBotanicalName> homonyms, IBotanicalName newName) {
|
|
758 |
for (IBotanicalName existingName : homotypicNameList){
|
|
758 | 759 |
if (existingName != newName){ //should not happen anymore, as new name is added later |
759 | 760 |
boolean onlyIfNotYetExists = true; |
760 | 761 |
createBasionymRelationIfPossible(state, existingName, newName, homonyms.contains(newName), onlyIfNotYetExists); |
... | ... | |
768 | 769 |
* @param name2 |
769 | 770 |
* @return |
770 | 771 |
*/ |
771 |
private void createBasionymRelationIfPossible(CubaImportState state, BotanicalName name1, BotanicalName name2, |
|
772 |
private void createBasionymRelationIfPossible(CubaImportState state, IBotanicalName name1, |
|
773 |
IBotanicalName name2, |
|
772 | 774 |
boolean name2isHomonym, boolean onlyIfNotYetExists) { |
773 |
BotanicalName basionymName = name1;
|
|
774 |
BotanicalName newCombination = name2;
|
|
775 |
TaxonNameBase<?,?> basionymName = TaxonNameBase.castAndDeproxy(name1);
|
|
776 |
TaxonNameBase<?,?> newCombination = TaxonNameBase.castAndDeproxy(name2);
|
|
775 | 777 |
//exactly one name must have a basionym author |
776 | 778 |
if (name1.getBasionymAuthorship() == null && name2.getBasionymAuthorship() == null |
777 | 779 |
|| name1.getBasionymAuthorship() != null && name2.getBasionymAuthorship() != null){ |
... | ... | |
780 | 782 |
|
781 | 783 |
//switch order if necessary |
782 | 784 |
if (! name2isHomonym && basionymName.getBasionymAuthorship() != null && newCombination.getBasionymAuthorship() == null){ |
783 |
basionymName = name2;
|
|
784 |
newCombination = name1;
|
|
785 |
basionymName = TaxonNameBase.castAndDeproxy(name2);
|
|
786 |
newCombination = TaxonNameBase.castAndDeproxy(name1);
|
|
785 | 787 |
} |
786 | 788 |
if (matchAuthor(basionymName.getCombinationAuthorship(), newCombination.getBasionymAuthorship()) |
787 | 789 |
&& matchLastNamePart(basionymName, newCombination)){ |
... | ... | |
799 | 801 |
* @param basionymName |
800 | 802 |
* @return |
801 | 803 |
*/ |
802 |
private boolean isLegitimate(BotanicalName basionymName) { |
|
804 |
private boolean isLegitimate(IBotanicalName basionymName) {
|
|
803 | 805 |
for (NomenclaturalStatus nomStatus : basionymName.getStatus()){ |
804 | 806 |
if (nomStatus.getType()!= null && nomStatus.getType().isIllegitimateType()){ |
805 | 807 |
return false; |
... | ... | |
819 | 821 |
* @param newCombination |
820 | 822 |
* @return |
821 | 823 |
*/ |
822 |
private boolean matchLastNamePart(BotanicalName name1, BotanicalName name2) {
|
|
824 |
private boolean matchLastNamePart(IBotanicalName name1, IBotanicalName name2) {
|
|
823 | 825 |
String lastNamePart1 = name1.getLastNamePart(); |
824 | 826 |
String lastNamePart2 = name2.getLastNamePart(); |
825 | 827 |
if (lastNamePart1 != null && lastNamePart2 != null){ |
... | ... | |
984 | 986 |
/** |
985 | 987 |
* @param result |
986 | 988 |
*/ |
987 |
private void normalizeAuthors(BotanicalName result) { |
|
989 |
private void normalizeAuthors(IBotanicalName result) {
|
|
988 | 990 |
result.setCombinationAuthorship(normalizeAuthor(result.getCombinationAuthorship())); |
989 | 991 |
result.setExCombinationAuthorship(normalizeAuthor(result.getExCombinationAuthorship())); |
990 | 992 |
result.setExBasionymAuthorship(normalizeAuthor(result.getExBasionymAuthorship())); |
app-import/src/main/java/eu/etaxonomy/cdm/io/edaphobase/EdaphobaseClassificationImport.java | ||
---|---|---|
107 | 107 |
TaxonBase<?> child = state.getRelatedObject(TAXON_NAMESPACE, String.valueOf(id), TaxonBase.class); |
108 | 108 |
// TaxonNameBase<?,?> childName = child.getName(); |
109 | 109 |
|
110 |
// handleMissingNameParts(CdmBase.deproxy(childName, NonViralName.class), CdmBase.deproxy(parentName, NonViralName.class));
|
|
110 |
// handleMissingNameParts(CdmBase.deproxy(childName, TaxonNameBase.class), CdmBase.deproxy(parentName, NonViralName.class));
|
|
111 | 111 |
|
112 | 112 |
if (isValid){ |
113 | 113 |
if (parent.isInstanceOf(Synonym.class)){ |
... | ... | |
153 | 153 |
// * @param childName |
154 | 154 |
// * @param parentName |
155 | 155 |
// */ |
156 |
// private void handleMissingNameParts(NonViralName<?> childName, NonViralName<?> parentName) {
|
|
156 |
// private void handleMissingNameParts(INonViralName childName, INonViralName parentName) {
|
|
157 | 157 |
// if (childName.getGenusOrUninomial()) |
158 | 158 |
// } |
159 | 159 |
|
app-import/src/main/java/eu/etaxonomy/cdm/io/edaphobase/EdaphobaseTaxonImport.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.common.Marker; |
32 | 32 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
33 | 33 |
import eu.etaxonomy.cdm.model.common.Representation; |
34 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
34 | 35 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 | 36 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
36 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.reference.Reference; |
38 | 38 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
146 | 146 |
//Name etc. |
147 | 147 |
Rank rank = makeRank(state, rankStr); |
148 | 148 |
checkRankMarker(state, rank); |
149 |
ZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank); |
|
149 |
IZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank);
|
|
150 | 150 |
setNamePart(nameStr, rank, name); |
151 | 151 |
Rank parentRank = makeRank(state, parentRankStr); |
152 | 152 |
setNamePart(parentNameStr, parentRank, name); |
... | ... | |
307 | 307 |
return result; |
308 | 308 |
} |
309 | 309 |
|
310 |
private void setNamePart(String nameStr, Rank rank, ZoologicalName name) { |
|
310 |
private void setNamePart(String nameStr, Rank rank, IZoologicalName name) {
|
|
311 | 311 |
if (rank != null){ |
312 | 312 |
if (rank.isSupraGeneric() || rank.isGenus()){ |
313 | 313 |
if (StringUtils.isBlank(name.getGenusOrUninomial())){ |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisCurrentSpeciesImport.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; |
32 | 32 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
33 | 33 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
34 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
34 | 35 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 | 36 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
36 | 37 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
... | ... | |
303 | 304 |
* @return |
304 | 305 |
*/ |
305 | 306 |
private boolean compareTaxa(Taxon taxon1, Taxon taxon2) { |
306 |
ZoologicalName name1 = CdmBase.deproxy(taxon1.getName(), ZoologicalName.class);
|
|
307 |
ZoologicalName name2 = CdmBase.deproxy(taxon2.getName(), ZoologicalName.class);
|
|
307 |
IZoologicalName name1 = taxon1.getName();
|
|
308 |
IZoologicalName name2 = taxon2.getName();
|
|
308 | 309 |
if (!name1.getRank().equals(name2.getRank())){ |
309 | 310 |
return false; |
310 | 311 |
} |
... | ... | |
347 | 348 |
String key = keyEpithet + "@" + CdmUtils.Nz(author) + "@" + rank.getTitleCache(); |
348 | 349 |
Taxon taxon = taxonMap.get(key); |
349 | 350 |
if (taxon == null){ |
350 |
ZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank); |
|
351 |
IZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank);
|
|
351 | 352 |
name.setGenusOrUninomial(uninomial); |
352 | 353 |
if (isNotBlank(infraGenericEpi)){ |
353 | 354 |
name.setInfraGenericEpithet(infraGenericEpi); |
... | ... | |
389 | 390 |
String author = rs.getString("dtSpcAutor"); |
390 | 391 |
|
391 | 392 |
|
392 |
ZoologicalName zooName = TaxonNameFactory.NewZoologicalInstance(Rank.SPECIES()); |
|
393 |
IZoologicalName zooName = TaxonNameFactory.NewZoologicalInstance(Rank.SPECIES());
|
|
393 | 394 |
zooName.setSpecificEpithet(speciesEpi); |
394 | 395 |
if (StringUtils.isNotBlank(subGenusEpi)){ |
395 | 396 |
zooName.setInfraGenericEpithet(subGenusEpi); |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImageImport.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
39 | 39 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
40 | 40 |
import eu.etaxonomy.cdm.model.media.Media; |
41 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
41 | 42 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
42 | 43 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
43 | 44 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
161 | 162 |
} |
162 | 163 |
|
163 | 164 |
//try to find specTaxName |
164 |
ZoologicalName specTaxTaxonName = specTaxNameMap.get(String.valueOf(spectaxID)); |
|
165 |
IZoologicalName specTaxTaxonName = specTaxNameMap.get(String.valueOf(spectaxID));
|
|
165 | 166 |
if (specTaxTaxonName != null){ |
166 | 167 |
title = " taxon name " + specTaxTaxonName.getTitleCache(); |
167 | 168 |
}else{ |
... | ... | |
213 | 214 |
|
214 | 215 |
//add to image gallery (discuss if this is also needed if taxon is already added to type specimen |
215 | 216 |
// Taxon taxon = taxonMap.get(String.valueOf(taxonID)); |
216 |
ZoologicalName specTaxTaxonName = specTaxNameMap.get(String.valueOf(spectaxID)); |
|
217 |
IZoologicalName specTaxTaxonName = specTaxNameMap.get(String.valueOf(spectaxID));
|
|
217 | 218 |
|
218 | 219 |
// |
219 | 220 |
// if (taxon == null){ |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportBase.java | ||
---|---|---|
44 | 44 |
import eu.etaxonomy.cdm.model.common.User; |
45 | 45 |
import eu.etaxonomy.cdm.model.location.Country; |
46 | 46 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
47 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
47 |
import eu.etaxonomy.cdm.model.name.IZoologicalName;
|
|
48 | 48 |
import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException; |
49 | 49 |
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; |
50 | 50 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
... | ... | |
112 | 112 |
* @param authorAndYear |
113 | 113 |
* @param zooName |
114 | 114 |
*/ |
115 |
protected void handleAuthorAndYear(String authorAndYear, ZoologicalName zooName, Integer id, GlobisImportState state) { |
|
115 |
protected void handleAuthorAndYear(String authorAndYear, IZoologicalName zooName, Integer id, GlobisImportState state) {
|
|
116 | 116 |
if (isBlank(authorAndYear)){ |
117 | 117 |
return; |
118 | 118 |
}else if ("[Denis & Schifferm\u00FCller], 1775".equals(authorAndYear)){ |
... | ... | |
144 | 144 |
* @param zooName |
145 | 145 |
* @param state |
146 | 146 |
*/ |
147 |
private void handleDenisSchiffermueller(ZoologicalName zooName, |
|
147 |
private void handleDenisSchiffermueller(IZoologicalName zooName,
|
|
148 | 148 |
GlobisImportState state) { |
149 | 149 |
String teamStr = "Denis & Schifferm\u00FCller"; |
150 | 150 |
Team team = state.getTeam(teamStr); |
... | ... | |
159 | 159 |
} |
160 | 160 |
|
161 | 161 |
|
162 |
private void deduplicateAuthors(ZoologicalName zooName, GlobisImportState state) { |
|
162 |
private void deduplicateAuthors(IZoologicalName zooName, GlobisImportState state) {
|
|
163 | 163 |
zooName.setCombinationAuthorship(getExistingAuthor(zooName.getCombinationAuthorship(), state)); |
164 | 164 |
zooName.setExCombinationAuthorship(getExistingAuthor(zooName.getExCombinationAuthorship(), state)); |
165 | 165 |
zooName.setBasionymAuthorship(getExistingAuthor(zooName.getBasionymAuthorship(), state)); |
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisSpecTaxImport.java | ||
---|---|---|
39 | 39 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
40 | 40 |
import eu.etaxonomy.cdm.model.description.Feature; |
41 | 41 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
42 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
42 | 43 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
43 | 44 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
44 | 45 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
... | ... | |
136 | 137 |
Taxon acceptedTaxon = taxonMap.get(String.valueOf(acceptedTaxonId)); |
137 | 138 |
TaxonBase<?> thisTaxon = null; |
138 | 139 |
|
139 |
ZoologicalName name = null; |
|
140 |
IZoologicalName name = null;
|
|
140 | 141 |
if (isBlank(specSystaxRank) ){ |
141 | 142 |
name = makeName(state, rs, specTaxId); |
142 | 143 |
}else if (specSystaxRank.equals("synonym")){ |
... | ... | |
209 | 210 |
|
210 | 211 |
name.addSource(OriginalSourceType.Import, String.valueOf(specTaxId), SPEC_TAX_NAMESPACE, state.getTransactionalSourceReference(), null); |
211 | 212 |
|
212 |
namesToSave.add(name);
|
|
213 |
namesToSave.add(TaxonNameBase.castAndDeproxy(name));
|
|
213 | 214 |
|
214 | 215 |
|
215 | 216 |
} catch (Exception e) { |
... | ... | |
231 | 232 |
} |
232 | 233 |
|
233 | 234 |
|
234 |
private void makeNotAvailable(GlobisImportState state, ResultSet rs, ZoologicalName name, int id) throws SQLException { |
|
235 |
private void makeNotAvailable(GlobisImportState state, ResultSet rs, IZoologicalName name, int id) throws SQLException {
|
|
235 | 236 |
String notAvailableStr = rs.getString("SpecNotAvailable"); |
236 | 237 |
String notAvailableReason = rs.getString("SpecNotAvailableReason"); |
237 | 238 |
|
... | ... | |
300 | 301 |
* @throws SQLException |
301 | 302 |
*/ |
302 | 303 |
@SuppressWarnings("unused") |
303 |
private void makeMarker1(GlobisImportState state, ResultSet rs, ZoologicalName name) throws SQLException { |
|
304 |
private void makeMarker1(GlobisImportState state, ResultSet rs, IZoologicalName name) throws SQLException {
|
|
304 | 305 |
String marker1Str = rs.getString("Marker1"); |
305 | 306 |
try { |
306 | 307 |
if (isNotBlank(marker1Str)){ |
... | ... | |
325 | 326 |
} |
326 | 327 |
|
327 | 328 |
|
328 |
private void addNameDescription(GlobisImportState state, ZoologicalName name, UUID featureUuid, |
|
329 |
private void addNameDescription(GlobisImportState state, IZoologicalName name, UUID featureUuid,
|
|
329 | 330 |
String citedTypeLocality, String featureLabel) { |
330 | 331 |
Feature feature = getFeature(state, featureUuid,featureLabel,featureLabel, null, null); |
331 |
getTaxonNameDescription(name, false, true); |
|
332 |
getTaxonNameDescription((TaxonNameBase<?,?>)name, false, true);
|
|
332 | 333 |
|
333 | 334 |
} |
334 | 335 |
|
... | ... | |
336 | 337 |
private Pattern patternAll = Pattern.compile("(.+,\\s.+)(\\(.+\\))"); |
337 | 338 |
|
338 | 339 |
|
339 |
private void handleTypeInformation(GlobisImportState state, ResultSet rs, ZoologicalName name, Integer specTaxId) throws SQLException { |
|
340 |
private void handleTypeInformation(GlobisImportState state, ResultSet rs, IZoologicalName name, Integer specTaxId) throws SQLException {
|
|
340 | 341 |
if (! hasTypeInformation(rs)){ |
341 | 342 |
return; |
342 | 343 |
} |
... | ... | |
807 | 808 |
* @param specTaxId |
808 | 809 |
* @throws SQLException |
809 | 810 |
*/ |
810 |
protected void makeTypeDesignation(ZoologicalName name, ResultSet rs, DerivedUnit specimen, Integer specTaxId) throws SQLException { |
|
811 |
protected void makeTypeDesignation(IZoologicalName name, ResultSet rs, DerivedUnit specimen, Integer specTaxId) throws SQLException {
|
|
811 | 812 |
//type |
812 | 813 |
String specType = rs.getString("SpecType"); |
813 | 814 |
SpecimenTypeDesignationStatus status = getTypeDesigType(specType, specTaxId); |
... | ... | |
854 | 855 |
* @throws SQLException |
855 | 856 |
*/ |
856 | 857 |
private Reference handleNomRef(GlobisImportState state, Map<String, Reference> referenceMap, ResultSet rs, |
857 |
ZoologicalName name, Integer specTaxId) throws SQLException { |
|
858 |
IZoologicalName name, Integer specTaxId) throws SQLException {
|
|
858 | 859 |
//ref |
859 | 860 |
Integer refId = nullSafeInt(rs, "fiSpecRefID"); |
860 | 861 |
Reference nomRef = null; |
... | ... | |
885 | 886 |
} |
886 | 887 |
|
887 | 888 |
//TODO |
888 |
ZoologicalName name = CdmBase.deproxy(acceptedTaxon.getName(), ZoologicalName.class);
|
|
889 |
IZoologicalName name = acceptedTaxon.getName();
|
|
889 | 890 |
|
890 | 891 |
String specName = rs.getString("SpecName"); |
891 | 892 |
if (! name.getSpecificEpithet().equals(specName)){ |
... | ... | |
898 | 899 |
|
899 | 900 |
|
900 | 901 |
private Synonym getSynonym(GlobisImportState state, ResultSet rs, Integer specTaxId) throws SQLException { |
901 |
ZoologicalName name = makeName(state, rs, specTaxId);
|
|
902 |
TaxonNameBase<?,?> name = (TaxonNameBase<?,?>)makeName(state, rs, specTaxId);
|
|
902 | 903 |
|
903 | 904 |
Synonym synonym = Synonym.NewInstance(name, state.getTransactionalSourceReference()); |
904 | 905 |
|
... | ... | |
915 | 916 |
* @return |
916 | 917 |
* @throws SQLException |
917 | 918 |
*/ |
918 |
protected ZoologicalName makeName(GlobisImportState state, ResultSet rs, Integer specTaxId) |
|
919 |
protected IZoologicalName makeName(GlobisImportState state, ResultSet rs, Integer specTaxId)
|
|
919 | 920 |
throws SQLException { |
920 | 921 |
//rank |
921 | 922 |
String rankStr = rs.getString("SpecRank"); |
... | ... | |
929 | 930 |
} |
930 | 931 |
|
931 | 932 |
//name |
932 |
ZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank); |
|
933 |
IZoologicalName name = TaxonNameFactory.NewZoologicalInstance(rank);
|
|
933 | 934 |
makeNamePartsAndCache(state, rs, rankStr, name); |
934 | 935 |
|
935 | 936 |
|
... | ... | |
945 | 946 |
|
946 | 947 |
|
947 | 948 |
|
948 |
private void makeNamePartsAndCache(GlobisImportState state, ResultSet rs, String rank, ZoologicalName name) throws SQLException { |
|
949 |
private void makeNamePartsAndCache(GlobisImportState state, ResultSet rs, String rank, IZoologicalName name) throws SQLException {
|
|
949 | 950 |
String citedFamily = rs.getString("SpecCitedFamily"); |
950 | 951 |
String citedGenus = rs.getString("SpecCitedGenus"); |
951 | 952 |
String citedSpecies = rs.getString("SpecCitedSpecies"); |
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java | ||
---|---|---|
54 | 54 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
55 | 55 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
56 | 56 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
57 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
57 | 58 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
58 | 59 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
59 | 60 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
... | ... | |
713 | 714 |
} |
714 | 715 |
|
715 | 716 |
|
716 |
private void addSpecimenTypes(BotanicalName taxonName, FieldUnit fieldUnit, String typeStr, TypesName typeName, boolean multiple, String regNumber, SpecimenOrObservationType specimenType){ |
|
717 |
private void addSpecimenTypes(IBotanicalName taxonName, FieldUnit fieldUnit, String typeStr, TypesName typeName, boolean multiple, String regNumber, SpecimenOrObservationType specimenType){
|
|
717 | 718 |
|
718 | 719 |
if(StringUtils.isEmpty(typeStr)){ |
719 | 720 |
return; |
app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/MexicoConabioTaxonImport.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.common.Language; |
33 | 33 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
35 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
35 | 36 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
36 | 37 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
37 | 38 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
38 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
39 | 39 |
import eu.etaxonomy.cdm.model.name.Rank; |
40 | 40 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
41 | 41 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
... | ... | |
303 | 303 |
* @param name |
304 | 304 |
* @param state |
305 | 305 |
*/ |
306 |
private void addSourcesToReferences(BotanicalName name, SimpleExcelTaxonImportState<CONFIG> state) { |
|
306 |
private void addSourcesToReferences(IBotanicalName name, SimpleExcelTaxonImportState<CONFIG> state) {
|
|
307 | 307 |
Reference nomRef = (Reference)name.getNomenclaturalReference(); |
308 | 308 |
if (nomRef != null){ |
309 | 309 |
nomRef.addSource(makeOriginalSource(state)); |
... | ... | |
319 | 319 |
* @param referencedName |
320 | 320 |
* @param refType |
321 | 321 |
*/ |
322 |
private void adaptRefTypeForGeneric(BotanicalName referencedName, String refTypeStr) { |
|
322 |
private void adaptRefTypeForGeneric(IBotanicalName referencedName, String refTypeStr) {
|
|
323 | 323 |
INomenclaturalReference ref = referencedName.getNomenclaturalReference(); |
324 | 324 |
if (ref == null){ |
325 | 325 |
return; |
... | ... | |
404 | 404 |
List<String> propertyPaths = Arrays.asList(""); |
405 | 405 |
List<TaxonNameBase> existingNames = this.getNameService().list(null, null, null, null, propertyPaths); |
406 | 406 |
for (TaxonNameBase tnb : existingNames){ |
407 |
state.putName(tnb.getTitleCache(), (NonViralName<?>)tnb);
|
|
407 |
state.putName(tnb.getTitleCache(), tnb); |
|
408 | 408 |
} |
409 | 409 |
nameMapIsInitialized = true; |
410 | 410 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/SimpleExcelTaxonImportState.java | ||
---|---|---|
11 | 11 |
import java.util.HashMap; |
12 | 12 |
import java.util.Map; |
13 | 13 |
|
14 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
15 | 14 |
import org.apache.log4j.Logger; |
16 | 15 |
|
17 | 16 |
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase; |
18 | 17 |
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState; |
19 | 18 |
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase; |
20 | 19 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
21 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
20 |
import eu.etaxonomy.cdm.model.name.INonViralName;
|
|
22 | 21 |
import eu.etaxonomy.cdm.model.reference.Reference; |
23 | 22 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
24 | 23 |
|
... | ... | |
40 | 39 |
private final Map<String, Taxon> higherTaxonTaxonMap = new HashMap<String, Taxon>(); |
41 | 40 |
|
42 | 41 |
//using titleCache |
43 |
private Map<String, NonViralName<?>> nameMap = new HashMap<>();
|
|
42 |
private Map<String, INonViralName> nameMap = new HashMap<>();
|
|
44 | 43 |
|
45 | 44 |
|
46 | 45 |
// ************************* CONSTRUCTUR *******************************/ |
... | ... | |
81 | 80 |
} |
82 | 81 |
|
83 | 82 |
//names |
84 |
public void putName(String titleCache, NonViralName<?> name){
|
|
83 |
public void putName(String titleCache, INonViralName name){
|
|
85 | 84 |
nameMap.put(titleCache, name); |
86 | 85 |
} |
87 |
public NonViralName<?> getName(String titleCache){
|
|
86 |
public INonViralName getName(String titleCache){
|
|
88 | 87 |
return nameMap.get(titleCache); |
89 | 88 |
} |
90 | 89 |
|
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/RoteListeDbTaxonImport.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.io.common.mapping.IMappingImport; |
27 | 27 |
import eu.etaxonomy.cdm.io.redlist.validation.RoteListeDbTaxonImportValidator; |
28 | 28 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
29 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
29 |
import eu.etaxonomy.cdm.model.name.IBotanicalName;
|
|
30 | 30 |
import eu.etaxonomy.cdm.model.name.Rank; |
31 | 31 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
32 | 32 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
134 | 134 |
|
135 | 135 |
@Override |
136 | 136 |
public TaxonBase createObject(ResultSet rs, RoteListeDbImportState state) throws SQLException { |
137 |
BotanicalName speciesName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
137 |
IBotanicalName speciesName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
138 | 138 |
|
139 | 139 |
// Reference sec = state.getConfig().getSourceReference(); |
140 | 140 |
// getReferenceService().saveOrUpdate(sec); |
... | ... | |
158 | 158 |
// if (StringUtils.isNotBlank(familyString)){ |
159 | 159 |
// familyTaxon = getHigherTaxon(state, familyString, null); |
160 | 160 |
// if (familyTaxon == null){ |
161 |
// BotanicalName familyName = TaxonNameFactory.NewBotanicalInstance(Rank.FAMILY());
|
|
161 |
// TaxonNameBase<?,?> familyName = TaxonNameFactory.NewBotanicalInstance(Rank.FAMILY());
|
|
162 | 162 |
// familyName.setGenusOrUninomial(familyString); |
163 | 163 |
// familyTaxon = Taxon.NewInstance(familyName, sec); |
164 | 164 |
// saveHigherTaxon(state, familyTaxon, familyString, null); |
... | ... | |
170 | 170 |
// //genus |
171 | 171 |
// Taxon genusTaxon = getHigherTaxon(state, familyString, genusString); |
172 | 172 |
// if (genusTaxon == null){ |
173 |
// BotanicalName genusName = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS());
|
|
173 |
// TaxonNameBase<?,?> genusName = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS());
|
|
174 | 174 |
// genusName.setGenusOrUninomial(genusString); |
175 | 175 |
// genusTaxon = Taxon.NewInstance(genusName, sec); |
176 | 176 |
// saveHigherTaxon(state, genusTaxon, familyString, genusString); |
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/bfnXml/in/BfnXmlImportTaxonName.java | ||
---|---|---|
45 | 45 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
46 | 46 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
47 | 47 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
48 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
49 | 48 |
import eu.etaxonomy.cdm.model.name.Rank; |
50 | 49 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
51 | 50 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
765 | 764 |
* @return |
766 | 765 |
* @throws UnknownCdmTypeException |
767 | 766 |
*/ |
768 |
private TaxonNameBase<?, ?> parseNonviralNames(Rank rank, String strAuthor, String strSupplement, Element elWissName)
|
|
767 |
private TaxonNameBase<?,?> parseNonviralNames(Rank rank, String strAuthor, String strSupplement, Element elWissName) |
|
769 | 768 |
throws UnknownCdmTypeException { |
770 | 769 |
TaxonNameBase<?,?> taxonNameBase = null; |
771 | 770 |
|
... | ... | |
784 | 783 |
if(strSupplement != null && !strSupplement.isEmpty()){ |
785 | 784 |
strScientificName = StringUtils.remove(strScientificName, strSupplement); |
786 | 785 |
} |
787 |
NonViralName<?> nonViralName = null; |
|
788 | 786 |
NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance(); |
789 |
nonViralName = parser.parseFullName(strScientificName, nomenclaturalCode, rank);
|
|
787 |
TaxonNameBase<?,?> nonViralName = (TaxonNameBase<?,?>)parser.parseFullName(strScientificName, nomenclaturalCode, rank);
|
|
790 | 788 |
if(nonViralName.hasProblem()){ |
791 | 789 |
for(ParserProblem p:nonViralName.getParsingProblems()){ |
792 | 790 |
logger.warn(++parsingProblemCounter + " " +nonViralName.getTitleCache() +" "+p.toString()); |
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/bfnXml/out/BfnXmlTaxonNameExport.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.model.description.StateData; |
35 | 35 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
36 | 36 |
import eu.etaxonomy.cdm.model.description.TextData; |
37 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
37 |
import eu.etaxonomy.cdm.model.name.INonViralName;
|
|
38 | 38 |
import eu.etaxonomy.cdm.model.name.Rank; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
40 | 40 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
241 | 241 |
Element wissName = new Element(BfnXmlConstants.EL_WISSNAME); |
242 | 242 |
parent.addContent(wissName); |
243 | 243 |
|
244 |
NonViralName<?> name = HibernateProxyHelper.deproxy(taxon.getName(), NonViralName.class);
|
|
244 |
INonViralName name = taxon.getName();
|
|
245 | 245 |
Rank rank = name.getRank(); |
246 | 246 |
//epithet 1,2,3 |
247 | 247 |
exportEpithet(taxon, wissName, name, rank); |
... | ... | |
267 | 267 |
addNanteil(wissName, BfnXmlConstants.BEREICH_WISSNAME, name.getTitleCache()); |
268 | 268 |
} |
269 | 269 |
|
270 |
private void exportEpithet(TaxonBase<?> taxon, Element wissName, NonViralName<?> name, Rank rank) {
|
|
270 |
private void exportEpithet(TaxonBase<?> taxon, Element wissName, INonViralName name, Rank rank) {
|
|
271 | 271 |
//eindeutiger Code |
272 | 272 |
Set<IdentifiableSource> sources = taxon.getSources(); |
273 | 273 |
for (IdentifiableSource identifiableSource : sources) { |
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary; |
39 | 39 |
import eu.etaxonomy.cdm.model.description.CommonTaxonName; |
40 | 40 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
41 |
import eu.etaxonomy.cdm.model.name.CultivarPlantName; |
|
41 |
import eu.etaxonomy.cdm.model.name.ICultivarPlantName; |
|
42 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
43 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
|
42 | 44 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
43 | 45 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
44 | 46 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
45 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
46 | 47 |
import eu.etaxonomy.cdm.model.name.Rank; |
47 | 48 |
import eu.etaxonomy.cdm.model.name.RankClass; |
48 | 49 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
... | ... | |
128 | 129 |
@Override |
129 | 130 |
public boolean doPartition(ResultSetPartitioner partitioner, RedListGefaesspflanzenImportState state) { |
130 | 131 |
ResultSet rs = partitioner.getResultSet(); |
131 |
Set<TaxonNameBase> namesToSave = new HashSet<TaxonNameBase>();
|
|
132 |
Set<TaxonBase> taxaToSave = new HashSet<TaxonBase>();
|
|
132 |
Set<ITaxonNameBase> namesToSave = new HashSet<>();
|
|
133 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
|
133 | 134 |
try { |
134 | 135 |
while (rs.next()){ |
135 | 136 |
makeSingleNameAndTaxon(state, rs, namesToSave, taxaToSave); |
... | ... | |
139 | 140 |
e.printStackTrace(); |
140 | 141 |
} |
141 | 142 |
|
142 |
getNameService().saveOrUpdate(namesToSave);
|
|
143 |
getNameService().saveOrUpdate(TaxonNameBase.castAndDeproxy(namesToSave));
|
|
143 | 144 |
getTaxonService().saveOrUpdate(taxaToSave); |
144 | 145 |
return true; |
145 | 146 |
} |
146 | 147 |
|
147 |
private void makeSingleNameAndTaxon(RedListGefaesspflanzenImportState state, ResultSet rs, Set<TaxonNameBase> namesToSave, Set<TaxonBase> taxaToSave) |
|
148 |
private void makeSingleNameAndTaxon(RedListGefaesspflanzenImportState state, ResultSet rs, Set<ITaxonNameBase> namesToSave, Set<TaxonBase> taxaToSave)
|
|
148 | 149 |
throws SQLException { |
149 | 150 |
long id = rs.getLong(RedListUtil.NAMNR); |
150 | 151 |
String relationE = rs.getString(RedListUtil.E); |
... | ... | |
157 | 158 |
String relationS = rs.getString(RedListUtil.S); |
158 | 159 |
|
159 | 160 |
//---NAME--- |
160 |
NonViralName<?> name = importName(state, rs, namesToSave);
|
|
161 |
INonViralName name = importName(state, rs, namesToSave);
|
|
161 | 162 |
|
162 | 163 |
|
163 | 164 |
//--- AUTHORS --- |
... | ... | |
205 | 206 |
} |
206 | 207 |
} |
207 | 208 |
|
208 |
private TaxonBase<?> importTaxon(ResultSet rs, NonViralName<?> name, RedListGefaesspflanzenImportState state) throws SQLException {
|
|
209 |
private TaxonBase<?> importTaxon(ResultSet rs, INonViralName name, RedListGefaesspflanzenImportState state) throws SQLException {
|
|
209 | 210 |
|
210 | 211 |
long id = rs.getLong(RedListUtil.NAMNR); |
211 | 212 |
String taxNameString = rs.getString(RedListUtil.TAXNAME); |
... | ... | |
259 | 260 |
return taxonBase; |
260 | 261 |
} |
261 | 262 |
|
262 |
private void importAuthors(RedListGefaesspflanzenImportState state, ResultSet rs, NonViralName<?> name) throws SQLException {
|
|
263 |
private void importAuthors(RedListGefaesspflanzenImportState state, ResultSet rs, INonViralName name) throws SQLException {
|
|
263 | 264 |
|
264 | 265 |
long id = rs.getLong(RedListUtil.NAMNR); |
265 | 266 |
String nomZusatzString = rs.getString(RedListUtil.NOM_ZUSATZ); |
... | ... | |
322 | 323 |
checkNameConsistency(id, nomZusatzString, taxZusatzString, zusatzString, authorString, hybString, name); |
323 | 324 |
} |
324 | 325 |
|
325 |
private NonViralName<?> importName(RedListGefaesspflanzenImportState state, ResultSet rs, Set<TaxonNameBase> namesToSave) throws SQLException {
|
|
326 |
private INonViralName importName(RedListGefaesspflanzenImportState state, ResultSet rs, Set<ITaxonNameBase> namesToSave) throws SQLException {
|
|
326 | 327 |
|
327 | 328 |
long id = rs.getLong(RedListUtil.NAMNR); |
328 | 329 |
String taxNameString = rs.getString(RedListUtil.TAXNAME); |
... | ... | |
338 | 339 |
RedListUtil.logMessage(id, "No name found!", logger); |
339 | 340 |
} |
340 | 341 |
|
341 |
NonViralName<?> name = null;
|
|
342 |
INonViralName name = null;
|
|
342 | 343 |
Rank rank = makeRank(id, state, rangString, CdmUtils.isNotBlank(ep3String)); |
343 | 344 |
//cultivar |
344 | 345 |
if(rank!= null && rank.equals(Rank.CULTIVAR())){ |
345 |
CultivarPlantName cultivar = TaxonNameFactory.NewCultivarInstance(rank); |
|
346 |
ICultivarPlantName cultivar = TaxonNameFactory.NewCultivarInstance(rank);
|
|
346 | 347 |
cultivar.setGenusOrUninomial(ep1String); |
347 | 348 |
cultivar.setSpecificEpithet(ep2String); |
348 | 349 |
cultivar.setCultivarName(ep3String); |
... | ... | |
482 | 483 |
} |
483 | 484 |
|
484 | 485 |
private void checkNameConsistency(long id, String nomZusatzString, String taxZusatzString, |
485 |
String zusatzString, String authorString, String hybString, NonViralName<?> name) {
|
|
486 |
String zusatzString, String authorString, String hybString, INonViralName name) {
|
|
486 | 487 |
String authorshipCache = name.getAuthorshipCache(); |
487 | 488 |
//FIXME: remove split length check when name parser can parse multiple hybrid parents |
488 | 489 |
if(hybString.equals(RedListUtil.HYB_XF) && name.getTitleCache().split(RedListUtil.HYB_SIGN).length==2){ |
... | ... | |
526 | 527 |
return; |
527 | 528 |
} |
528 | 529 |
|
529 |
String nameCache = HibernateProxyHelper.deproxy(taxonBase.getName(), NonViralName.class).getNameCache().trim();
|
|
530 |
String nameCache = taxonBase.getName().getNameCache().trim();
|
|
530 | 531 |
taxNameString = taxNameString.trim(); |
531 | 532 |
taxNameString = taxNameString.replaceAll(" +", " "); |
532 | 533 |
|
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/germanSL/GermanSLTaxonImport.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.location.Country; |
32 | 32 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
33 | 33 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
34 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
35 | 34 |
import eu.etaxonomy.cdm.model.name.Rank; |
36 | 35 |
import eu.etaxonomy.cdm.model.name.RankClass; |
37 | 36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
... | ... | |
401 | 400 |
List<String> propertyPaths = Arrays.asList(""); |
402 | 401 |
List<TaxonNameBase> existingNames = this.getNameService().list(null, null, null, null, propertyPaths); |
403 | 402 |
for (TaxonNameBase tnb : existingNames){ |
404 |
state.putName(tnb.getTitleCache(), (NonViralName<?>)tnb);
|
|
403 |
state.putName(tnb.getTitleCache(), tnb); |
|
405 | 404 |
} |
406 | 405 |
nameMapIsInitialized = true; |
407 | 406 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/wp6/CommonNameRow.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
19 | 19 |
import org.apache.commons.lang.StringUtils; |
20 | 20 |
import org.apache.log4j.Logger; |
21 | 21 |
|
22 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
22 |
import eu.etaxonomy.cdm.model.name.IBotanicalName;
|
|
23 | 23 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
24 | 24 |
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; |
25 | 25 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
... | ... | |
37 | 37 |
private String reference; |
38 | 38 |
private String area; |
39 | 39 |
private String nameUsedInSource; |
40 |
|
|
40 |
|
|
41 | 41 |
private Map<String, List<String>> commonNames = new HashMap<String, List<String>>(); |
42 |
|
|
43 |
|
|
42 |
|
|
43 |
|
|
44 | 44 |
public CommonNameRow() { |
45 | 45 |
this.species = ""; |
46 | 46 |
this.reference = ""; |
47 | 47 |
this.area = ""; |
48 | 48 |
commonNames = new HashMap<String, List<String>>(); |
49 | 49 |
} |
50 |
|
|
51 |
// **************************** GETTER / SETTER *********************************/
|
|
52 |
|
|
50 |
|
|
51 |
// **************************** GETTER / SETTER *********************************/ |
|
52 |
|
|
53 | 53 |
public void setCommonNames(String commonNamesString){ |
54 | 54 |
commonNamesString = makeNameUsedInSource(commonNamesString); |
55 | 55 |
String[] split = commonNamesString.split(";"); |
... | ... | |
87 | 87 |
} |
88 | 88 |
} |
89 | 89 |
} |
90 |
|
|
90 |
|
|
91 | 91 |
private String makeNameUsedInSource(String commonNamesString) { |
92 | 92 |
String[] split = commonNamesString.split(":"); |
93 | 93 |
if (split.length > 1){ |
... | ... | |
105 | 105 |
public Map<String, List<String>> getCommonNames() { |
106 | 106 |
return commonNames; |
107 | 107 |
} |
108 |
|
|
108 |
|
|
109 | 109 |
public void parseSpecies(String species){ |
110 |
INonViralNameParser parser = NonViralNameParserImpl.NewInstance(); |
|
111 |
BotanicalName name = (BotanicalName)parser.parseFullName(species, NomenclaturalCode.ICNAFP, null);
|
|
110 |
INonViralNameParser<?> parser = NonViralNameParserImpl.NewInstance();
|
|
111 |
IBotanicalName name = (IBotanicalName)parser.parseFullName(species, NomenclaturalCode.ICNAFP, null);
|
|
112 | 112 |
if (name.isProtectedTitleCache()){ |
113 | 113 |
logger.warn("Name could not be parsed: " + species); |
114 | 114 |
} |
... | ... | |
118 | 118 |
public String getSpecies() { |
119 | 119 |
return species; |
120 | 120 |
} |
121 |
|
|
121 |
|
|
122 | 122 |
public void setSpecies(String species) { |
123 | 123 |
this.species = species; |
124 | 124 |
} |
... | ... | |
138 | 138 |
public void setArea(String area) { |
139 | 139 |
this.area = area; |
140 | 140 |
} |
141 |
|
|
141 |
|
|
142 | 142 |
public String getArea() { |
143 | 143 |
return area; |
144 | 144 |
} |
... | ... | |
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
|
155 |
|
|
155 |
|
|
156 | 156 |
} |
app-import/src/test/java/eu/etaxonomy/cdm/app/util/TestTransaction.java | ||
---|---|---|
17 | 17 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
18 | 18 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
19 | 19 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
20 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
20 |
import eu.etaxonomy.cdm.model.name.IBotanicalName;
|
|
21 | 21 |
import eu.etaxonomy.cdm.model.name.Rank; |
22 | 22 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
23 | 23 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
64 | 64 |
System.exit(1); |
65 | 65 |
} |
66 | 66 |
|
67 |
BotanicalName name1, name2; |
|
67 |
IBotanicalName name1, name2;
|
|
68 | 68 |
Rank rankSpecies = Rank.SPECIES(); |
69 | 69 |
Taxon taxon1, taxon2, child1, child2; |
70 | 70 |
|
... | ... | |
142 | 142 |
System.exit(1); |
143 | 143 |
} |
144 | 144 |
|
145 |
BotanicalName name1, name2; |
|
145 |
IBotanicalName name1, name2;
|
|
146 | 146 |
Rank rankSpecies = Rank.SPECIES(); |
147 | 147 |
Taxon taxon1, taxon2, child1, child2; |
148 | 148 |
|
... | ... | |
241 | 241 |
System.exit(1); |
242 | 242 |
} |
243 | 243 |
|
244 |
BotanicalName name1, name1_; |
|
244 |
IBotanicalName name1, name1_;
|
|
245 | 245 |
Rank rankSpecies = Rank.SPECIES(); |
246 | 246 |
Taxon taxon1; |
247 | 247 |
TaxonBase taxon1_; |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/io/eflora/EfloraTaxonImport.java | ||
---|---|---|
56 | 56 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
57 | 57 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
58 | 58 |
import eu.etaxonomy.cdm.model.description.TextData; |
59 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
60 | 59 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
60 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
61 | 61 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
62 | 62 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
63 | 63 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
... | ... | |
151 | 151 |
logger.warn("body has element other than 'taxon'"); |
152 | 152 |
} |
Also available in: Unified diff
ref #6362, ref #6365 remove occurrences of NonViralName, BotanicalName and ZoologicalName in cdmlib-app