Project

General

Profile

« Previous | Next » 

Revision 51688d00

Added by Andreas Müller almost 7 years ago

ref #6368 , ref #6671, ref #6630 adapt pesi to no taxon name model

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/faunaEuropaea/FaunaEuropaeaHeterotypicSynonymImport.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
22 22
import eu.etaxonomy.cdm.io.common.ICdmImport;
23 23
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
24 24
import eu.etaxonomy.cdm.model.name.NameRelationship;
25
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
25
import eu.etaxonomy.cdm.model.name.TaxonName;
26 26
import eu.etaxonomy.cdm.model.taxon.Synonym;
27 27
import eu.etaxonomy.cdm.model.taxon.Taxon;
28 28
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
29 29

  
30 30
/**
31
 * This class creates heterotypic synonymy relationships to the accepted taxon for 
32
 * basionym synonyms. 
33
 * 
31
 * This class creates heterotypic synonymy relationships to the accepted taxon for
32
 * basionym synonyms.
33
 *
34 34
 * @author a.babadshanjan
35 35
 * @created 22.09.2009
36 36
 * @version 1.0
......
55 55
	 */
56 56
	@Override
57 57
	protected void doInvoke(FaunaEuropaeaImportState state) {
58
		
58

  
59 59
		TransactionStatus txStatus = null;
60 60
		List<Synonym> synonymList = null;
61 61
		Set<Taxon> taxonSet = null;
......
82 82
					taxonSet = new HashSet<Taxon>(limit);
83 83
				}
84 84

  
85
				if (((i % limit) == 0 && i != 1 ) || i == nbrOfSynonyms) { 
85
				if (((i % limit) == 0 && i != 1 ) || i == nbrOfSynonyms) {
86 86

  
87 87
					HomotypicalGroup homotypicalGroup = null;
88
					Set<TaxonNameBase> basionyms = null;
88
					Set<TaxonName> basionyms = null;
89 89
					Set<NameRelationship> nameRelations = null;
90
					TaxonNameBase basionym = null;
91
					Set<TaxonBase> taxonBases = null;
92
					TaxonBase taxonBase = null;
90
					TaxonName basionym = null;
91
					Set<Taxon> taxonBases = null;
93 92
					Taxon acceptedTaxon = null;
94
					TaxonNameBase synonymName = null;
93
					TaxonName synonymName = null;
95 94
					NameRelationship nameRelation = null;
96
					TaxonNameBase acceptedName = null;
97
					
95
					TaxonName acceptedName = null;
96

  
98 97
					for (TaxonBase synonym : synonymList) {
99 98
						synonymName = synonym.getName();
100 99
						if (synonymName.isGroupsBasionym()) {
......
109 108
								}
110 109
								taxonBases = acceptedName.getTaxa();
111 110
								if (taxonBases != null && taxonBases.iterator().hasNext()) {
112
									taxonBase = taxonBases.iterator().next();
113
									acceptedTaxon = taxonBase.deproxy(taxonBase, Taxon.class);
111
								    acceptedTaxon = taxonBases.iterator().next();
114 112
									Set <Synonym> synonyms = acceptedTaxon.getSynonyms();
115 113
									if (!synonyms.contains(synonym)){
116 114
									//TODO: Achtung!!!!! dies wird auch bei homotypischen Synonymen aufgerufen! Dadurch wird ein weiteres Synonym erzeugt
......
121 119
							}
122 120
						}
123 121
					}
124
						
122

  
125 123
					getTaxonService().save((Collection)taxonSet);
126 124
					taxonSet = null;
127 125
					synonymList = null;
128 126
					commitTransaction(txStatus);
129
					if(logger.isInfoEnabled()) { 
130
						logger.info("i = " + i + " - Transaction committed"); 
127
					if(logger.isInfoEnabled()) {
128
						logger.info("i = " + i + " - Transaction committed");
131 129
					}
132 130
				}
133 131

  

Also available in: Unified diff