Project

General

Profile

« Previous | Next » 

Revision 86536e03

Added by Andreas Müller almost 7 years ago

fix #6368 rename table and class TaxonNameBase in app-import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/MexicoConabioTaxonImport.java
31 31
import eu.etaxonomy.cdm.model.common.ExtensionType;
32 32
import eu.etaxonomy.cdm.model.common.Language;
33 33
import eu.etaxonomy.cdm.model.common.TimePeriod;
34
import eu.etaxonomy.cdm.model.name.BotanicalName;
35 34
import eu.etaxonomy.cdm.model.name.IBotanicalName;
36 35
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
37 36
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
38 37
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
39 38
import eu.etaxonomy.cdm.model.name.Rank;
40
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
39
import eu.etaxonomy.cdm.model.name.TaxonName;
41 40
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
42 41
import eu.etaxonomy.cdm.model.reference.Reference;
43 42
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
......
116 115
        }
117 116

  
118 117
        //Name
119
        BotanicalName speciesName = makeName(line, record, state);
118
        IBotanicalName speciesName = makeName(line, record, state);
120 119

  
121 120
        //sec
122 121
        String secRefStr = getValueNd(record, "ReferenciaNombre");
......
220 219
     * @param state
221 220
     * @return
222 221
     */
223
    private BotanicalName makeName(String line, HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state) {
222
    private IBotanicalName makeName(String line, HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state) {
224 223

  
225 224
        String authorStr = getValueNd(record, "AutorSinAnio");
226 225
        String nameStr = getValue(record, "Nombre");
......
245 244
        //name + author
246 245
        String fullNameStr = nameStr + (authorStr != null ? " " + authorStr : "");
247 246

  
248
        BotanicalName fullName = (BotanicalName)nameParser.parseFullName(fullNameStr, NomenclaturalCode.ICNAFP, rank);
247
        IBotanicalName fullName = (IBotanicalName)nameParser.parseFullName(fullNameStr, NomenclaturalCode.ICNAFP, rank);
249 248
        if (fullName.isProtectedTitleCache()){
250 249
            logger.warn(line + "Name could not be parsed: " + fullNameStr );
251 250
        }else{
252 251
            replaceAuthorNamesAndNomRef(state, fullName);
253 252
        }
254
        BotanicalName existingName = getExistingName(state, fullName);
253
        IBotanicalName existingName = getExistingName(state, fullName);
255 254

  
256 255
        //reference
257 256
        String refNameStr = getRefNameStr(nomRefStr, refType, fullNameStr);
258 257

  
259
        BotanicalName referencedName = (BotanicalName)nameParser.parseReferencedName(refNameStr, NomenclaturalCode.ICNAFP, rank);
258
        IBotanicalName referencedName = (IBotanicalName)nameParser.parseReferencedName(refNameStr, NomenclaturalCode.ICNAFP, rank);
260 259
        if (referencedName.isProtectedFullTitleCache() || referencedName.isProtectedTitleCache()){
261 260
            logger.warn(line + "Referenced name could not be parsed: " + refNameStr );
262 261
        }else{
......
266 265
        adaptRefTypeForGeneric(referencedName, refType);
267 266

  
268 267
        //compare nom. ref. with Borhidi
269
        BotanicalName result= referencedName;
268
        IBotanicalName result= referencedName;
270 269
        Boolean equal = null;
271 270
        if (existingName != null){
272 271
            String existingRefTitle = existingName.getFullTitleCache();
......
367 366
     * @param equal
368 367
     * @param referencedName
369 368
     */
370
    private void addNomRefExtension(SimpleExcelTaxonImportState<CONFIG> state, BotanicalName name, Boolean equal) {
369
    private void addNomRefExtension(SimpleExcelTaxonImportState<CONFIG> state, IBotanicalName name, Boolean equal) {
371 370
        String equalStr = equal == null ? "" : equal == true ? "EQUAL\n" : "NOT EQUAL\n";
372 371
        name.setFullTitleCache(null, false);
373 372
        String newExtensionStr = name.getFullTitleCache() + " - CONABIO";
......
381 380
        String label = "Nomenclatural reference in Sources";
382 381
        String abbrev = "Nom. ref. src.";
383 382
        ExtensionType extensionType = getExtensionType(state, uuidNomRefExtension, label, label, abbrev);
384
        Extension.NewInstance(name, newExtensionStr, extensionType);
383
        Extension.NewInstance((TaxonName)name, newExtensionStr, extensionType);
385 384
    }
386 385

  
387 386
    boolean nameMapIsInitialized = false;
......
390 389
     * @param fullName
391 390
     * @return
392 391
     */
393
    private BotanicalName getExistingName(SimpleExcelTaxonImportState<CONFIG> state, BotanicalName fullName) {
392
    private IBotanicalName getExistingName(SimpleExcelTaxonImportState<CONFIG> state, IBotanicalName fullName) {
394 393
        initExistinNames(state);
395
        return (BotanicalName)state.getName(fullName.getTitleCache());
394
        return (IBotanicalName)state.getName(fullName.getTitleCache());
396 395
    }
397 396

  
398 397
    /**
......
402 401
    private void initExistinNames(SimpleExcelTaxonImportState<CONFIG> state) {
403 402
        if (!nameMapIsInitialized){
404 403
            List<String> propertyPaths = Arrays.asList("");
405
            List<TaxonNameBase> existingNames = this.getNameService().list(null, null, null, null, propertyPaths);
406
            for (TaxonNameBase tnb : existingNames){
404
            List<TaxonName> existingNames = this.getNameService().list(null, null, null, null, propertyPaths);
405
            for (TaxonName tnb : existingNames){
407 406
                state.putName(tnb.getTitleCache(), tnb);
408 407
            }
409 408
            nameMapIsInitialized = true;
......
469 468
     * @param line
470 469
     * @param name
471 470
     */
472
    private void makeConceptRelation(String line, TaxonNameBase<?,?> name) {
471
    private void makeConceptRelation(String line, TaxonName<?,?> name) {
473 472
        if (name.getTaxonBases().size()==2){
474 473
            Iterator<TaxonBase> it = name.getTaxonBases().iterator();
475 474
            Taxon taxon1 = getAccepted(it.next());

Also available in: Unified diff