Project

General

Profile

« Previous | Next » 

Revision cf050dc5

Added by Andreas Müller almost 10 years ago

PESI: resting abbrevTitle, GUID Mapping for Names, SourceNameCache for AdditionalSourceMapping, revert TaxonId mapping

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java
1583 1583
		}
1584 1584
	}
1585 1585
	
1586
	@SuppressWarnings("unused")
1587
	private static String getGUID(TaxonNameBase<?,?> taxonName) {
1588
		UUID uuid = taxonName.getUuid();
1589
		String result = "NameUUID:" + uuid.toString();
1590
		return result;
1591
	}
1592
	
1586 1593

  
1587 1594
	/**
1588 1595
	 * Returns the <code>WebShowName</code> attribute for a taxon.
......
1667 1674
		return result;
1668 1675
	}
1669 1676
	
1677
	/**
1678
	 * Returns the SourceNameCache for the AdditionalSource table
1679
	 * @param taxonName
1680
	 * @return
1681
	 */
1682
	@SuppressWarnings("unused")
1683
	private static String getSourceNameCache(TaxonNameBase taxonName) {
1684
		NonViralName<?> nvn = CdmBase.deproxy(taxonName, NonViralName.class);
1685
		if (nvn != null){
1686
			Reference<?> nomRef = (Reference)nvn.getNomenclaturalReference();
1687
			if (nomRef != null){
1688
				return nomRef.getAbbrevTitleCache();
1689
			}
1690
			
1691
		}
1692
		return null;
1693
	}
1694
	
1695
	
1696
	
1670 1697
	/**
1671 1698
	 * Returns the <code>FullName</code> attribute.
1672 1699
	 * @param taxon The {@link TaxonBase taxon}.
......
1696 1723
	@SuppressWarnings("unused")
1697 1724
	private static String getNomRefString(TaxonNameBase<?,?> taxonName) {
1698 1725
		INomenclaturalReference ref = taxonName.getNomenclaturalReference();
1699
		return ref == null ? null : ref.getNomenclaturalCitation(taxonName.getNomenclaturalMicroReference());
1726
		if (ref == null){
1727
			return null;
1728
		}
1729
		if (! ref.isProtectedAbbrevTitleCache()){
1730
			ref.setAbbrevTitleCache(null, false);  //to remove a false cache
1731
		}
1732
		return ref.getNomenclaturalCitation(taxonName.getNomenclaturalMicroReference());
1700 1733
	}
1701 1734
	
1702 1735

  
......
2525 2558
	private PesiExportMapping getMapping() {
2526 2559
		PesiExportMapping mapping = new PesiExportMapping(dbTableName);
2527 2560
		
2528
		//mapping.addMapper(IdMapper.NewInstance("TaxonId"));
2561
		mapping.addMapper(IdMapper.NewInstance("TaxonId"));
2529 2562
		mapping.addMapper(DbObjectMapper.NewInstance("sec", "sourceFk")); //OLD:mapping.addMapper(MethodMapper.NewInstance("SourceFK", this.getClass(), "getSourceFk", standardMethodParameter, PesiExportState.class));
2530 2563
		mapping.addMapper(MethodMapper.NewInstance("TaxonStatusFk", this.getClass(), "getTaxonStatusFk", standardMethodParameter, PesiExportState.class));
2531 2564
		mapping.addMapper(MethodMapper.NewInstance("TaxonStatusCache", this.getClass(), "getTaxonStatusCache", standardMethodParameter, PesiExportState.class));
......
2582 2615
		mapping.addMapper(DbConstantMapper.NewInstance("TaxonStatusCache", Types.VARCHAR , state.getTransformer().getTaxonStatusCacheByKey( PesiTransformer.T_STATUS_UNACCEPTED)));
2583 2616
		mapping.addMapper(DbStringMapper.NewInstance("AuthorshipCache", "AuthorString").setBlankToNull(true));  
2584 2617
		mapping.addMapper(MethodMapper.NewInstance("WebShowName", this, TaxonNameBase.class));
2618
		mapping.addMapper(MethodMapper.NewInstance("GUID", this, TaxonNameBase.class));
2619
		
2620
		
2585 2621
		
2586 2622
		// DisplayName
2587 2623
		mapping.addMapper(MethodMapper.NewInstance("DisplayName", this, TaxonNameBase.class));
......
2645 2681
		mapping.addMapper(ObjectChangeMapper.NewInstance(TaxonBase.class, TaxonNameBase.class, "Name"));
2646 2682
		
2647 2683
		mapping.addMapper(DbObjectMapper.NewInstance("NomenclaturalReference", "SourceFk"));
2648
		mapping.addMapper(DbObjectMapper.NewInstance("NomenclaturalReference", "SourceNameCache", IS_CACHE));
2684
//		mapping.addMapper(DbObjectMapper.NewInstance("NomenclaturalReference", "SourceNameCache", IS_CACHE));
2685
		mapping.addMapper(MethodMapper.NewInstance("SourceNameCache", this, TaxonNameBase.class));
2686
		
2649 2687

  
2650 2688
		//we have only nomenclatural references here
2651 2689
		mapping.addMapper(DbConstantMapper.NewInstance("SourceUseFk", Types.INTEGER , PesiTransformer.NOMENCLATURAL_REFERENCE));

Also available in: Unified diff