Revision 9dc896c9
Added by Andreas Müller almost 7 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java | ||
---|---|---|
51 | 51 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
52 | 52 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
53 | 53 |
import eu.etaxonomy.cdm.model.name.Rank; |
54 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
54 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
55 | 55 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
56 | 56 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
57 | 57 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
449 | 449 |
} |
450 | 450 |
|
451 | 451 |
|
452 |
private List<TaxonNameBase<?,?>> buildNameList( InputStream content, ICdmRepository repository, IIpniServiceConfigurator iConfig) throws IOException {
|
|
452 |
private List<TaxonName<?,?>> buildNameList( InputStream content, ICdmRepository repository, IIpniServiceConfigurator iConfig) throws IOException { |
|
453 | 453 |
IpniServiceNamesConfigurator config = (IpniServiceNamesConfigurator)iConfig; |
454 |
List<TaxonNameBase<?,?>> result = new ArrayList<>();
|
|
454 |
List<TaxonName<?,?>> result = new ArrayList<>(); |
|
455 | 455 |
BufferedReader reader = new BufferedReader (new InputStreamReader(content)); |
456 | 456 |
|
457 | 457 |
String headerLine = reader.readLine(); |
... | ... | |
461 | 461 |
String line = reader.readLine(); |
462 | 462 |
while (isNotBlank(line)){ |
463 | 463 |
// System.out.println(line); |
464 |
TaxonNameBase<?,?> name = (TaxonNameBase<?,?>)getNameFromLine(line,parameterMap, repository, config);
|
|
464 |
TaxonName name = (TaxonName)getNameFromLine(line,parameterMap, repository, config);
|
|
465 | 465 |
result.add(name); |
466 | 466 |
line = reader.readLine(); |
467 | 467 |
} |
... | ... | |
578 | 578 |
|
579 | 579 |
//basionym |
580 | 580 |
if (config.isDoBasionyms() && valueMap.get(BASIONYM)!= null){ |
581 |
TaxonNameBase<?,?> basionym = TaxonNameFactory.NewBotanicalInstance(null);
|
|
581 |
TaxonName basionym = TaxonNameFactory.NewBotanicalInstance(null); |
|
582 | 582 |
basionym.setTitleCache(valueMap.get(BASIONYM), true); |
583 | 583 |
name.addBasionym(basionym); |
584 | 584 |
} |
585 | 585 |
|
586 | 586 |
//replaced synonym |
587 | 587 |
if (config.isDoBasionyms() && valueMap.get(REPLACED_SYNONYM)!= null){ |
588 |
TaxonNameBase<?,?> replacedSynoynm = TaxonNameFactory.NewBotanicalInstance(null);
|
|
588 |
TaxonName replacedSynoynm = TaxonNameFactory.NewBotanicalInstance(null); |
|
589 | 589 |
replacedSynoynm.setTitleCache(valueMap.get(REPLACED_SYNONYM), true); |
590 | 590 |
name.addReplacedSynonym(replacedSynoynm, null, null, null); |
591 | 591 |
} |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifJsonOccurrenceParser.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.media.MediaRepresentation; |
39 | 39 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
40 | 40 |
import eu.etaxonomy.cdm.model.name.Rank; |
41 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
41 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
42 | 42 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
43 | 43 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
44 | 44 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
... | ... | |
210 | 210 |
String dataSetKey = null; |
211 | 211 |
GbifDataSetProtocol dataSetProtocol = null; |
212 | 212 |
DerivedUnitFacade derivedUnitFacade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.PreservedSpecimen); |
213 |
TaxonNameBase name = null;
|
|
213 |
TaxonName name = null; |
|
214 | 214 |
JSONObject record = (JSONObject)o; |
215 | 215 |
|
216 | 216 |
if(record.has(DATASET_PROTOCOL)){ |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifResponse.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
14 | 14 |
import eu.etaxonomy.cdm.ext.occurrence.DataResponse; |
15 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
15 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
16 | 16 |
|
17 | 17 |
/** |
18 | 18 |
* Wrapper class which holds a {@link DerivedUnitFacade} which was parsed from a GBIF JSON response. |
... | ... | |
28 | 28 |
|
29 | 29 |
private final GbifDataSetProtocol dataSetProtocol; |
30 | 30 |
|
31 |
private final TaxonNameBase scientificName;
|
|
31 |
private final TaxonName scientificName; |
|
32 | 32 |
/** |
33 | 33 |
* @param derivedUnitFacade |
34 | 34 |
* @param dataSetUrl |
35 | 35 |
*/ |
36 |
public GbifResponse(DerivedUnitFacade derivedUnitFacade, URI dataSetUrl, GbifDataSetProtocol dataSetProtocol, String [] tripleID, TaxonNameBase scientificName) {
|
|
36 |
public GbifResponse(DerivedUnitFacade derivedUnitFacade, URI dataSetUrl, GbifDataSetProtocol dataSetProtocol, String [] tripleID, TaxonName scientificName) { |
|
37 | 37 |
super(derivedUnitFacade,dataSetUrl, tripleID); |
38 | 38 |
this.dataSetProtocol = dataSetProtocol; |
39 | 39 |
|
... | ... | |
63 | 63 |
/** |
64 | 64 |
* @return the scientificName |
65 | 65 |
*/ |
66 |
public TaxonNameBase getScientificName() {
|
|
66 |
public TaxonName getScientificName() { |
|
67 | 67 |
return scientificName; |
68 | 68 |
} |
69 | 69 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CacheUpdater.java | ||
---|---|---|
16 | 16 |
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity; |
17 | 17 |
import eu.etaxonomy.cdm.model.media.Media; |
18 | 18 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
19 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
19 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
20 | 20 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
21 | 21 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
22 | 22 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
65 | 65 |
List list = Arrays.asList(new Class[]{ |
66 | 66 |
DescriptionBase.class, IdentifiableMediaEntity.class, |
67 | 67 |
Media.class, Sequence.class, |
68 |
TaxonBase.class, TaxonNameBase.class,
|
|
68 |
TaxonBase.class, TaxonName.class, |
|
69 | 69 |
Classification.class, TermBase.class |
70 | 70 |
}); |
71 | 71 |
handleClassList(list); |
... | ... | |
118 | 118 |
//TODO misuse TaxonServic for sequence update, use sequence service when it exists |
119 | 119 |
getTaxonService().updateTitleCache((Class) clazz, null, null, null); |
120 | 120 |
} |
121 |
//TaxonNameBase
|
|
122 |
else if (TaxonNameBase.class.isAssignableFrom(clazz)){
|
|
121 |
//TaxonName |
|
122 |
else if (TaxonName.class.isAssignableFrom(clazz)){ |
|
123 | 123 |
getNameService().updateTitleCache((Class) clazz, null, null, null); |
124 | 124 |
} |
125 | 125 |
//Classification |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CacheUpdaterWithNewCacheStrategy.java | ||
---|---|---|
13 | 13 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
14 | 14 |
import eu.etaxonomy.cdm.model.media.Media; |
15 | 15 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
16 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
16 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
17 | 17 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
18 | 18 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
19 | 19 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
85 | 85 |
//TODO misuse TaxonServic for sequence update, use sequence service when it exists |
86 | 86 |
getTaxonService().updateTitleCache((Class) clazz, null, null, null); |
87 | 87 |
} |
88 |
//TaxonNameBase
|
|
89 |
else if (TaxonNameBase.class.isAssignableFrom(clazz)){
|
|
88 |
//TaxonName |
|
89 |
else if (TaxonName.class.isAssignableFrom(clazz)){ |
|
90 | 90 |
getNameService().updateTitleCache((Class) clazz, null, null, null); |
91 | 91 |
} |
92 | 92 |
//Classification |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmApplicationAwareDefaultExport.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import eu.etaxonomy.cdm.api.service.IService; |
22 | 22 |
import eu.etaxonomy.cdm.io.common.events.IIoObserver; |
23 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
|
24 | 23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
25 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
26 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
27 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
28 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
29 | 24 |
|
30 | 25 |
/** |
31 | 26 |
* This class is an default exporter class that is a spring bean and therefore it knows all other IO classes that are beans |
... | ... | |
60 | 55 |
Map<String, MapWrapper<? extends CdmBase>> stores = new HashMap<String, MapWrapper<? extends CdmBase>>(); |
61 | 56 |
|
62 | 57 |
public CdmApplicationAwareDefaultExport(){ |
63 |
stores.put(ICdmIO.TEAM_STORE, new MapWrapper<TeamOrPersonBase>(service));
|
|
64 |
stores.put(ICdmIO.REFERENCE_STORE, new MapWrapper<Reference>(service));
|
|
65 |
stores.put(ICdmIO.NOMREF_STORE, new MapWrapper<Reference>(service));
|
|
66 |
stores.put(ICdmIO.TAXONNAME_STORE, new MapWrapper<TaxonNameBase>(service));
|
|
67 |
stores.put(ICdmIO.TAXON_STORE, new MapWrapper<TaxonBase>(service));
|
|
68 |
stores.put(ICdmIO.SPECIMEN_STORE, new MapWrapper<DerivedUnit>(service));
|
|
58 |
stores.put(ICdmIO.TEAM_STORE, new MapWrapper<>(service)); |
|
59 |
stores.put(ICdmIO.REFERENCE_STORE, new MapWrapper<>(service)); |
|
60 |
stores.put(ICdmIO.NOMREF_STORE, new MapWrapper<>(service)); |
|
61 |
stores.put(ICdmIO.TAXONNAME_STORE, new MapWrapper<>(service)); |
|
62 |
stores.put(ICdmIO.TAXON_STORE, new MapWrapper<>(service)); |
|
63 |
stores.put(ICdmIO.SPECIMEN_STORE, new MapWrapper<>(service)); |
|
69 | 64 |
} |
70 | 65 |
|
71 | 66 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java | ||
---|---|---|
71 | 71 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
72 | 72 |
import eu.etaxonomy.cdm.model.name.Rank; |
73 | 73 |
import eu.etaxonomy.cdm.model.name.RankClass; |
74 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
74 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
75 | 75 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
76 | 76 |
import eu.etaxonomy.cdm.model.reference.Reference; |
77 | 77 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
1026 | 1026 |
* If false only taxon description being no image galleries are considered. |
1027 | 1027 |
* @return |
1028 | 1028 |
*/ |
1029 |
public TaxonNameDescription getTaxonNameDescription(TaxonNameBase name, boolean isImageGallery, boolean createNewIfNotExists) {
|
|
1029 |
public TaxonNameDescription getTaxonNameDescription(TaxonName name, boolean isImageGallery, boolean createNewIfNotExists) { |
|
1030 | 1030 |
Reference ref = null; |
1031 | 1031 |
return getTaxonNameDescription(name, ref, isImageGallery, createNewIfNotExists); |
1032 | 1032 |
} |
... | ... | |
1038 | 1038 |
* |
1039 | 1039 |
* @see #getTaxonDescription(Taxon, boolean, boolean) |
1040 | 1040 |
*/ |
1041 |
public TaxonNameDescription getTaxonNameDescription(TaxonNameBase<?,?> name, Reference ref, boolean isImageGallery, boolean createNewIfNotExists) {
|
|
1041 |
public TaxonNameDescription getTaxonNameDescription(TaxonName<?,?> name, Reference ref, boolean isImageGallery, boolean createNewIfNotExists) { |
|
1042 | 1042 |
TaxonNameDescription result = null; |
1043 | 1043 |
Set<TaxonNameDescription> descriptions= name.getDescriptions(); |
1044 | 1044 |
for (TaxonNameDescription description : descriptions){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/ImportHelper.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
35 | 35 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
36 | 36 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
37 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
37 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
38 | 38 |
import eu.etaxonomy.cdm.model.reference.Reference; |
39 | 39 |
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser; |
40 | 40 |
/** |
... | ... | |
318 | 318 |
T result; |
319 | 319 |
try { |
320 | 320 |
methodName = getGetterMethodName(cdmAttrName, isBoolean); |
321 |
if (cdmBase.isInstanceOf(TaxonNameBase.class)){
|
|
321 |
if (cdmBase.isInstanceOf(TaxonName.class)){ |
|
322 | 322 |
cdmBase = CdmBase.deproxy(cdmBase); |
323 | 323 |
} |
324 | 324 |
Method cdmMethod = cdmBase.getClass().getMethod(methodName); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/ImportStateBase.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
import eu.etaxonomy.cdm.api.service.IService; |
19 | 19 |
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer; |
20 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
|
21 | 20 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
22 | 21 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
23 | 22 |
import eu.etaxonomy.cdm.model.common.DefinedTerm; |
... | ... | |
34 | 33 |
import eu.etaxonomy.cdm.model.location.NamedAreaLevel; |
35 | 34 |
import eu.etaxonomy.cdm.model.location.ReferenceSystem; |
36 | 35 |
import eu.etaxonomy.cdm.model.name.Rank; |
37 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
38 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
39 | 36 |
import eu.etaxonomy.cdm.model.reference.Reference; |
40 | 37 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
41 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
42 | 38 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
43 | 39 |
|
44 | 40 |
/** |
... | ... | |
96 | 92 |
|
97 | 93 |
protected ImportStateBase(CONFIG config){ |
98 | 94 |
this.config = config; |
99 |
stores.put(ICdmIO.TEAM_STORE, new MapWrapper<TeamOrPersonBase<?>>(service));
|
|
100 |
stores.put(ICdmIO.REFERENCE_STORE, new MapWrapper<Reference>(service));
|
|
101 |
stores.put(ICdmIO.NOMREF_STORE, new MapWrapper<Reference>(service));
|
|
102 |
stores.put(ICdmIO.TAXONNAME_STORE, new MapWrapper<TaxonNameBase<?,?>>(service));
|
|
103 |
stores.put(ICdmIO.TAXON_STORE, new MapWrapper<TaxonBase>(service));
|
|
104 |
stores.put(ICdmIO.SPECIMEN_STORE, new MapWrapper<DerivedUnit>(service));
|
|
95 |
stores.put(ICdmIO.TEAM_STORE, new MapWrapper<>(service)); |
|
96 |
stores.put(ICdmIO.REFERENCE_STORE, new MapWrapper<>(service)); |
|
97 |
stores.put(ICdmIO.NOMREF_STORE, new MapWrapper<>(service)); |
|
98 |
stores.put(ICdmIO.TAXONNAME_STORE, new MapWrapper<>(service)); |
|
99 |
stores.put(ICdmIO.TAXON_STORE, new MapWrapper<>(service)); |
|
100 |
stores.put(ICdmIO.SPECIMEN_STORE, new MapWrapper<>(service)); |
|
105 | 101 |
|
106 | 102 |
if (getTransformer() == null){ |
107 | 103 |
IInputTransformer newTransformer = config.getTransformer(); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportNameTypeDesignationMapper.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 |
*/ |
... | ... | |
18 | 18 |
import eu.etaxonomy.cdm.io.common.DbImportStateBase; |
19 | 19 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
20 | 20 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
21 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
21 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
22 | 22 |
import eu.etaxonomy.cdm.model.reference.Reference; |
23 | 23 |
|
24 | 24 |
/** |
... | ... | |
35 | 35 |
*/ |
36 | 36 |
public class DbImportNameTypeDesignationMapper<STATE extends DbImportStateBase<?,?>, T extends IDbImportTransformed> extends DbImportMultiAttributeMapperBase<CdmBase, STATE> { |
37 | 37 |
private static final Logger logger = Logger.getLogger(DbImportNameTypeDesignationMapper.class); |
38 |
|
|
38 |
|
|
39 | 39 |
//******************************** FACTORY METHOD ***************************************************/ |
40 |
|
|
40 |
|
|
41 | 41 |
public static DbImportNameTypeDesignationMapper<?,?> NewInstance(String dbFromAttribute, String dbToAttribute, String relatedObjectNamespace, String desigStatusAttribute){ |
42 | 42 |
return new DbImportNameTypeDesignationMapper(dbFromAttribute, dbToAttribute, null, relatedObjectNamespace, desigStatusAttribute); |
43 | 43 |
} |
44 |
|
|
44 |
|
|
45 | 45 |
//******************************* ATTRIBUTES ***************************************/ |
46 | 46 |
private String fromAttribute; |
47 | 47 |
private String toAttribute; |
... | ... | |
50 | 50 |
private String citationAttribute; |
51 | 51 |
private String microCitationAttribute; |
52 | 52 |
private String designationStatusAttribute; |
53 |
|
|
54 |
|
|
53 |
|
|
54 |
|
|
55 | 55 |
//********************************* CONSTRUCTOR ****************************************/ |
56 | 56 |
/** |
57 |
* @param relatedObjectNamespace
|
|
57 |
* @param relatedObjectNamespace |
|
58 | 58 |
* @param mappingImport |
59 | 59 |
*/ |
60 | 60 |
protected DbImportNameTypeDesignationMapper(String fromAttribute, String toAttribute, NameTypeDesignationStatus designationStatus, String relatedObjectNamespace, String desigStatusAttribute) { |
... | ... | |
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
//************************************ METHODS *******************************************/ |
71 |
|
|
71 |
|
|
72 | 72 |
/* (non-Javadoc) |
73 | 73 |
* @see eu.etaxonomy.cdm.io.common.mapping.IDbImportMapper#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase) |
74 | 74 |
*/ |
75 |
public CdmBase invoke(ResultSet rs, CdmBase cdmBase) throws SQLException { |
|
75 |
@Override |
|
76 |
public CdmBase invoke(ResultSet rs, CdmBase cdmBase) throws SQLException { |
|
76 | 77 |
STATE state = importMapperHelper.getState(); |
77 | 78 |
CdmImportBase currentImport = state.getCurrentIO(); |
78 | 79 |
if (currentImport instanceof ICheckIgnoreMapper){ |
... | ... | |
81 | 82 |
return cdmBase; |
82 | 83 |
} |
83 | 84 |
} |
84 |
|
|
85 |
|
|
85 | 86 |
CdmBase fromObject = getRelatedObject(rs, fromAttribute); |
86 | 87 |
CdmBase toObject = getRelatedObject(rs, toAttribute); |
87 | 88 |
//TODO cast |
... | ... | |
90 | 91 |
if (citationAttribute != null){ |
91 | 92 |
microCitation = rs.getString(microCitationAttribute); |
92 | 93 |
} |
93 |
|
|
94 |
|
|
94 | 95 |
Object designationStatusValue = null; |
95 | 96 |
if (citationAttribute != null){ |
96 | 97 |
designationStatusValue = rs.getObject(designationStatusAttribute); |
... | ... | |
102 | 103 |
logger.warn(warning); |
103 | 104 |
return cdmBase; |
104 | 105 |
} |
105 |
TaxonNameBase typifiedName = checkTaxonNameBaseType(fromObject);
|
|
106 |
|
|
106 |
TaxonName typifiedName = checkTaxonNameType(fromObject);
|
|
107 |
|
|
107 | 108 |
if (toObject == null){ |
108 | 109 |
String warning = "Species name could not be found. Name type not added to higher rank name"; |
109 | 110 |
logger.warn(warning); |
110 | 111 |
return cdmBase; |
111 | 112 |
} |
112 |
TaxonNameBase typeName = checkTaxonNameBaseType(toObject);
|
|
113 |
|
|
113 |
TaxonName typeName = checkTaxonNameType(toObject);
|
|
114 |
|
|
114 | 115 |
boolean addToAllHomotypicNames = false; //TODO check if this is correct |
115 | 116 |
String originalNameString = null; //TODO what is this |
116 |
|
|
117 |
|
|
117 | 118 |
NameTypeDesignationStatus status = this.designationStatus; |
118 | 119 |
if (designationStatusValue != null){ |
119 | 120 |
//FIXME this needs work in generics to remove casts. Or find an other solution |
... | ... | |
123 | 124 |
} |
124 | 125 |
} |
125 | 126 |
typifiedName.addNameTypeDesignation(typeName, citation, microCitation, originalNameString, status, addToAllHomotypicNames); |
126 |
|
|
127 |
|
|
127 | 128 |
return typifiedName; |
128 | 129 |
} |
129 |
|
|
130 |
|
|
130 | 131 |
/** |
131 | 132 |
* //TODO copied from DbImportObjectMapper. Maybe these can be merged again in future |
132 | 133 |
* @param rs |
... | ... | |
144 | 145 |
} |
145 | 146 |
return result; |
146 | 147 |
} |
147 |
|
|
148 |
|
|
148 | 149 |
/** |
149 |
* Checks if cdmBase is of type Taxon
|
|
150 |
* Checks if cdmBase is of type Taxon |
|
150 | 151 |
* @param fromObject |
151 | 152 |
*/ |
152 |
private TaxonNameBase checkTaxonNameBaseType(CdmBase cdmBase) {
|
|
153 |
if (! cdmBase.isInstanceOf(TaxonNameBase.class)){
|
|
154 |
String warning = "Type name or typifier name is not of type TaxonNameBase but " + cdmBase.getClass().getName();
|
|
153 |
private TaxonName checkTaxonNameType(CdmBase cdmBase) {
|
|
154 |
if (! cdmBase.isInstanceOf(TaxonName.class)){ |
|
155 |
String warning = "Type name or typifier name is not of type TaxonName but " + cdmBase.getClass().getName(); |
|
155 | 156 |
logger.warn(warning); |
156 | 157 |
throw new IllegalArgumentException(warning); |
157 | 158 |
} |
158 |
return (cdmBase.deproxy(cdmBase, TaxonNameBase.class));
|
|
159 |
return (cdmBase.deproxy(cdmBase, TaxonName.class)); |
|
159 | 160 |
} |
160 | 161 |
|
161 | 162 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/DbDescriptionElementTaxonMapper.java | ||
---|---|---|
19 | 19 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
20 | 20 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
21 | 21 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
22 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
22 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
23 | 23 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
24 | 24 |
|
25 | 25 |
/** |
... | ... | |
76 | 76 |
} |
77 | 77 |
}else if (inDescription.isInstanceOf(TaxonNameDescription.class)){ |
78 | 78 |
TaxonNameDescription nameDescription = CdmBase.deproxy(inDescription, TaxonNameDescription.class); |
79 |
TaxonNameBase<?,?> taxonName = nameDescription.getTaxonName();
|
|
79 |
TaxonName<?,?> taxonName = nameDescription.getTaxonName(); |
|
80 | 80 |
if (isCache){ |
81 | 81 |
return taxonName.getTitleCache(); |
82 | 82 |
}else{ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/DbOriginalNameMapper.java | ||
---|---|---|
17 | 17 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
18 | 18 |
import eu.etaxonomy.cdm.model.common.OriginalSourceBase; |
19 | 19 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
20 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
20 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
21 | 21 |
|
22 | 22 |
/** |
23 | 23 |
* @author a.mueller |
... | ... | |
52 | 52 |
if (cdmBase.isInstanceOf(OriginalSourceBase.class)){ |
53 | 53 |
OriginalSourceBase<?> source = CdmBase.deproxy(cdmBase, OriginalSourceBase.class); |
54 | 54 |
String nameString = source.getOriginalNameString(); |
55 |
TaxonNameBase<?,?> name = null;
|
|
55 |
TaxonName<?,?> name = null; |
|
56 | 56 |
if (source.isInstanceOf(DescriptionElementSource.class)){ |
57 | 57 |
DescriptionElementSource descSource = CdmBase.deproxy(source, DescriptionElementSource.class); |
58 | 58 |
name = descSource.getNameUsedInSource(); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/utils/ImportDeduplicationHelper.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.media.RightsType; |
32 | 32 |
import eu.etaxonomy.cdm.model.name.HybridRelationship; |
33 | 33 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
34 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
34 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
35 | 35 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
36 | 36 |
import eu.etaxonomy.cdm.model.reference.Reference; |
37 | 37 |
import eu.etaxonomy.cdm.strategy.match.DefaultMatchStrategy; |
... | ... | |
65 | 65 |
|
66 | 66 |
|
67 | 67 |
private IMatchStrategy referenceMatcher = DefaultMatchStrategy.NewInstance(Reference.class); |
68 |
private IMatchStrategy nameMatcher = DefaultMatchStrategy.NewInstance(TaxonNameBase.class);
|
|
68 |
private IMatchStrategy nameMatcher = DefaultMatchStrategy.NewInstance(TaxonName.class); |
|
69 | 69 |
|
70 | 70 |
|
71 | 71 |
// ************************** FACTORY *******************************/ |
... | ... | |
364 | 364 |
private void initNameMap(STATE state) { |
365 | 365 |
if (!nameMapIsInitialized && repository != null){ |
366 | 366 |
List<String> propertyPaths = Arrays.asList(""); |
367 |
List<TaxonNameBase<?,?>> existingNames = repository.getNameService().list(null, null, null, null, propertyPaths);
|
|
368 |
for (TaxonNameBase<?,?> name : existingNames){
|
|
367 |
List<TaxonName<?,?>> existingNames = repository.getNameService().list(null, null, null, null, propertyPaths); |
|
368 |
for (TaxonName<?,?> name : existingNames){ |
|
369 | 369 |
putName(name.getTitleCache(), name); |
370 | 370 |
} |
371 | 371 |
nameMapIsInitialized = true; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/caryophyllales/out/CsvNameExport.java | ||
---|---|---|
43 | 43 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
44 | 44 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
45 | 45 |
import eu.etaxonomy.cdm.model.name.Rank; |
46 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
46 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
47 | 47 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
48 | 48 |
import eu.etaxonomy.cdm.model.reference.Reference; |
49 | 49 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
184 | 184 |
Set<UUID> parentsNodesUUID = new HashSet<UUID>(childrenUuids); |
185 | 185 |
childrenUuids.clear(); |
186 | 186 |
List<TaxonNode> childrenNodes = new ArrayList<TaxonNode>(); |
187 |
TaxonNameBase name;
|
|
187 |
TaxonName name; |
|
188 | 188 |
|
189 | 189 |
|
190 | 190 |
findChildren(state, childrenUuids, parentsNodesUUID); |
... | ... | |
213 | 213 |
* @param familyNode |
214 | 214 |
*/ |
215 | 215 |
private void findChildren(CsvNameExportState state, Set<UUID> childrenUuids, Set<UUID> parentsNodesUUID) { |
216 |
TaxonNameBase name;
|
|
216 |
TaxonName name; |
|
217 | 217 |
List<TaxonNode> familyNodes = getTaxonNodeService().find(parentsNodesUUID); |
218 | 218 |
parentsNodesUUID =new HashSet<UUID>(); |
219 | 219 |
for (TaxonNode familyNode: familyNodes){ |
... | ... | |
223 | 223 |
child = HibernateProxyHelper.deproxy(child, TaxonNode.class); |
224 | 224 |
Taxon taxon = HibernateProxyHelper.deproxy(child.getTaxon()); |
225 | 225 |
if (taxon != null){ |
226 |
name = HibernateProxyHelper.deproxy(taxon.getName(), TaxonNameBase.class);
|
|
226 |
name = HibernateProxyHelper.deproxy(taxon.getName(), TaxonName.class); |
|
227 | 227 |
if (child.getTaxon().getName().getRank().isLower(state.getConfig().getRank()) ) { |
228 | 228 |
childrenUuids.add(child.getUuid()); |
229 | 229 |
if (child.hasChildNodes()){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DatabaseMapping.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.model.agent.Person; |
26 | 26 |
import eu.etaxonomy.cdm.model.agent.Team; |
27 | 27 |
import eu.etaxonomy.cdm.model.common.IdentifiableEntity; |
28 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
28 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
29 | 29 |
import eu.etaxonomy.cdm.model.reference.Reference; |
30 | 30 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
31 | 31 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
268 | 268 |
|
269 | 269 |
private void initDatasource(String file) { |
270 | 270 |
getDatabase(file); |
271 |
shortCuts.put("TaxonNameBase", TaxonNameBase.class);
|
|
271 |
shortCuts.put("TaxonName", TaxonName.class);
|
|
272 | 272 |
shortCuts.put("Taxon", Taxon.class); |
273 | 273 |
shortCuts.put("Synonym", Synonym.class); |
274 | 274 |
shortCuts.put("Reference", Reference.class); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DwcTaxonStreamItem2CdmTaxonConverter.java | ||
---|---|---|
40 | 40 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
41 | 41 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
42 | 42 |
import eu.etaxonomy.cdm.model.name.Rank; |
43 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
43 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
44 | 44 |
import eu.etaxonomy.cdm.model.reference.Reference; |
45 | 45 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
46 | 46 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
133 | 133 |
Rank rank = getRank(csvTaxonRecord, nomCode); |
134 | 134 |
|
135 | 135 |
//name && name published in |
136 |
TaxonNameBase<?,?> name = getScientificName(csvTaxonRecord, nomCode, rank, resultList, sourceReference);
|
|
136 |
TaxonName<?,?> name = getScientificName(csvTaxonRecord, nomCode, rank, resultList, sourceReference); |
|
137 | 137 |
taxonBase.setName(name); |
138 | 138 |
|
139 | 139 |
//nameAccordingTo |
... | ... | |
500 | 500 |
} |
501 | 501 |
|
502 | 502 |
|
503 |
private TaxonNameBase<?,?> getScientificName(StreamItem item, NomenclaturalCode nomCode, Rank rank, List<MappedCdmBase> resultList, Reference sourceReference) {
|
|
504 |
TaxonNameBase<?,?> name = null;
|
|
503 |
private TaxonName<?,?> getScientificName(StreamItem item, NomenclaturalCode nomCode, Rank rank, List<MappedCdmBase> resultList, Reference sourceReference) { |
|
504 |
TaxonName<?,?> name = null; |
|
505 | 505 |
String strScientificName = getValue(item, TermUri.DWC_SCIENTIFIC_NAME); |
506 | 506 |
//Name |
507 | 507 |
if (strScientificName != null){ |
508 |
name = (TaxonNameBase<?,?>)parser.parseFullName(strScientificName, nomCode, rank);
|
|
508 |
name = (TaxonName<?,?>)parser.parseFullName(strScientificName, nomCode, rank); |
|
509 | 509 |
if ( rank != null && name != null && name.getRank() != null && ! rank.equals(name.getRank())){ |
510 | 510 |
if (config.isValidateRankConsistency()){ |
511 | 511 |
String message = "Parsed rank %s (%s) differs from rank %s given by fields 'taxonRank' or 'verbatimTaxonRank'"; |
... | ... | |
607 | 607 |
|
608 | 608 |
|
609 | 609 |
//TODO we may configure in configuration that scientific name never includes Authorship |
610 |
private void checkAuthorship(TaxonNameBase<?,?> nameBase, StreamItem item) {
|
|
610 |
private void checkAuthorship(TaxonName<?,?> nameBase, StreamItem item) { |
|
611 | 611 |
if (!nameBase.isNonViral()){ |
612 | 612 |
return; |
613 | 613 |
} |
... | ... | |
677 | 677 |
* @return |
678 | 678 |
*/ |
679 | 679 |
private TaxonBase<?> getTaxonBase(StreamItem item) { |
680 |
TaxonNameBase<?,?> name = null;
|
|
680 |
TaxonName<?,?> name = null; |
|
681 | 681 |
Reference sec = null; |
682 | 682 |
TaxonBase<?> result; |
683 | 683 |
String taxStatus = item.get(TermUri.DWC_TAXONOMIC_STATUS); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/GbifReferenceCsv2CdmConverter.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.description.TextData; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
35 | 35 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
36 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.reference.Reference; |
38 | 38 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
185 | 185 |
|
186 | 186 |
} |
187 | 187 |
|
188 |
private void createCitation(TaxonDescription desc, Reference ref, TaxonNameBase nameUsedInSource) {
|
|
188 |
private void createCitation(TaxonDescription desc, Reference ref, TaxonName nameUsedInSource) { |
|
189 | 189 |
Feature feature = Feature.CITATION(); |
190 | 190 |
TextData textData = TextData.NewInstance(feature); |
191 | 191 |
DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(ref, null, nameUsedInSource, null); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/GbifTypesAndSpecimen2CdmConverter.java | ||
---|---|---|
23 | 23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
24 | 24 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
25 | 25 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
26 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
26 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
27 | 27 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
28 | 28 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
29 | 29 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
87 | 87 |
DerivedUnit specimen = facade.innerDerivedUnit(); |
88 | 88 |
|
89 | 89 |
if (isType){ |
90 |
TaxonNameBase<?,?> name = taxon.getName();
|
|
90 |
TaxonName name = taxon.getName(); |
|
91 | 91 |
if (typeStatus.isInstanceOf(SpecimenTypeDesignationStatus.class)){ |
92 | 92 |
SpecimenTypeDesignationStatus status = CdmBase.deproxy(typeStatus, SpecimenTypeDesignationStatus.class); |
93 | 93 |
name.addSpecimenTypeDesignation(specimen, status, null, null, null, false, true); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaResourceRelationExport.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.description.TaxonInteraction; |
36 | 36 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
37 | 37 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
38 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
38 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
40 | 40 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
41 | 41 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
150 | 150 |
Set<NameRelationship> rels = name.getNameRelations(); |
151 | 151 |
for (NameRelationship rel : rels){ |
152 | 152 |
DwcaResourceRelationRecord record = new DwcaResourceRelationRecord(metaRecord, config); |
153 |
IdentifiableEntity<?> subject = CdmBase.deproxy(rel.getFromName(), TaxonNameBase.class);
|
|
154 |
IdentifiableEntity<?> object = CdmBase.deproxy(rel.getToName(), TaxonNameBase.class);
|
|
153 |
IdentifiableEntity<?> subject = CdmBase.deproxy(rel.getFromName(), TaxonName.class); |
|
154 |
IdentifiableEntity<?> object = CdmBase.deproxy(rel.getToName(), TaxonName.class); |
|
155 | 155 |
boolean isInverse = false; |
156 | 156 |
if(subject == name){ |
157 | 157 |
subject = taxon; |
... | ... | |
218 | 218 |
//TODO missing |
219 | 219 |
record.setRelatioshipEstablishedDate(null); |
220 | 220 |
record.setRelationshipRemarks(rel.getAnnotations()); |
221 |
if (object.isInstanceOf(TaxonNameBase.class)){
|
|
221 |
if (object.isInstanceOf(TaxonName.class)){ |
|
222 | 222 |
record.setScientificName(object.getTitleCache()); |
223 | 223 |
} |
224 | 224 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaTaxExport.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
33 | 33 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
35 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
36 | 36 |
import eu.etaxonomy.cdm.model.reference.Reference; |
37 | 37 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
38 | 38 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
109 | 109 |
|
110 | 110 |
INonViralName name = taxon.getName(); |
111 | 111 |
Taxon parent = node.getParent() == null ? null : node.getParent().getTaxon(); |
112 |
TaxonNameBase<?, ?> basionym = name.getBasionym();
|
|
112 |
TaxonName basionym = name.getBasionym(); |
|
113 | 113 |
Classification classification = node.getClassification(); |
114 | 114 |
if (! this.recordExists(taxon)){ |
115 | 115 |
handleTaxonBase(record, taxon, name, taxon, parent, basionym, classification, null, false, false, config); |
... | ... | |
157 | 157 |
INonViralName name = synonym.getName(); |
158 | 158 |
//???? |
159 | 159 |
Taxon parent = null; |
160 |
TaxonNameBase<?, ?> basionym = name.getBasionym();
|
|
160 |
TaxonName basionym = name.getBasionym(); |
|
161 | 161 |
|
162 | 162 |
if (! this.recordExists(synonym)){ |
163 | 163 |
handleTaxonBase(record, synonym, name, taxon, parent, basionym, classification, type, isProParte, isPartial, config); |
... | ... | |
175 | 175 |
INonViralName name = misappliedName.getName(); |
176 | 176 |
//???? |
177 | 177 |
Taxon parent = null; |
178 |
TaxonNameBase<?, ?> basionym = name.getBasionym();
|
|
178 |
TaxonName basionym = name.getBasionym(); |
|
179 | 179 |
|
180 | 180 |
if (! this.recordExists(misappliedName)){ |
181 | 181 |
handleTaxonBase(record, misappliedName, name, taxon, parent, basionym, classification, relType, false, false, config); |
... | ... | |
198 | 198 |
* @param type |
199 | 199 |
*/ |
200 | 200 |
private void handleTaxonBase(DwcaTaxRecord record, TaxonBase<?> taxonBase, INonViralName name, |
201 |
Taxon acceptedTaxon, Taxon parent, TaxonNameBase<?, ?> basionym, Classification classification,
|
|
201 |
Taxon acceptedTaxon, Taxon parent, TaxonName basionym, Classification classification, |
|
202 | 202 |
RelationshipTermBase<?> relType, boolean isProParte, boolean isPartial, DwcaTaxExportConfigurator config) { |
203 | 203 |
record.setId(taxonBase.getId()); |
204 | 204 |
record.setUuid(taxonBase.getUuid()); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaTypesExport.java | ||
---|---|---|
31 | 31 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
32 | 32 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
33 | 33 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
34 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
34 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
35 | 35 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
36 | 36 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
37 | 37 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
... | ... | |
191 | 191 |
record.setTypeStatus(status); |
192 | 192 |
record.setTypeDesignatedBy( (designation == null || designation.getCitation()==null)? null: designation.getCitation().getTitleCache()); |
193 | 193 |
|
194 |
TaxonNameBase<?,?> scientificName = getScientificName(facade);
|
|
194 |
TaxonName scientificName = getScientificName(facade); |
|
195 | 195 |
if (scientificName != null){ |
196 | 196 |
record.setScientificName(scientificName.getTitleCache()); |
197 | 197 |
record.setTaxonRank(scientificName.getRank()); |
... | ... | |
241 | 241 |
return true; |
242 | 242 |
} |
243 | 243 |
|
244 |
private TaxonNameBase<?,?> getScientificName(DerivedUnitFacade facade) {
|
|
244 |
private TaxonName<?,?> getScientificName(DerivedUnitFacade facade) { |
|
245 | 245 |
Set<DeterminationEvent> detEvents = facade.getDeterminations(); |
246 | 246 |
for (DeterminationEvent detEvent : detEvents){ |
247 | 247 |
if (detEvent.getPreferredFlag()== true || detEvents.size()==1){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelRowBase.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
25 | 25 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
26 | 26 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
27 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
27 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
28 | 28 |
import eu.etaxonomy.cdm.model.reference.Reference; |
29 | 29 |
|
30 | 30 |
/** |
... | ... | |
181 | 181 |
SpecimenTypeDesignation designation = getOrMakeTypeDesignation(key); |
182 | 182 |
designation.setTypeStatus(status); |
183 | 183 |
} |
184 |
public void putTypifiedName(int key, TaxonNameBase<?,?> name){
|
|
184 |
public void putTypifiedName(int key, TaxonName name){ |
|
185 | 185 |
if (name != null){ |
186 | 186 |
SpecimenTypeDesignation designation = getOrMakeTypeDesignation(key); |
187 | 187 |
name.addTypeDesignation(designation, false); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/distribution/DistributionImport.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; |
35 | 35 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
36 | 36 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
37 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
37 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
38 | 38 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
39 | 39 |
import eu.etaxonomy.cdm.persistence.query.MatchMode; |
40 | 40 |
|
... | ... | |
171 | 171 |
private void saveRecord(String taxonName, ArrayList<String> distributionList, |
172 | 172 |
String status, String literatureNumber, String literature) { |
173 | 173 |
|
174 |
IdentifiableServiceConfiguratorImpl<TaxonNameBase> config = IdentifiableServiceConfiguratorFactory.getConfigurator(TaxonNameBase.class);
|
|
174 |
IdentifiableServiceConfiguratorImpl<TaxonName> config = IdentifiableServiceConfiguratorFactory.getConfigurator(TaxonName.class);
|
|
175 | 175 |
config.setTitleSearchString(taxonName); |
176 | 176 |
config.setMatchMode(MatchMode.BEGINNING); |
177 | 177 |
|
178 | 178 |
try { |
179 | 179 |
// get the matching names from the DB |
180 |
//List<TaxonNameBase> taxonNameBases = getNameService().findByTitle(config);
|
|
181 |
List<TaxonNameBase> taxonNameBases = getNameService().findByName(null, taxonName, null, null, null, null,null,null).getRecords();
|
|
182 |
if (taxonNameBases.isEmpty()) {
|
|
180 |
//List<TaxonName> taxonNames = getNameService().findByTitle(config);
|
|
181 |
List<TaxonName> taxonNames = getNameService().findByName(null, taxonName, null, null, null, null,null,null).getRecords();
|
|
182 |
if (taxonNames.isEmpty()) { |
|
183 | 183 |
logger.error("Taxon name '" + taxonName + "' not found in DB"); |
184 | 184 |
} else { |
185 | 185 |
if (logger.isDebugEnabled()) { logger.debug("Taxon found"); } |
186 | 186 |
} |
187 | 187 |
|
188 | 188 |
// get the taxa for the matching names |
189 |
for(TaxonNameBase<?,?> dbTaxonName: taxonNameBases) {
|
|
189 |
for(TaxonName<?,?> dbTaxonName: taxonNames) {
|
|
190 | 190 |
|
191 | 191 |
Set<Taxon> taxa = dbTaxonName.getTaxa(); |
192 | 192 |
if (taxa.isEmpty()) { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java | ||
---|---|---|
52 | 52 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
53 | 53 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
54 | 54 |
import eu.etaxonomy.cdm.model.name.Rank; |
55 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
55 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
56 | 56 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
57 | 57 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
58 | 58 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
327 | 327 |
String childId = taxonDataHolder.getId(); |
328 | 328 |
UUID cdmUuid = taxonDataHolder.getCdmUuid(); |
329 | 329 |
Taxon acceptedTaxon = null; |
330 |
TaxonNameBase<?,?> nameUsedInSource = null;
|
|
330 |
TaxonName nameUsedInSource = null; |
|
331 | 331 |
TaxonBase<?> taxonBase = null; |
332 | 332 |
Taxon parentTaxon = null; |
333 | 333 |
|
... | ... | |
522 | 522 |
* @param taxonDataHolder |
523 | 523 |
* @param acceptedTaxon |
524 | 524 |
*/ |
525 |
private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon, TaxonNameBase nameUsedInSource) {
|
|
525 |
private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon, TaxonName nameUsedInSource) { |
|
526 | 526 |
//feature |
527 | 527 |
for (UUID featureUuid : taxonDataHolder.getFeatures()){ |
528 | 528 |
Feature feature = getFeature(state, featureUuid); |
... | ... | |
761 | 761 |
private TaxonBase<?> createTaxon(TaxonExcelImportState state, Rank rank, String taxonNameStr, |
762 | 762 |
String authorStr, String publishingAutorStr, String basionymAuthor, String reference, String date, String nameStatus, NomenclaturalCode nc) { |
763 | 763 |
TaxonBase<?> taxonBase; |
764 |
INonViralName taxonNameBase = null;
|
|
764 |
INonViralName taxonName = null; |
|
765 | 765 |
if (nc == NomenclaturalCode.ICVCN){ |
766 | 766 |
logger.warn("ICVCN not yet supported"); |
767 | 767 |
|
768 | 768 |
}else{ |
769 | 769 |
//String taxonNameStr = titleCache.substring(0, titleCache.indexOf(authorStr)); |
770 |
taxonNameBase = nc.getNewTaxonNameInstance(rank);
|
|
770 |
taxonName = nc.getNewTaxonNameInstance(rank); |
|
771 | 771 |
NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance(); |
772 |
taxonNameBase = parser.parseFullName(taxonNameStr, nc, rank);
|
|
772 |
taxonName = parser.parseFullName(taxonNameStr, nc, rank); |
|
773 | 773 |
|
774 |
if (! taxonNameBase.getNameCache().equals(taxonNameStr)){
|
|
775 |
taxonNameBase.setNameCache(taxonNameStr, true);
|
|
774 |
if (! taxonName.getNameCache().equals(taxonNameStr)){ |
|
775 |
taxonName.setNameCache(taxonNameStr, true); |
|
776 | 776 |
} |
777 | 777 |
|
778 | 778 |
// Create the author |
779 | 779 |
if (StringUtils.isNotBlank(authorStr)) { |
780 | 780 |
try { |
781 |
parser.parseAuthors(taxonNameBase, authorStr);
|
|
781 |
parser.parseAuthors(taxonName, authorStr); |
|
782 | 782 |
} catch (StringNotParsableException e) { |
783 |
taxonNameBase.setAuthorshipCache(authorStr);
|
|
783 |
taxonName.setAuthorshipCache(authorStr); |
|
784 | 784 |
} |
785 | 785 |
} |
786 | 786 |
if (StringUtils.isNotBlank(reference)) { |
787 | 787 |
|
788 | 788 |
INomenclaturalReference ref = parser.parseReferenceTitle(reference, date, true); |
789 | 789 |
if (ref.getAuthorship() == null){ |
790 |
ref.setAuthorship(taxonNameBase.getCombinationAuthorship());
|
|
790 |
ref.setAuthorship(taxonName.getCombinationAuthorship()); |
|
791 | 791 |
} |
792 | 792 |
|
793 | 793 |
if (ref.getAbbrevTitle() == null && !ref.isOfType(ReferenceType.Article)) { |
... | ... | |
797 | 797 |
|
798 | 798 |
ref.setProtectedTitleCache(false); |
799 | 799 |
|
800 |
taxonNameBase.setNomenclaturalReference(ref);
|
|
801 |
taxonNameBase.setNomenclaturalMicroReference(state.getCurrentRow().getCollation());
|
|
800 |
taxonName.setNomenclaturalReference(ref); |
|
801 |
taxonName.setNomenclaturalMicroReference(state.getCurrentRow().getCollation()); |
|
802 | 802 |
} |
803 | 803 |
} |
804 | 804 |
|
... | ... | |
807 | 807 |
// Create the status |
808 | 808 |
nameStatus = CdmUtils.Nz(nameStatus).trim().toLowerCase(); |
809 | 809 |
if (validMarkers.contains(nameStatus)){ |
810 |
taxonBase = Taxon.NewInstance(taxonNameBase, sec);
|
|
810 |
taxonBase = Taxon.NewInstance(taxonName, sec); |
|
811 | 811 |
}else if (synonymMarkers.contains(nameStatus)){ |
812 |
taxonBase = Synonym.NewInstance(taxonNameBase, sec);
|
|
812 |
taxonBase = Synonym.NewInstance(taxonName, sec); |
|
813 | 813 |
}else { |
814 |
Taxon taxon = Taxon.NewInstance(taxonNameBase, sec);
|
|
814 |
Taxon taxon = Taxon.NewInstance(taxonName, sec); |
|
815 | 815 |
if (nameStatusMarkers.contains(nameStatus)){ |
816 | 816 |
if (nameStatus.equals(NOM_ILLEG)){ |
817 |
taxonNameBase.addStatus(NomenclaturalStatusType.ILLEGITIMATE(), null, null);
|
|
817 |
taxonName.addStatus(NomenclaturalStatusType.ILLEGITIMATE(), null, null); |
|
818 | 818 |
} else if (nameStatus.equals(NOM_REJ)){ |
819 |
taxonNameBase.addStatus(NomenclaturalStatusType.REJECTED(), null, null);
|
|
819 |
taxonName.addStatus(NomenclaturalStatusType.REJECTED(), null, null); |
|
820 | 820 |
} else if (nameStatus.equals(NOM_CONS)){ |
821 |
taxonNameBase.addStatus(NomenclaturalStatusType.CONSERVED(), null, null);
|
|
821 |
taxonName.addStatus(NomenclaturalStatusType.CONSERVED(), null, null); |
|
822 | 822 |
} |
823 | 823 |
}else{ |
824 | 824 |
taxon.setTaxonStatusUnknown(true); |
... | ... | |
838 | 838 |
//TODO implementation must be improved when matching of taxon names with existing names is implemented |
839 | 839 |
//=> the assumption that the only description is the description added by this import |
840 | 840 |
//is wrong then |
841 |
private TaxonNameDescription getNameDescription(TaxonNameBase<?,?> name) {
|
|
841 |
private TaxonNameDescription getNameDescription(TaxonName<?,?> name) { |
|
842 | 842 |
Set<TaxonNameDescription> descriptions = name.getDescriptions(); |
843 | 843 |
if (descriptions.size()>1){ |
844 | 844 |
throw new IllegalStateException("Implementation does not yet support names with multiple descriptions"); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/CdmIDResolver.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
36 | 36 |
import eu.etaxonomy.cdm.model.media.Media; |
37 | 37 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
38 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
38 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
39 | 39 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
40 | 40 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
41 | 41 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
43 | 43 |
|
44 | 44 |
public class CdmIDResolver extends IDResolver { |
45 | 45 |
private static final Logger logger = Logger.getLogger(CdmIDResolver.class); |
46 |
|
|
46 |
|
|
47 | 47 |
IUserService userService; |
48 |
|
|
49 |
IAgentService agentService;
|
|
50 |
|
|
48 |
|
|
49 |
IAgentService agentService; |
|
50 |
|
|
51 | 51 |
ITermService termService; |
52 |
|
|
52 |
|
|
53 | 53 |
IVocabularyService vocabularyService; |
54 |
|
|
54 |
|
|
55 | 55 |
IDescriptionService descriptionService; |
56 |
|
|
56 |
|
|
57 | 57 |
IFeatureTreeService featureTreeService; |
58 |
|
|
58 |
|
|
59 | 59 |
IMediaService mediaService; |
60 |
|
|
60 |
|
|
61 | 61 |
INameService nameService; |
62 |
|
|
62 |
|
|
63 | 63 |
IOccurrenceService occurrenceService; |
64 |
|
|
64 |
|
|
65 | 65 |
ICollectionService collectionService; |
66 |
|
|
66 |
|
|
67 | 67 |
IReferenceService referenceService; |
68 |
|
|
68 |
|
|
69 | 69 |
ITaxonService taxonService; |
70 |
|
|
70 |
|
|
71 | 71 |
@Autowired |
72 | 72 |
public void setUserService(IUserService userService) { |
73 | 73 |
this.userService = userService; |
... | ... | |
127 | 127 |
public void setTaxonService(ITaxonService taxonService) { |
128 | 128 |
this.taxonService = taxonService; |
129 | 129 |
} |
130 |
|
|
130 |
|
|
131 | 131 |
private HashMap<String,Object> idmap = null; |
132 |
|
|
132 |
|
|
133 | 133 |
@Override |
134 | 134 |
public void startDocument(ValidationEventHandler eventHandler) throws SAXException { |
135 | 135 |
if(idmap!=null) { |
... | ... | |
144 | 144 |
} |
145 | 145 |
idmap.put(id,obj); |
146 | 146 |
} |
147 |
|
|
147 |
|
|
148 | 148 |
|
149 | 149 |
@Override |
150 | 150 |
public Callable<?> resolve(final String id, final Class targetType) throws SAXException { |
151 | 151 |
return new Callable() { |
152 |
public Object call() throws Exception { |
|
152 |
@Override |
|
153 |
public Object call() throws Exception { |
|
153 | 154 |
logger.info("Resolving " + id + " for class " + targetType); |
154 |
|
|
155 |
|
|
155 | 156 |
if(idmap==null || !idmap.containsKey(id)) { |
156 |
|
|
157 |
|
|
157 | 158 |
String uuidPart = id.substring(UUIDAdapter.UUID_URN_PREFIX.length()); |
158 | 159 |
UUID uuid = UUID.fromString(uuidPart); |
159 | 160 |
logger.info(uuid + " not in idmap, looking in database"); |
... | ... | |
171 | 172 |
return resolveObject(uuid, targetType, featureTreeService); |
172 | 173 |
} else if(Media.class.isAssignableFrom(targetType)) { |
173 | 174 |
return resolveObject(uuid, targetType, mediaService); |
174 |
} else if(TaxonNameBase.class.isAssignableFrom(targetType)) {
|
|
175 |
} else if(TaxonName.class.isAssignableFrom(targetType)) { |
|
175 | 176 |
return resolveObject(uuid, targetType, nameService); |
176 | 177 |
} else if(SpecimenOrObservationBase.class.isAssignableFrom(targetType)) { |
177 | 178 |
return resolveObject(uuid, targetType, occurrenceService); |
... | ... | |
191 | 192 |
/** |
192 | 193 |
* Collections of IDREFS do not have a type at runtime |
193 | 194 |
* https://jaxb.dev.java.net/issues/show_bug.cgi?id=546 |
194 |
*
|
|
195 |
* |
|
195 | 196 |
* Maybe in the future we'll be able to add targetType to IDREF |
196 | 197 |
* but the spec has to be changed first so no fix is likely at the moment |
197 |
*
|
|
198 |
* |
|
198 | 199 |
*/ |
199 |
|
|
200 |
|
|
200 | 201 |
AgentBase agent = agentService.find(uuid); |
201 |
if(agent != null) {
|
|
202 |
if(agent != null) { |
|
202 | 203 |
return agent; |
203 | 204 |
} |
204 | 205 |
DefinedTermBase term = termService.find(uuid); |
205 |
if(term != null) {
|
|
206 |
if(term != null) { |
|
206 | 207 |
return term; |
207 | 208 |
} |
208 | 209 |
Media media = mediaService.find(uuid); |
209 |
if(media != null) {
|
|
210 |
if(media != null) { |
|
210 | 211 |
return media; |
211 | 212 |
} |
212 | 213 |
throw new SAXException(targetType.getSimpleName() + " with " + uuid + " not found"); |
213 | 214 |
} |
214 | 215 |
} else { |
215 | 216 |
return idmap.get(id); |
216 |
}
|
|
217 |
} |
|
217 | 218 |
} |
218 | 219 |
}; |
219 | 220 |
} |
220 |
|
|
221 |
|
|
221 | 222 |
private Object resolveObject(UUID uuid, Class targetType, IService service) throws SAXException { |
222 | 223 |
Object object = service.find(uuid); |
223 | 224 |
if(object == null) { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/DataSet.java | ||
---|---|---|
69 | 69 |
import eu.etaxonomy.cdm.model.name.Rank; |
70 | 70 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
71 | 71 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
72 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
72 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
73 | 73 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
74 | 74 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent; |
75 | 75 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType; |
... | ... | |
235 | 235 |
|
236 | 236 |
@XmlElementWrapper(name = "TaxonomicNames") |
237 | 237 |
@XmlElements({ |
238 |
@XmlElement(name = "TaxonNameBase", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = TaxonNameBase.class),
|
|
238 |
@XmlElement(name = "TaxonName", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = TaxonName.class),
|
|
239 | 239 |
}) |
240 |
protected List<TaxonNameBase> taxonomicNames = new ArrayList<>();
|
|
240 |
protected List<TaxonName> taxonomicNames = new ArrayList<>(); |
|
241 | 241 |
|
242 | 242 |
@XmlElementWrapper(name = "TaxonBases") |
243 | 243 |
@XmlElements({ |
... | ... | |
377 | 377 |
* {@link List<axonNameBase> } |
378 | 378 |
* |
379 | 379 |
*/ |
380 |
public List<TaxonNameBase> getTaxonomicNames() {
|
|
380 |
public List<TaxonName> getTaxonomicNames() { |
|
381 | 381 |
return taxonomicNames; |
382 | 382 |
} |
383 | 383 |
|
... | ... | |
386 | 386 |
* |
387 | 387 |
* @param value |
388 | 388 |
* allowed object is |
389 |
* {@link List<TaxonNameBase> }
|
|
389 |
* {@link List<TaxonName> } |
|
390 | 390 |
* |
391 | 391 |
*/ |
392 |
public void setTaxonomicNames(List<TaxonNameBase> value) {
|
|
392 |
public void setTaxonomicNames(List<TaxonName> value) { |
|
393 | 393 |
this.taxonomicNames = value; |
394 | 394 |
} |
395 | 395 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/JaxbExport.java | ||
---|---|---|
37 | 37 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
38 | 38 |
import eu.etaxonomy.cdm.model.common.User; |
39 | 39 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
40 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
40 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
41 | 41 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
42 | 42 |
import eu.etaxonomy.cdm.model.reference.Reference; |
43 | 43 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
159 | 159 |
int agentRows = numberOfRows; |
160 | 160 |
int definedTermBaseRows = numberOfRows; |
161 | 161 |
int referenceBaseRows = numberOfRows; |
162 |
int taxonNameBaseRows = numberOfRows;
|
|
162 |
int taxonNameRows = numberOfRows; |
|
163 | 163 |
int taxonBaseRows = numberOfRows; |
164 | 164 |
int taxonNodeRows = numberOfRows; |
165 | 165 |
int relationshipRows = numberOfRows; |
... | ... | |
228 | 228 |
} |
229 | 229 |
|
230 | 230 |
if (jaxbExpConfig.isDoTaxonNames() == true) { |
231 |
if (taxonNameBaseRows == 0) { taxonNameBaseRows = getNameService().count(TaxonNameBase.class); }
|
|
232 |
logger.info("# TaxonNameBase: " + taxonNameBaseRows);
|
|
231 |
if (taxonNameRows == 0) { taxonNameRows = getNameService().count(TaxonName.class); }
|
|
232 |
logger.info("# TaxonName: " + taxonNameRows);
|
|
233 | 233 |
//logger.info(" # Taxon: " + getNameService().count(BotanicalName.class)); |
234 |
dataSet.setTaxonomicNames(getNameService().list(null,taxonNameBaseRows, 0,null,null));
|
|
234 |
dataSet.setTaxonomicNames(getNameService().list(null,taxonNameRows, 0,null,null)); |
|
235 | 235 |
} |
236 | 236 |
|
237 | 237 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/JaxbImport.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
34 | 34 |
import eu.etaxonomy.cdm.model.media.Media; |
35 | 35 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
36 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
38 | 38 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
39 | 39 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
113 | 113 |
List<DefinedTermBase> terms; |
114 | 114 |
List<User> users; |
115 | 115 |
List<Reference> references; |
116 |
List<TaxonNameBase> taxonomicNames;
|
|
116 |
List<TaxonName> taxonomicNames; |
|
117 | 117 |
List<DescriptionBase> descriptions; |
118 | 118 |
List<TypeDesignationBase> typeDesignations; |
119 | 119 |
List<SpecimenOrObservationBase> occurrences; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupNomenclatureImport.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
35 | 35 |
import eu.etaxonomy.cdm.model.name.Rank; |
36 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
36 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
37 | 37 |
import eu.etaxonomy.cdm.model.reference.IArticle; |
38 | 38 |
import eu.etaxonomy.cdm.model.reference.IBook; |
39 | 39 |
import eu.etaxonomy.cdm.model.reference.IJournal; |
... | ... | |
162 | 162 |
if (isStartingElement(next, NOM)) { |
163 | 163 |
// TODO should we check if the type is always a species, is |
164 | 164 |
// this a rule? |
165 |
TaxonNameBase<?,?> speciesName = TaxonNameBase.castAndDeproxy(
|
|
165 |
TaxonName speciesName = TaxonName.castAndDeproxy(
|
|
166 | 166 |
handleNom(state, reader, next, null)); |
167 |
for (TaxonNameBase<?, ?> name : homotypicalGroup
|
|
167 |
for (TaxonName<?, ?> name : homotypicalGroup |
|
168 | 168 |
.getTypifiedNames()) { |
169 | 169 |
name.addNameTypeDesignation(speciesName, null, null, |
170 | 170 |
null, status, false, false, false, false); |
... | ... | |
622 | 622 |
if (taxon.getHomotypicGroup().equals(homotypicalGroup)) { |
623 | 623 |
synonymType = SynonymType.HOMOTYPIC_SYNONYM_OF(); |
624 | 624 |
} |
625 |
taxon.addSynonymName(TaxonNameBase.castAndDeproxy(name), synonymType);
|
|
625 |
taxon.addSynonymName(TaxonName.castAndDeproxy(name), synonymType); |
|
626 | 626 |
} else { |
627 | 627 |
name = taxon.getName(); |
628 | 628 |
} |
... | ... | |
633 | 633 |
XMLEvent parentEvent, INonViralName nvn, TaxonRelationship misappliedRel) throws XMLStreamException { |
634 | 634 |
String classValue = getClassOnlyAttribute(parentEvent); |
635 | 635 |
|
636 |
TaxonNameBase<?,?> name = TaxonNameBase.castAndDeproxy(nvn);
|
|
636 |
TaxonName name = TaxonName.castAndDeproxy(nvn);
|
|
637 | 637 |
state.setCitation(true); |
638 | 638 |
boolean hasRefPart = false; |
639 | 639 |
Map<String, String> refMap = new HashMap<>(); |
... | ... | |
659 | 659 |
} |
660 | 660 |
|
661 | 661 |
|
662 |
private void doCitation(MarkupImportState state, TaxonNameBase<?,?> name,
|
|
662 |
private void doCitation(MarkupImportState state, TaxonName name, |
|
663 | 663 |
String classValue, TaxonRelationship misappliedRel, |
664 | 664 |
Reference reference, String microCitation, |
665 | 665 |
XMLEvent parentEvent) { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupSpecimenImport.java | ||
---|---|---|
50 | 50 |
import eu.etaxonomy.cdm.model.name.Rank; |
51 | 51 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
52 | 52 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
53 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
53 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
54 | 54 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
55 | 55 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
56 | 56 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
... | ... | |
137 | 137 |
} |
138 | 138 |
|
139 | 139 |
INonViralName firstName = null; |
140 |
Set<TaxonNameBase> names = homotypicalGroup.getTypifiedNames();
|
|
140 |
Set<TaxonName> names = homotypicalGroup.getTypifiedNames(); |
|
141 | 141 |
if (names.isEmpty()) { |
142 | 142 |
String message = "There is no name in a homotypical group. Can't create the specimen type"; |
143 | 143 |
fireWarningEvent(message, parentEvent, 8); |
... | ... | |
629 | 629 |
Rank defaultRank = Rank.SPECIES(); // can be any |
630 | 630 |
INonViralName nvn = createNameByCode(state, defaultRank); |
631 | 631 |
handleFullName(state, reader, nvn, next); |
632 |
TaxonNameBase<?,?> name = TaxonNameBase.castAndDeproxy(nvn);
|
|
632 |
TaxonName name = TaxonName.castAndDeproxy(nvn);
|
|
633 | 633 |
DeterminationEvent.NewInstance(name, facade.innerDerivedUnit() != null ? facade.innerDerivedUnit() : facade.innerFieldUnit()); |
634 | 634 |
} else if (isStartingElement(next, DATES)) { |
635 | 635 |
TimePeriod timePeriod = handleDates(state, reader, next); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/outputmodel/OutputModelClassificationExport.java | ||
---|---|---|
55 | 55 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
56 | 56 |
import eu.etaxonomy.cdm.model.name.Rank; |
57 | 57 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
58 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
58 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
59 | 59 |
import eu.etaxonomy.cdm.model.name.TypeComparator; |
60 | 60 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
61 | 61 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
141 | 141 |
|
142 | 142 |
}else{ |
143 | 143 |
try{ |
144 |
TaxonNameBase name = taxon.getName();
|
|
144 |
TaxonName name = taxon.getName(); |
|
145 | 145 |
handleName(state, name); |
146 | 146 |
for (Synonym syn : taxon.getSynonyms()){ |
147 | 147 |
handleSynonym(state, syn); |
... | ... | |
427 | 427 |
* @param syn |
428 | 428 |
*/ |
429 | 429 |
private void handleSynonym(OutputModelExportState state, Synonym syn) { |
430 |
TaxonNameBase name = syn.getName();
|
|
430 |
TaxonName name = syn.getName(); |
|
431 | 431 |
handleName(state, name); |
432 | 432 |
|
433 | 433 |
OutputModelTable table = OutputModelTable.SYNONYM; |
... | ... | |
446 | 446 |
* @param state |
447 | 447 |
* @param name |
448 | 448 |
*/ |
449 |
private void handleName(OutputModelExportState state, TaxonNameBase name) {
|
|
449 |
private void handleName(OutputModelExportState state, TaxonName name) { |
|
450 | 450 |
Rank rank = name.getRank(); |
451 | 451 |
OutputModelTable table = OutputModelTable.SCIENTIFIC_NAME; |
452 | 452 |
name = HibernateProxyHelper.deproxy(name); |
... | ... | |
645 | 645 |
* @param state |
646 | 646 |
* @param name |
647 | 647 |
*/ |
648 |
private void handleIdentifier(OutputModelExportState state, TaxonNameBase name, String[] csvLine, OutputModelTable table) {
|
|
648 |
private void handleIdentifier(OutputModelExportState state, TaxonName name, String[] csvLine, OutputModelTable table) { |
|
649 | 649 |
Set<String> IPNIidentifiers = name.getIdentifiers(DefinedTerm.IPNI_NAME_IDENTIFIER()); |
650 | 650 |
Set<String> tropicosIdentifiers = name.getIdentifiers(DefinedTerm.TROPICOS_NAME_IDENTIFIER()); |
651 | 651 |
Set<String> WFOIdentifiers = name.getIdentifiers(DefinedTerm.uuidWfoNameIdentifier); |
... | ... | |
775 | 775 |
* @param statusString |
776 | 776 |
* @return |
777 | 777 |
*/ |
778 |
private String extractStatusString(TaxonNameBase name, boolean abbrev) {
|
|
778 |
private String extractStatusString(TaxonName name, boolean abbrev) { |
|
779 | 779 |
Set<NomenclaturalStatus> status = name.getStatus(); |
780 | 780 |
if (status.isEmpty()){ |
781 | 781 |
return ""; |
... | ... | |
819 | 819 |
String[] csvLine = new String[table.getSize()]; |
820 | 820 |
|
821 | 821 |
csvLine[table.getIndex(OutputModelTable.HOMOTYPIC_GROUP_ID)] = getId(state, group); |
822 |
List<TaxonNameBase> typifiedNames = new ArrayList<>();
|
|
822 |
List<TaxonName> typifiedNames = new ArrayList<>(); |
|
823 | 823 |
typifiedNames.addAll(group.getTypifiedNames()); |
824 | 824 |
Collections.sort(typifiedNames, new HomotypicalGroupNameComparator(null, true)); |
825 | 825 |
String typifiedNamesString = ""; |
826 |
for (TaxonNameBase name: typifiedNames){
|
|
826 |
for (TaxonName name: typifiedNames){ |
|
827 | 827 |
//Concatenated output string for homotypic group (names and citations) + status + some name relations (e.g. “non”) |
828 | 828 |
//TODO: nameRelations, which and how to display |
829 | 829 |
|
... | ... | |
885 | 885 |
* @param name |
886 | 886 |
* @return |
887 | 887 |
*/ |
888 |
private String getTropicosTitleCache(TaxonNameBase name) {
|
|
888 |
private String getTropicosTitleCache(TaxonName name) { |
|
889 | 889 |
String basionymStart = "("; |
890 | 890 |
String basionymEnd = ") "; |
891 | 891 |
String exAuthorSeperator = " ex "; |
... | ... | |
1074 | 1074 |
* TypeDesignatedByRef_Fk |
1075 | 1075 |
*/ |
1076 | 1076 |
|
1077 |
private void handleTypeDesignations(OutputModelExportState state, TaxonNameBase name){
|
|
1077 |
private void handleTypeDesignations(OutputModelExportState state, TaxonName name){ |
|
1078 | 1078 |
Set<SpecimenTypeDesignation> typeDesignations = name.getTypeDesignations(); |
1079 | 1079 |
OutputModelTable table = OutputModelTable.TYPE_DESIGNATION; |
1080 | 1080 |
String nameId = getId(state, name); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pilotOutputHtml/PilotOutputDescriptionExporter.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.io.sdd.out.SDDDataSet; |
27 | 27 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
28 | 28 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
29 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
29 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
30 | 30 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
31 | 31 |
import eu.etaxonomy.cdm.model.reference.Reference; |
32 | 32 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
130 | 130 |
int agentRows = numberOfRows; |
131 | 131 |
int definedTermBaseRows = numberOfRows; |
132 | 132 |
int referenceBaseRows = numberOfRows; |
133 |
int taxonNameBaseRows = numberOfRows;
|
|
133 |
int taxonNameRows = numberOfRows; |
|
134 | 134 |
int taxonBaseRows = numberOfRows; |
135 | 135 |
int relationshipRows = numberOfRows; |
136 | 136 |
int occurrencesRows = numberOfRows; |
... | ... | |
173 | 173 |
} |
174 | 174 |
|
175 | 175 |
if (sddExpConfig.isDoTaxonNames() == true) { |
176 |
if (taxonNameBaseRows == 0) { taxonNameBaseRows = getNameService().count(TaxonNameBase.class); }
|
|
177 |
logger.info("# TaxonNameBase: " + taxonNameBaseRows);
|
|
176 |
if (taxonNameRows == 0) { taxonNameRows = getNameService().count(TaxonName.class); }
|
|
177 |
logger.info("# TaxonName: " + taxonNameRows);
|
|
178 | 178 |
//logger.info(" # Taxon: " + getNameService().count(BotanicalName.class)); |
179 |
sddDataSet.setTaxonomicNames(getNameService().list(null,taxonNameBaseRows, 0,null,null));
|
|
179 |
sddDataSet.setTaxonomicNames(getNameService().list(null,taxonNameRows, 0,null,null)); |
|
180 | 180 |
} |
181 | 181 |
|
182 | 182 |
if (sddExpConfig.isDoHomotypicalGroups() == true) { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pilotOutputHtml/PilotOutputDocumentBuilder.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 |
*/ |
... | ... | |
20 | 20 |
|
21 | 21 |
import eu.etaxonomy.cdm.io.jaxb.CdmMarshallerListener; |
22 | 22 |
import eu.etaxonomy.cdm.io.sdd.out.SDDDataSet; |
23 |
import eu.etaxonomy.cdm.model.common.Language; |
|
24 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
|
25 | 23 |
import eu.etaxonomy.cdm.model.common.Representation; |
26 | 24 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
27 | 25 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
... | ... | |
32 | 30 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue; |
33 | 31 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
34 | 32 |
import eu.etaxonomy.cdm.model.description.TextData; |
35 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
33 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
36 | 34 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
37 | 35 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
38 | 36 |
|
39 | 37 |
/** |
40 |
* Writes the SDD XML file.
|
|
41 |
*
|
|
38 |
* Writes the SDD XML file. |
|
39 |
* |
|
42 | 40 |
* @author h.fradin |
43 | 41 |
* @created 10.12.2008 |
44 | 42 |
* @version 1.0 |
... | ... | |
59 | 57 |
public void marshal(SDDDataSet cdmSource, String sddDestination) throws IOException { |
60 | 58 |
|
61 | 59 |
this.cdmSource = cdmSource; |
62 |
Marshaller marshaller;
|
|
60 |
Marshaller marshaller; |
|
63 | 61 |
CdmMarshallerListener marshallerListener = new CdmMarshallerListener(); |
64 | 62 |
logger.info("Start marshalling"); |
65 | 63 |
writeCDMtoHTML(sddDestination); |
... | ... | |
104 | 102 |
*/ |
105 | 103 |
public String writeTaxonDescriptionsToHTML(Taxon taxon, String texte) throws IOException { |
106 | 104 |
|
Also available in: Unified diff
fix #6368 rename table and class TaxonNameBase