Project

General

Profile

« Previous | Next » 

Revision 744bd412

Added by Andreas Müller about 4 years ago

ref #8509 improve tagged names handling in PESI export (ERMS and others)

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java
1397 1397
					addRule(TagEnum.nomStatus, "@status@");
1398 1398

  
1399 1399
			String result;
1400
			if (getSources(taxonName).contains(PesiSource.ERMS)){
1401
			    result = cacheStrategy.getTitleCache(taxonName, tagRules);  //according to SQL script (also in ERMS sources are not abbreviated)
1402
			}else if (getSources(taxonName).contains(PesiSource.EM)){
1403
			    if (useNameCache){
1404
			        result = cacheStrategy.getNameCache(taxonName, tagRules);
1405
			    }else{
1400
			if (useNameCache){
1401
                result = cacheStrategy.getNameCache(taxonName, tagRules);
1402
			}else{
1403
			    EnumSet<PesiSource> sources = getSources(taxonName);
1404
			    if (sources.contains(PesiSource.ERMS)){
1405
			        result = cacheStrategy.getTitleCache(taxonName, tagRules);  //according to SQL script (also in ERMS sources are not abbreviated)
1406
			    }else if (sources.contains(PesiSource.FE) || sources.contains(PesiSource.IF)){
1407
			        //TODO define for FE + IF and for multiple sources
1406 1408
			        result = cacheStrategy.getFullTitleCache(taxonName, tagRules);
1409
			    }else if (sources.contains(PesiSource.EM)){
1410
			        result = cacheStrategy.getFullTitleCache(taxonName, tagRules);
1411
			    }else{
1412
			        logger.warn("Source not yet handled");
1413
			        result = cacheStrategy.getTitleCache(taxonName, tagRules);
1407 1414
			    }
1408
			}else{
1409
			    //TODO define for FE + IF and for multiple sources
1410
	             if (useNameCache){
1411
                    result = cacheStrategy.getNameCache(taxonName, tagRules);
1412
                }else{
1413
                    result = cacheStrategy.getFullTitleCache(taxonName, tagRules);
1414
                }
1415
			    result = replaceTagForInfraSpecificMarkerForProtectedTitleCache(taxonName, result);
1416
			    result = result.replaceAll("(, ?)?\\<@status@\\>.*\\</@status@\\>", "").trim();
1415 1417
			}
1416
			return result.replaceAll("(, ?)?\\<@status@\\>.*\\</@status@\\>", "").trim();
1418
            return result;
1417 1419
		}
1418 1420
	}
1419 1421

  
......
1461 1463

  
1462 1464
			HTMLTagRules tagRules = new HTMLTagRules().addRule(TagEnum.name, "i");
1463 1465
			String result = cacheStrategy.getTitleCache(taxonName, tagRules);
1466
			result = replaceTagForInfraSpecificMarkerForProtectedTitleCache(taxonName, result);
1464 1467
			return result;
1465 1468
		}
1466 1469
	}
1467 1470

  
1468
	/**
1471
    private static String replaceTagForInfraSpecificMarkerForProtectedTitleCache(TaxonName taxonName, String result) {
1472
        if (taxonName.isProtectedTitleCache()||taxonName.isProtectedNameCache()){
1473
            if (!taxonName.isAutonym()){
1474
                result = result
1475
                        .replace(" subsp. ", "</i> subsp. <i>")
1476
                        .replace(" var. ", "</i> var. <i>")
1477
                        .replace(" subvar. ", "</i> subvar. <i>")
1478
                        .replace(" f. ", "</i> f. <i>")
1479
                        .replace(" subf. ", "</i> subf. <i>")  //does this exist?
1480
                        ;
1481
            }
1482
        }
1483
        return result;
1484
    }
1485

  
1486
    /**
1469 1487
	 * Returns the <code>WebSearchName</code> attribute.
1470 1488
	 * @param taxonName The {@link NonViralName NonViralName}.
1471 1489
	 * @return The <code>WebSearchName</code> attribute.

Also available in: Unified diff