Project

General

Profile

« Previous | Next » 

Revision 4772f811

Added by Andreas Müller over 8 years ago

change return type of transformers getPresenceTerm to presenceAbsence

View differences:

cdm-eflora/src/main/java/eu/etaxonomy/cdm/io/eflora/centralAfrica/ferns/CentralAfricaFernsTaxonRelationImport.java
38 38
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
39 39
import eu.etaxonomy.cdm.model.description.Distribution;
40 40
import eu.etaxonomy.cdm.model.description.Feature;
41
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
41 42
import eu.etaxonomy.cdm.model.description.PresenceTerm;
42 43
import eu.etaxonomy.cdm.model.description.TaxonDescription;
43 44
import eu.etaxonomy.cdm.model.description.TextData;
......
68 69
public class CentralAfricaFernsTaxonRelationImport  extends CentralAfricaFernsImportBase<TaxonBase> implements IMappingImport<TaxonBase, CentralAfricaFernsImportState>{
69 70
	private static final Logger logger = Logger.getLogger(CentralAfricaFernsTaxonRelationImport.class);
70 71
	
71
	private DbImportMapping mapping;
72
	private DbImportMapping<?,?> mapping;
72 73
	
73 74
	
74 75
	private static final String pluralString = "taxon relations";
75 76
	private static final String dbTableName = "[African pteridophytes]";
76
	private static final Class cdmTargetClass = TaxonBase.class;
77
	private static final Class<?> cdmTargetClass = TaxonBase.class;
77 78

  
78 79
	private Map<String, UUID> nameCacheTaxonMap = new HashMap<String, UUID>();
79 80
	private Map<String, UUID> titleCacheTaxonMap = new HashMap<String, UUID>();
......
101 102
	 * @see eu.etaxonomy.cdm.io.eflora.centralAfrica.ferns.CentralAfricaFernsImportBase#getMapping()
102 103
	 */
103 104
	@Override
104
	protected DbImportMapping getMapping() {
105
	protected DbImportMapping<?,?> getMapping() {
105 106
		if (mapping == null){
106 107
			mapping = new DbImportMapping();
107 108
			
......
150 151
		
151 152
		List<Taxon> taxonList = (List)getTaxonService().list(Taxon.class, null, null, null, propPath );
152 153
		for (Taxon taxon : taxonList){
153
			NonViralName nvn = CdmBase.deproxy(taxon.getName(), NonViralName.class);
154
			NonViralName<?> nvn = CdmBase.deproxy(taxon.getName(), NonViralName.class);
154 155
			UUID uuid = taxon.getUuid();
155 156
			String nameCache = nvn.getNameCache();
156 157
			String titleCache = nvn.getTitleCache();
......
164 165
	 */
165 166
	public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) {
166 167
		String nameSpace;
167
		Class cdmClass;
168
		Class<?> cdmClass;
168 169
		Set<String> idSet;
169 170
		Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
170 171
		
......
203 204
	 */
204 205
	@Override
205 206
	public TaxonBase createObject(ResultSet rs, CentralAfricaFernsImportState state) throws SQLException {
206
		TaxonBase result = null;
207
		TaxonBase<?> result = null;
207 208
		try {
208 209
			String status = rs.getString("Current/Synonym");
209 210
			String taxonNumber = rs.getString("Taxon number");
......
267 268
			logger.warn ("Synonym ("+synonymId+")not found.");
268 269
			return null;
269 270
		}
270
		TaxonBase taxonBase = CdmBase.deproxy(state.getRelatedObject(TAXON_NAMESPACE, accTaxonId), TaxonBase.class);
271
		TaxonBase<?> taxonBase = CdmBase.deproxy(state.getRelatedObject(TAXON_NAMESPACE, accTaxonId), TaxonBase.class);
271 272
			
272 273
		if (taxonBase != null){
273 274
			if (taxonBase.isInstanceOf(Taxon.class)){
......
410 411
	 * @param constructedHigherTaxon
411 412
	 */
412 413
	private Taxon mergeExistingAndConstructedTaxon(CentralAfricaFernsImportState state, Taxon existingTaxon, Taxon constructedTaxon) {
413
		NonViralName constructedName = CdmBase.deproxy(constructedTaxon.getName(), NonViralName.class);
414
		NonViralName existingName = CdmBase.deproxy(existingTaxon.getName(), NonViralName.class);
414
		NonViralName<?> constructedName = CdmBase.deproxy(constructedTaxon.getName(), NonViralName.class);
415
		NonViralName<?> existingName = CdmBase.deproxy(existingTaxon.getName(), NonViralName.class);
415 416
		if (constructedName.hasAuthors()){
416 417
			if (! existingName.hasAuthors()){
417 418
				logger.warn(state.getTaxonNumber() + " - Constrcucted name ("+constructedName.getTitleCache()+") has authors but existing name ("+existingName.getTitleCache()+") has no authors");
......
704 705
		
705 706
		//persist
706 707
//		Reference citation = state.getConfig().getSourceReference(); //throws nonUniqueObject exception
707
		Reference citation = null;  
708
		Reference<?> citation = null;  
708 709
		String id = state.getTaxonNumber() + "-" + constructedName.getRank().getTitleCache();
709 710
		addOriginalSource(constructedName, id, NAME_NAMESPACE, citation);
710 711
		addOriginalSource(constructedHigherTaxon, id, TAXON_NAMESPACE, citation);
......
932 933
			String province = rs.getString("Distribution - Province");
933 934
			String distributionDetailed = rs.getString("Distribution - detailed");
934 935
			if (taxonBase != null){
935
				TaxonNameBase nameUsedInSource = taxonBase.getName();
936
				TaxonNameBase<?,?> nameUsedInSource = taxonBase.getName();
936 937
				Taxon taxon = getAcceptedTaxon(taxonBase);
937 938
				if (taxon != null){
938 939
				
......
1038 1039
	private void makeSingleCountry(CentralAfricaFernsImportState state, String taxonNumber, Taxon taxon, TaxonNameBase nameUsedInSource, String country) throws UndefinedTransformerMethodException {
1039 1040
		boolean areaDoubtful = false;
1040 1041
		Distribution distribution = Distribution.NewInstance(null, PresenceTerm.PRESENT());
1041
		Reference sourceReference = this.sourceReference;
1042
		Reference<?> sourceReference = this.sourceReference;
1042 1043
		distribution.addSource(taxonNumber, "Distribution_Country", sourceReference, null, nameUsedInSource, null);
1043 1044
		NamedArea area = null;
1044 1045
		//empty
......
1115 1116
	 * @param state
1116 1117
	 * @return
1117 1118
	 */
1118
	Reference sourceReference = null;
1119
	private Reference getFernsSourceReference(CentralAfricaFernsImportState state) {
1119
	private Reference<?> sourceReference = null;
1120
	private Reference<?> getFernsSourceReference(CentralAfricaFernsImportState state) {
1120 1121
//		if (sourceReference == null || true){
1121
			Reference tmpReference = state.getConfig().getSourceReference();
1122
			Reference<?> tmpReference = state.getConfig().getSourceReference();
1122 1123
			sourceReference = getReferenceService().find(tmpReference.getUuid());
1123 1124
//		}
1124 1125
		return sourceReference;
1125 1126
	}
1126 1127

  
1127 1128

  
1128
	private String makeCountryBrackets(CentralAfricaFernsImportState state, String taxonNumber, Taxon taxon, TaxonNameBase nameUsedInSource, String country) {
1129
	private String makeCountryBrackets(CentralAfricaFernsImportState state, String taxonNumber, Taxon taxon, TaxonNameBase<?,?> nameUsedInSource, String country) {
1129 1130
		String[] split = (country + " ").split("\\(.*\\)");
1130 1131
		if (split.length == 2){
1131 1132
			String bracket = country.substring(split[0].length()+1, country.indexOf(")"));
......
1140 1141
	}
1141 1142

  
1142 1143
	private String makeCountryStatus(CentralAfricaFernsImportState state, String country, Distribution distribution) throws UndefinedTransformerMethodException {
1143
		PresenceTerm status = null;
1144
		PresenceAbsenceTermBase<?> status = null;
1144 1145
		String[] split = country.split(" - ");
1145 1146
		
1146 1147
		if (split.length == 2){
......
1196 1197
	 * @param existingHigherTaxon
1197 1198
	 */
1198 1199
	private boolean mergeAuthors_old(Taxon higherTaxon, Taxon existingHigherTaxon) {
1199
		NonViralName existingName = CdmBase.deproxy(higherTaxon.getName(), NonViralName.class);
1200
		NonViralName newName = CdmBase.deproxy(existingHigherTaxon.getName(), NonViralName.class);
1200
		NonViralName<?> existingName = CdmBase.deproxy(higherTaxon.getName(), NonViralName.class);
1201
		NonViralName<?> newName = CdmBase.deproxy(existingHigherTaxon.getName(), NonViralName.class);
1201 1202
		if (existingName == newName){
1202 1203
			return true;
1203 1204
		}

Also available in: Unified diff