Project

General

Profile

« Previous | Next » 

Revision 32f02929

Added by Andreas Müller over 10 years ago

improved implementation for NomRef and WebShowName

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java
64 64
import eu.etaxonomy.cdm.model.name.Rank;
65 65
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
66 66
import eu.etaxonomy.cdm.model.name.ZoologicalName;
67
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
67 68
import eu.etaxonomy.cdm.model.reference.Reference;
68 69
import eu.etaxonomy.cdm.model.taxon.Classification;
69 70
import eu.etaxonomy.cdm.model.taxon.Synonym;
......
1307 1308
	 * @return The <code>WebShowName</code> attribute.
1308 1309
	 * @see MethodMapper
1309 1310
	 */
1310
	@SuppressWarnings("unused")
1311 1311
	private static String getWebShowName(TaxonNameBase<?,?> taxonName) {
1312 1312
		//TODO extensions?
1313 1313
		if (taxonName == null) {
......
1321 1321
		}
1322 1322
	}
1323 1323

  
1324
	/**
1325
	 * Returns the <code>WebShowName</code> attribute for a taxon.
1326
	 * @param taxonName The {@link TaxonNameBase TaxonName}.
1327
	 * @return The <code>WebShowName</code> attribute.
1328
	 * @see MethodMapper
1329
	 */
1330
	@SuppressWarnings("unused")
1331
	private static String getWebShowName(TaxonBase<?> taxon) {
1332
		TaxonNameBase<?,?> taxonName = taxon.getName();
1333
		String result = getWebSearchName(taxonName);
1334
		if (isMisappliedName(taxon)){
1335
			result = result + " " + getAuthorString(taxon);
1336
		}
1337
		return result;
1338
	}
1339

  
1340
	
1324 1341
	/**
1325 1342
	 * Returns the <code>WebSearchName</code> attribute.
1326 1343
	 * @param taxonName The {@link NonViralName NonViralName}.
......
1352 1369
	}
1353 1370

  
1354 1371
	
1372
	/**
1373
	 * Returns the nomenclatural reference which is the reference
1374
	 * including the detail (microreference).
1375
	 * @param taxonName The {@link TaxonNameBase TaxonName}.
1376
	 * @return The <code>AuthorString</code> attribute.
1377
	 * @see MethodMapper
1378
	 */
1379
	@SuppressWarnings("unused")
1380
	private static String getNomRefString(TaxonNameBase<?,?> taxonName) {
1381
		INomenclaturalReference ref = taxonName.getNomenclaturalReference();
1382
		return ref == null ? null : ref.getNomenclaturalCitation(taxonName.getNomenclaturalMicroReference());
1383
	}
1384
	
1385
	
1355 1386
	/**
1356 1387
	 * Returns the <code>AuthorString</code> attribute.
1357 1388
	 * @param taxonName The {@link TaxonNameBase TaxonName}.
......
1377 1408
					String secTitle = taxon.getSec().getTitleCache();
1378 1409
					if (! secTitle.startsWith("auct")){
1379 1410
						secTitle = "sensu " + secTitle;
1411
					}else if (secTitle.equals("auct")){  //may be removed once the title cache is generated correctly for references with title auct. #
1412
						secTitle = "auct.";
1380 1413
					}
1381 1414
					return secTitle;
1382 1415
				}else if (StringUtils.isBlank(authorshipCache)) {
......
2223 2256
		mapping.addMapper(MethodMapper.NewInstance("DerivedFromGuid", this));
2224 2257
		mapping.addMapper(MethodMapper.NewInstance("CacheCitation", this));
2225 2258
		mapping.addMapper(MethodMapper.NewInstance("AuthorString", this));  //For Taxon because Misallied Names are handled differently
2259
		mapping.addMapper(MethodMapper.NewInstance("WebShowName", this));
2226 2260
		
2227 2261
		//handled by name mapping
2228 2262
		mapping.addMapper(DbLastActionMapper.NewInstance("LastActionDate", false));
......
2264 2298
		mapping.addMapper(DbConstantMapper.NewInstance("TaxonStatusFk", Types.INTEGER , PesiTransformer.T_STATUS_UNACCEPTED));
2265 2299
		mapping.addMapper(DbConstantMapper.NewInstance("TaxonStatusCache", Types.VARCHAR , PesiTransformer.T_STATUS_STR_UNACCEPTED));
2266 2300
		mapping.addMapper(DbStringMapper.NewInstance("AuthorshipCache", "AuthorString").setBlankToNull(true));  
2301
		mapping.addMapper(MethodMapper.NewInstance("WebShowName", this, TaxonNameBase.class));
2302
		
2267 2303
		
2268 2304
		mapping.addMapper(DbLastActionMapper.NewInstance("LastActionDate", false));
2269 2305
		mapping.addMapper(DbLastActionMapper.NewInstance("LastAction", true));
......
2288 2324
		mapping.addMapper(MethodMapper.NewInstance("FullName", this, TaxonNameBase.class));
2289 2325
		
2290 2326
		
2291
		//TODO FIXME incorrect mapping -> should be ref +  microref but is only microref
2292
		mapping.addMapper(DbStringMapper.NewInstance("NomenclaturalMicroReference", "NomRefString"));
2293
		mapping.addMapper(MethodMapper.NewInstance("WebShowName", this, TaxonNameBase.class));
2327
		mapping.addMapper(MethodMapper.NewInstance("NomRefString", this, TaxonNameBase.class));
2294 2328
		
2295 2329
		// DisplayName
2296 2330
		extensionType = (ExtensionType)getTermService().find(ErmsTransformer.uuidDisplayName);		

Also available in: Unified diff