Project

General

Profile

Revision 0d8c0513

ID0d8c0513cc11f84b1a11d95a61a43f8b7bd06bf0
Parent 18b50091
Child da39aca0

Added by Andreas Müller over 2 years ago

ref #6365 ref #6360 ref #6364 replace taxon name factory methods

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifJsonOccurrenceParser.java
36 36
import eu.etaxonomy.cdm.model.media.ImageFile;
37 37
import eu.etaxonomy.cdm.model.media.Media;
38 38
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
39
import eu.etaxonomy.cdm.model.name.BacterialName;
40 39
import eu.etaxonomy.cdm.model.name.BotanicalName;
41 40
import eu.etaxonomy.cdm.model.name.CultivarPlantName;
42 41
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
43
import eu.etaxonomy.cdm.model.name.NonViralName;
44 42
import eu.etaxonomy.cdm.model.name.Rank;
45 43
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
46
import eu.etaxonomy.cdm.model.name.ViralName;
47
import eu.etaxonomy.cdm.model.name.ZoologicalName;
48 44
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
49 45
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
50 46
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
......
253 249
                            string = record.getString(NOMENCLATURALCODE);
254 250

  
255 251
                            if (string.equals(NomenclaturalCode.ICZN.getTitleCache())){
256
                                name = ZoologicalName.NewInstance(rank);
252
                                name = TaxonNameBase.NewZoologicalInstance(rank);
257 253
                            } else if (string.equals(NomenclaturalCode.ICNAFP.getTitleCache())) {
258 254
                                name = BotanicalName.NewInstance(rank);
259 255
                            } else if (string.equals(NomenclaturalCode.ICNB.getTitleCache())){
260
                                name = BacterialName.NewInstance(rank);
256
                                name = TaxonNameBase.NewBacterialInstance(rank);
261 257
                            } else if (string.equals(NomenclaturalCode.ICNCP.getTitleCache())){
262 258
                                name = CultivarPlantName.NewInstance(rank);
263 259
                            } else if (string.equals(NomenclaturalCode.ICVCN.getTitleCache())){
264
                                name = ViralName.NewInstance(rank);
260
                                name = TaxonNameBase.NewViralInstance(rank);
265 261
                            } else {
266
                                name = NonViralName.NewInstance(rank);
267 262
                            }
268 263
                        }else {
269 264
                            if (record.has(KINGDOM)){
270 265
                                if (record.getString(KINGDOM).equals(PLANTAE)){
271 266
                                    name = BotanicalName.NewInstance(rank);
272 267
                                } else if (record.getString(KINGDOM).equals(ANIMALIA)){
273
                                    name = ZoologicalName.NewInstance(rank);
268
                                    name = TaxonNameBase.NewZoologicalInstance(rank);
274 269
                                } else if (record.getString(KINGDOM).equals(FUNGI)){
275
                                    name = NonViralName.NewInstance(rank);
270
                                    name = BotanicalName.NewInstance(rank);
276 271
                                } else if (record.getString(KINGDOM).equals(BACTERIA)){
277
                                    name = BacterialName.NewInstance(rank);
272
                                    name = TaxonNameBase.NewBacterialInstance(rank);
278 273
                                } else{
279
                                    name = NonViralName.NewInstance(rank);
274
                                    name = TaxonNameBase.NewNonViralInstance(rank);
280 275
                                }
281 276
                            } else{
282
                                name = NonViralName.NewInstance(rank);
277
                                name = TaxonNameBase.NewNonViralInstance(rank);
283 278
                            }
284 279
                        }
285 280
                        if (record.has(GENUS)){
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java
47 47
import eu.etaxonomy.cdm.model.location.NamedArea;
48 48
import eu.etaxonomy.cdm.model.media.Media;
49 49
import eu.etaxonomy.cdm.model.name.BotanicalName;
50
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
50 51
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
51 52
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
52 53
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
53 54
import eu.etaxonomy.cdm.model.name.NonViralName;
54 55
import eu.etaxonomy.cdm.model.name.Rank;
55 56
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
56
import eu.etaxonomy.cdm.model.name.ZoologicalName;
57 57
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
58 58
import eu.etaxonomy.cdm.model.reference.Reference;
59 59
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
......
500 500
     */
501 501
    private Synonym createSynonym(TaxonExcelImportState state, TaxonBase<?> taxonBase, String synonymNameStr) {
502 502
        NomenclaturalCode nc = state.getConfig().getNomenclaturalCode();
503
        TaxonNameBase name = null;
503
        ITaxonNameBase name = null;
504 504
        if (nc.isKindOf(NomenclaturalCode.ICZN)){
505
            name = ZoologicalName.NewInstance(taxonBase.getName().getRank());
505
            name = TaxonNameBase.NewZoologicalInstance(taxonBase.getName().getRank());
506 506
        }else if (nc.isKindOf(NomenclaturalCode.ICNAFP)){
507 507
            name = BotanicalName.NewInstance(taxonBase.getName().getRank());
508 508
        } else{
509
            name = NonViralName.NewInstance(taxonBase.getName().getRank());
509
            name = TaxonNameBase.NewNonViralInstance(taxonBase.getName().getRank());
510 510
        }
511 511
        name.setTitleCache(synonymNameStr, true);
512 512
        if (name != null){
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/SpecimenImportBase.java
162 162
            if (state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICNAFP)){
163 163
                taxonName = BotanicalName.NewInstance(rank);
164 164
            }else if (state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICZN)){
165
                taxonName = ZoologicalName.NewInstance(rank);
165
                taxonName = TaxonNameBase.NewZoologicalInstance(rank);
166 166
            }else{
167
                taxonName = NonViralName.NewInstance(rank);
167
                taxonName = TaxonNameBase.NewNonViralInstance(rank);
168 168
            }
169 169
            taxonName.setFullTitleCache(scientificName,true);
170 170
            taxonName.setTitleCache(scientificName, true);
......
283 283
	        }
284 284

  
285 285
	        if (state.getDataHolder().getNomenclatureCode().equals("Zoological") || state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICZN.getUuid())) {
286
	            NonViralName<ZoologicalName> taxonName = ZoologicalName.NewInstance(null);
286
	            NonViralName<ZoologicalName> taxonName = TaxonNameBase.NewZoologicalInstance(null);
287 287
	            taxonName.setFullTitleCache(fullName, true);
288 288
	            taxonName.setGenusOrUninomial(NB(getFromMap(atomisedMap, "Genus")));
289 289
	            taxonName.setInfraGenericEpithet(NB(getFromMap(atomisedMap, "SubGenus")));
......
402 402
	            }
403 403
	        }
404 404
	        else if (state.getDataHolder().getNomenclatureCode().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICNB.getUuid())) {
405
	            NonViralName<BacterialName> taxonName = BacterialName.NewInstance(null);
405
	            NonViralName<BacterialName> taxonName = TaxonNameBase.NewBacterialInstance(null);
406 406
	            taxonName.setFullTitleCache(fullName, true);
407 407
	            taxonName.setGenusOrUninomial(getFromMap(atomisedMap, "Genus"));
408 408
	            taxonName.setInfraGenericEpithet(NB(getFromMap(atomisedMap, "SubGenus")));
......
455 455

  
456 456
	        if (problem) {
457 457
	            logger.info("Problem im setTaxonNameByType ");
458
	            NonViralName<?> taxonName = NonViralName.NewInstance(null);
458
	            NonViralName<?> taxonName = TaxonNameBase.NewNonViralInstance(null);
459 459
	            taxonName.setFullTitleCache(fullName, true);
460 460
	            return taxonName;
461 461
	        }
462
	        NonViralName<?> tn = NonViralName.NewInstance(null);
462
	        NonViralName<?> tn = TaxonNameBase.NewNonViralInstance(null);
463 463
	        return tn;
464 464
	    }
465 465

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java
141 141
			result = BotanicalName.NewInstance(rank);
142 142
			break;
143 143
		case ICZN:
144
			result = ZoologicalName.NewInstance(rank);
144
			result = TaxonNameBase.NewZoologicalInstance(rank);
145 145
			break;
146 146
		case ICNCP:
147 147
			result = CultivarPlantName.NewInstance(rank);
148 148
			break;
149 149
		case ICNB:
150
			result = BacterialName.NewInstance(rank);
150
			result = TaxonNameBase.NewBacterialInstance(rank);
151 151
			break;
152 152
		case ICVCN:
153
			result = ViralName.NewInstance(rank);
153
			result = TaxonNameBase.NewViralInstance(rank);
154 154
			break;
155 155
		default:
156 156
			logger.warn("Unknown nomenclatural code: " + this.getUuid());
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java
27 27
import eu.etaxonomy.cdm.model.common.CdmBase;
28 28
import eu.etaxonomy.cdm.model.common.IParsable;
29 29
import eu.etaxonomy.cdm.model.common.TimePeriod;
30
import eu.etaxonomy.cdm.model.name.BacterialName;
31 30
import eu.etaxonomy.cdm.model.name.BotanicalName;
32 31
import eu.etaxonomy.cdm.model.name.CultivarPlantName;
33 32
import eu.etaxonomy.cdm.model.name.HybridRelationship;
......
103 102
					result = CultivarPlantName.NewInstance(rank);
104 103
				}
105 104
			}else if ( isZoologicalName /*&& ! isBotanicalName*/ && !isBacteriologicalName && !isCultivatedPlantName){
106
				result = ZoologicalName.NewInstance(rank);
105
				result = TaxonNameBase.NewZoologicalInstance(rank);
107 106
			}else if ( isZoologicalName && ! isBotanicalName && !isBacteriologicalName && !isCultivatedPlantName){
108
				result = BacterialName.NewInstance(rank);
107
				result = TaxonNameBase.NewBacterialInstance(rank);
109 108
			}else {
110
				result =  NonViralName.NewInstance(rank);
109
				result =  TaxonNameBase.NewNonViralInstance(rank);
111 110
			}
112 111
		} else {
113 112
			switch (code) {
......
115 114
				result = BotanicalName.NewInstance(rank);
116 115
				break;
117 116
			case ICZN:
118
				result = ZoologicalName.NewInstance(rank);
117
				result = TaxonNameBase.NewZoologicalInstance(rank);
119 118
				break;
120 119
			case ICNCP:
121 120
				logger.warn("ICNCP parsing not yet implemented");
......
123 122
				break;
124 123
			case ICNB:
125 124
				logger.warn("ICNB not yet implemented");
126
				result = BacterialName.NewInstance(rank);
125
				result = TaxonNameBase.NewBacterialInstance(rank);
127 126
				break;
128 127
			case ICVCN:
129 128
				logger.error("Viral name is not a NonViralName !!");

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)