Revision d7919b1c
Added by Andreas Müller about 7 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java | ||
---|---|---|
43 | 43 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
44 | 44 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
45 | 45 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
46 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
46 | 47 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
47 | 48 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
48 | 49 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
49 | 50 |
import eu.etaxonomy.cdm.model.name.Rank; |
51 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
50 | 52 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
51 | 53 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
52 | 54 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
260 | 262 |
serviceUrl.getPath() |
261 | 263 |
+ "?" + request); |
262 | 264 |
|
263 |
|
|
264 | 265 |
URI newUri = newUrl.toURI(); |
265 |
|
|
266 | 266 |
logger.info("Firing request for URI: " + newUri); |
267 |
|
|
268 | 267 |
HttpResponse response = UriUtils.getResponse(newUri, null); |
269 | 268 |
|
270 | 269 |
int responseCode = response.getStatusLine().getStatusCode(); |
... | ... | |
434 | 433 |
} |
435 | 434 |
|
436 | 435 |
|
437 |
private List<BotanicalName> buildNameList( InputStream content, ICdmApplicationConfiguration appConfig, IIpniServiceConfigurator iConfig) throws IOException {
|
|
436 |
private List<TaxonNameBase<?,?>> buildNameList( InputStream content, ICdmApplicationConfiguration appConfig, IIpniServiceConfigurator iConfig) throws IOException {
|
|
438 | 437 |
IpniServiceNamesConfigurator config = (IpniServiceNamesConfigurator)iConfig; |
439 |
List<BotanicalName> result = new ArrayList<BotanicalName>();
|
|
438 |
List<TaxonNameBase<?,?>> result = new ArrayList<>();
|
|
440 | 439 |
BufferedReader reader = new BufferedReader (new InputStreamReader(content)); |
441 | 440 |
|
442 | 441 |
String headerLine = reader.readLine(); |
... | ... | |
445 | 444 |
String line = reader.readLine(); |
446 | 445 |
while (StringUtils.isNotBlank(line)){ |
447 | 446 |
|
448 |
BotanicalName name = getNameFromLine(line,parameterMap, appConfig);
|
|
447 |
TaxonNameBase<?,?> name = (TaxonNameBase<?,?>)getNameFromLine(line,parameterMap, appConfig);
|
|
449 | 448 |
result.add(name); |
450 | 449 |
line = reader.readLine(); |
451 | 450 |
|
... | ... | |
456 | 455 |
} |
457 | 456 |
|
458 | 457 |
|
459 |
private BotanicalName getNameFromLine(String line, Map<Integer, String> parameterMap, ICdmApplicationConfiguration appConfig) { |
|
458 |
private IBotanicalName getNameFromLine(String line, Map<Integer, String> parameterMap, ICdmApplicationConfiguration appConfig) {
|
|
460 | 459 |
//Id%Version%Standard form%Default author forename%Default author surname%Taxon groups%Dates%Alternative names |
461 | 460 |
String[] splits = line.split("%"); |
462 | 461 |
Map<String, String> valueMap = new HashMap<String, String>(); |
... | ... | |
465 | 464 |
valueMap.put(parameterMap.get(i), splits[i]); |
466 | 465 |
} |
467 | 466 |
|
468 |
BotanicalName name = TaxonNameFactory.NewBotanicalInstance(null); |
|
467 |
IBotanicalName name = TaxonNameFactory.NewBotanicalInstance(null);
|
|
469 | 468 |
|
470 | 469 |
//caches |
471 | 470 |
name.setNameCache(valueMap.get(FULL_NAME_WITHOUT_FAMILY_AND_AUTHORS), true); |
... | ... | |
514 | 513 |
name.addAnnotation(annotation); |
515 | 514 |
|
516 | 515 |
//basionym |
517 |
BotanicalName basionym = TaxonNameFactory.NewBotanicalInstance(null);
|
|
516 |
TaxonNameBase<?,?> basionym = TaxonNameFactory.NewBotanicalInstance(null);
|
|
518 | 517 |
basionym.setTitleCache(valueMap.get(BASIONYM), true); |
519 | 518 |
name.addBasionym(basionym); |
520 | 519 |
|
521 | 520 |
//replaced synonym |
522 |
BotanicalName replacedSynoynm = TaxonNameFactory.NewBotanicalInstance(null);
|
|
521 |
TaxonNameBase<?,?> replacedSynoynm = TaxonNameFactory.NewBotanicalInstance(null);
|
|
523 | 522 |
replacedSynoynm.setTitleCache(valueMap.get(REPLACED_SYNONYM), true); |
524 | 523 |
name.addReplacedSynonym(replacedSynoynm, null, null, null); |
525 | 524 |
|
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java | ||
---|---|---|
19 | 19 |
import eu.etaxonomy.cdm.model.agent.Person; |
20 | 20 |
import eu.etaxonomy.cdm.model.common.Extension; |
21 | 21 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
22 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.name.Rank; |
23 | 24 |
import eu.etaxonomy.cdm.model.reference.Reference; |
24 | 25 |
|
... | ... | |
110 | 111 |
|
111 | 112 |
if (testInternetConnectivity(nameList)){ |
112 | 113 |
Assert.assertEquals("There should be exactly 1 result for 'Abies albertiana'", 1, nameList.size()); |
113 |
BotanicalName name = nameList.get(0); |
|
114 |
IBotanicalName name = nameList.get(0);
|
|
114 | 115 |
//title cache |
115 | 116 |
Assert.assertEquals("Title Cache for Abies albertiana should be 'Abies albertiana'", "Abies albertiana A.Murray bis", name.getTitleCache()); |
116 | 117 |
|
117 |
// for (BotanicalName listName : nameList){ |
|
118 |
// for (IBotanicalName listName : nameList){
|
|
118 | 119 |
// System.out.println(name.getFullTitleCache()); |
119 | 120 |
// } |
120 | 121 |
} |
... | ... | |
150 | 151 |
if (testInternetConnectivity(nameList)){ |
151 | 152 |
|
152 | 153 |
Assert.assertEquals("There should be exactly 1 result for 'Abies', 'alba', 'B*', Infraspecific ", 1, nameList.size()); |
153 |
BotanicalName name = nameList.get(0); |
|
154 |
IBotanicalName name = nameList.get(0);
|
|
154 | 155 |
//title cache |
155 | 156 |
Assert.assertEquals("Title Cache for 'Abies', 'alba', 'ap*' should be 'Abies alba subsp. apennina Brullo, Scelsi & Spamp.'", "Abies alba subsp. apennina Brullo, Scelsi & Spamp.", name.getTitleCache()); |
156 | 157 |
|
157 |
// for (BotanicalName listName : nameList){ |
|
158 |
// for (IBotanicalName listName : nameList){
|
|
158 | 159 |
// System.out.println(name.getFullTitleCache()); |
159 | 160 |
// } |
160 | 161 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.model.common.DefinedTerm; |
37 | 37 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
38 | 38 |
import eu.etaxonomy.cdm.model.common.ExtensionType; |
39 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
|
39 | 40 |
import eu.etaxonomy.cdm.model.common.IOriginalSource; |
40 | 41 |
import eu.etaxonomy.cdm.model.common.ISourceable; |
41 | 42 |
import eu.etaxonomy.cdm.model.common.IdentifiableEntity; |
... | ... | |
925 | 926 |
* @param citation |
926 | 927 |
* @throws SQLException |
927 | 928 |
*/ |
928 |
public void addOriginalSource(CdmBase cdmBase, Object idAttributeValue, String namespace, Reference citation) { |
|
929 |
public void addOriginalSource(ICdmBase cdmBase, Object idAttributeValue, String namespace, Reference citation) {
|
|
929 | 930 |
if (cdmBase instanceof ISourceable ){ |
930 | 931 |
IOriginalSource source; |
931 | 932 |
ISourceable sourceable = (ISourceable<?>)cdmBase; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/ImportHelper.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.cdm.model.common.AnnotatableEntity; |
25 | 25 |
import eu.etaxonomy.cdm.model.common.Annotation; |
26 | 26 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
27 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
|
27 | 28 |
import eu.etaxonomy.cdm.model.common.IOriginalSource; |
28 | 29 |
import eu.etaxonomy.cdm.model.common.ISourceable; |
29 | 30 |
import eu.etaxonomy.cdm.model.common.IdentifiableEntity; |
... | ... | |
84 | 85 |
// return addValue(rs, cdmBase, dbAttrName, cdmAttrName, String.class, overwriteNull); |
85 | 86 |
// } |
86 | 87 |
|
87 |
public static boolean addBooleanValue(ResultSet rs, CdmBase cdmBase, String dbAttrName, String cdmAttrName){ |
|
88 |
public static boolean addBooleanValue(ResultSet rs, ICdmBase cdmBase, String dbAttrName, String cdmAttrName){
|
|
88 | 89 |
return addValue(rs, cdmBase, dbAttrName, cdmAttrName, boolean.class, OVERWRITE, false); |
89 | 90 |
} |
90 | 91 |
|
91 |
public static boolean addValue(ResultSet rs, CdmBase cdmBase, String dbAttrName, String cdmAttrName, Class clazz, boolean overwriteNull, boolean blankToNull){ |
|
92 |
public static boolean addValue(ResultSet rs, ICdmBase cdmBase, String dbAttrName, String cdmAttrName, Class clazz, boolean overwriteNull, boolean blankToNull){
|
|
92 | 93 |
Object strValue; |
93 | 94 |
try { |
94 | 95 |
strValue = rs.getObject(dbAttrName); |
... | ... | |
130 | 131 |
return addValue(strValue, cdmBase, cdmAttrName, clazz, overwriteNull, obligat); |
131 | 132 |
} |
132 | 133 |
|
133 |
public static boolean addValue(Object sourceValue, CdmBase cdmBase, String cdmAttrName, Class<?> clazz, boolean overwriteNull, boolean obligat){ |
|
134 |
public static boolean addValue(Object sourceValue, ICdmBase cdmBase, String cdmAttrName, Class<?> clazz, boolean overwriteNull, boolean obligat){
|
|
134 | 135 |
String methodName; |
135 | 136 |
// Object strValue; |
136 | 137 |
try { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/caryophyllales/out/CsvNameExport.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
36 | 36 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
37 | 37 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroupComparator; |
38 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
38 | 39 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
39 | 40 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
40 | 41 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
... | ... | |
226 | 227 |
|
227 | 228 |
|
228 | 229 |
|
229 |
private String createSynonymNameString(BotanicalName synonymName, boolean isInvalid) { |
|
230 |
private String createSynonymNameString(IBotanicalName synonymName, boolean isInvalid) {
|
|
230 | 231 |
String synonymString = null; |
231 | 232 |
|
232 | 233 |
synonymString= createTaggedNameString(synonymName, isInvalid); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DwcTaxonStreamItem2CdmTaxonConverter.java | ||
---|---|---|
508 | 508 |
String strScientificName = getValue(item, TermUri.DWC_SCIENTIFIC_NAME); |
509 | 509 |
//Name |
510 | 510 |
if (strScientificName != null){ |
511 |
name = parser.parseFullName(strScientificName, nomCode, rank); |
|
511 |
name = (TaxonNameBase<?,?>)parser.parseFullName(strScientificName, nomCode, rank);
|
|
512 | 512 |
if ( rank != null && name != null && name.getRank() != null && ! rank.equals(name.getRank())){ |
513 | 513 |
if (config.isValidateRankConsistency()){ |
514 | 514 |
String message = "Parsed rank %s (%s) differs from rank %s given by fields 'taxonRank' or 'verbatimTaxonRank'"; |
... | ... | |
610 | 610 |
|
611 | 611 |
|
612 | 612 |
//TODO we may configure in configuration that scientific name never includes Authorship |
613 |
private void checkAuthorship(TaxonNameBase nameBase, StreamItem item) { |
|
613 |
private void checkAuthorship(TaxonNameBase<?,?> nameBase, StreamItem item) {
|
|
614 | 614 |
if (!nameBase.isInstanceOf(NonViralName.class)){ |
615 | 615 |
return; |
616 | 616 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/GbifReferenceCsv2CdmConverter.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
33 | 33 |
import eu.etaxonomy.cdm.model.description.TextData; |
34 | 34 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
35 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
35 | 36 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
36 | 37 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
37 | 38 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
... | ... | |
145 | 146 |
Integer combYear = null; |
146 | 147 |
Integer origYear = null; |
147 | 148 |
if (nvn.isInstanceOf(ZoologicalName.class)){ |
148 |
ZoologicalName zooName = CdmBase.deproxy(nvn, ZoologicalName.class); |
|
149 |
IZoologicalName zooName = CdmBase.deproxy(nvn, ZoologicalName.class);
|
|
149 | 150 |
combYear = zooName.getPublicationYear(); |
150 | 151 |
origYear = zooName.getOriginalPublicationYear(); |
151 | 152 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/SpecimenImportBase.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
48 | 48 |
import eu.etaxonomy.cdm.model.name.CultivarPlantName; |
49 | 49 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
50 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
|
50 | 51 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
51 | 52 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
52 | 53 |
import eu.etaxonomy.cdm.model.name.Rank; |
... | ... | |
100 | 101 |
|
101 | 102 |
|
102 | 103 |
protected TaxonNameBase<?, ?> getOrCreateTaxonName(String scientificName, Rank rank, boolean preferredFlag, STATE state, int unitIndexInAbcdFile){ |
103 |
TaxonNameBase<?, ?> taxonName = null;
|
|
104 |
TaxonNameBase<?,?> taxonName = null; |
|
104 | 105 |
SpecimenImportConfiguratorBase<?,?> config = state.getConfig(); |
105 | 106 |
|
106 | 107 |
//check atomised name data for rank |
... | ... | |
115 | 116 |
if(config.isReuseExistingTaxaWhenPossible()){ |
116 | 117 |
TaxonNameBase<?,?> parsedName = atomisedTaxonName; |
117 | 118 |
if(parsedName==null){ |
118 |
parsedName = parseScientificName(scientificName, state, state.getReport()); |
|
119 |
parsedName = (TaxonNameBase<?,?>)parseScientificName(scientificName, state, state.getReport());
|
|
119 | 120 |
} |
120 | 121 |
atomisedTaxonName = parsedName; |
121 | 122 |
if(config.isIgnoreAuthorship() && parsedName!=null && preferredFlag){ |
122 | 123 |
// do not ignore authorship for non-preferred names because they need |
123 | 124 |
// to be created for the determination history |
124 |
String nameCache = parsedName.getNameCache();
|
|
125 |
String nameCache = TaxonNameBase.castAndDeproxy(parsedName).getNameCache();
|
|
125 | 126 |
List<NonViralName> names = getNameService().findNamesByNameCache(nameCache, MatchMode.EXACT, null); |
126 | 127 |
if (!names.isEmpty()){ |
127 | 128 |
return getBestMatchingName(scientificName, new ArrayList<TaxonNameBase>(names), state); |
... | ... | |
220 | 221 |
* @param report the import report |
221 | 222 |
* @return a parsed name |
222 | 223 |
*/ |
223 |
protected TaxonNameBase<?,?> parseScientificName(String scientificName, STATE state, SpecimenImportReport report) {
|
|
224 |
protected ITaxonNameBase parseScientificName(String scientificName, STATE state, SpecimenImportReport report) {
|
|
224 | 225 |
NonViralNameParserImpl nvnpi = NonViralNameParserImpl.NewInstance(); |
225 |
TaxonNameBase<?,?> taxonName = null;
|
|
226 |
ITaxonNameBase taxonName = null;
|
|
226 | 227 |
boolean problem = false; |
227 | 228 |
|
228 | 229 |
if(DEBUG){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenCdmExcelImport.java | ||
---|---|---|
45 | 45 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
46 | 46 |
import eu.etaxonomy.cdm.model.location.ReferenceSystem; |
47 | 47 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
48 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
48 | 49 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
49 | 50 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
50 | 51 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
... | ... | |
539 | 540 |
if (StringUtils.isNotBlank(commonDetermination.determinedBy)){ |
540 | 541 |
sec = ReferenceFactory.newGeneric(); |
541 | 542 |
TeamOrPersonBase<?> determinedBy; |
542 |
BotanicalName dummyName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
543 |
IBotanicalName dummyName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
543 | 544 |
try { |
544 | 545 |
parser.parseAuthors(dummyName, commonDetermination.determinedBy); |
545 | 546 |
determinedBy = dummyName.getCombinationAuthorship(); |
... | ... | |
644 | 645 |
* @param determinationLight |
645 | 646 |
* @return |
646 | 647 |
*/ |
647 |
private NonViralName<?> makeTaxonName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) {
|
|
648 |
NonViralName<?> name = TaxonNameFactory.NewNonViralInstance(null);
|
|
648 |
private INonViralName makeTaxonName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) {
|
|
649 |
INonViralName name = TaxonNameFactory.NewNonViralInstance(null);
|
|
649 | 650 |
NomenclaturalCode nc = state.getConfig().getNomenclaturalCode(); |
650 | 651 |
if (nc != null){ |
651 |
name = (NonViralName<?>)nc.getNewTaxonNameInstance(null);
|
|
652 |
name = nc.getNewTaxonNameInstance(null); |
|
652 | 653 |
} |
653 | 654 |
name.setGenusOrUninomial(determinationLight.genus); |
654 | 655 |
name.setSpecificEpithet(determinationLight.speciesEpi); |
... | ... | |
686 | 687 |
|
687 | 688 |
private TaxonNameBase findBestMatchingName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) { |
688 | 689 |
|
689 |
NonViralName<?> name = makeTaxonName(state, determinationLight);
|
|
690 |
INonViralName name = makeTaxonName(state, determinationLight);
|
|
690 | 691 |
String titleCache = makeSearchNameTitleCache(state, determinationLight, name); |
691 | 692 |
|
692 | 693 |
//TODO |
... | ... | |
832 | 833 |
} |
833 | 834 |
|
834 | 835 |
|
835 |
private TaxonNameBase<?, ?> getTaxonName(SpecimenCdmExcelImportState state, String name) {
|
|
836 |
private TaxonNameBase<?,?> getTaxonName(SpecimenCdmExcelImportState state, String name) { |
|
836 | 837 |
TaxonNameBase<?,?> result = null; |
837 | 838 |
result = state.getName(name); |
838 | 839 |
if (result != null){ |
... | ... | |
846 | 847 |
if (result == null){ |
847 | 848 |
NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance(); |
848 | 849 |
NomenclaturalCode code = state.getConfig().getNomenclaturalCode(); |
849 |
result = parser.parseFullName(name, code, null); |
|
850 |
result = (TaxonNameBase<?,?>)parser.parseFullName(name, code, null);
|
|
850 | 851 |
|
851 | 852 |
} |
852 | 853 |
if (result != null){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenSythesysExcelImport.java | ||
---|---|---|
48 | 48 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
49 | 49 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
50 | 50 |
import eu.etaxonomy.cdm.model.media.Media; |
51 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
|
51 | 52 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
52 |
import eu.etaxonomy.cdm.model.name.NonViralName;
|
|
53 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
53 | 54 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
54 | 55 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
55 | 56 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
392 | 393 |
* @param sec |
393 | 394 |
*/ |
394 | 395 |
private void setTaxonNameBase(SpecimenSynthesysExcelImportConfigurator config){ |
395 |
NonViralName<?> taxonName = null;
|
|
396 |
ITaxonNameBase taxonName = null;
|
|
396 | 397 |
Taxon taxon = null; |
397 | 398 |
|
398 | 399 |
String scientificName=""; |
... | ... | |
454 | 455 |
taxonName = TaxonNameFactory.NewNonViralInstance(null); |
455 | 456 |
taxonName.setTitleCache(scientificName, true); |
456 | 457 |
} |
457 |
getNameService().save(taxonName); |
|
458 |
getNameService().save((TaxonNameBase<?,?>)taxonName);
|
|
458 | 459 |
taxon = Taxon.NewInstance(taxonName, ref); //sec set null |
459 | 460 |
getTaxonService().save(taxon); |
460 | 461 |
// refreshTransaction(); |
... | ... | |
508 | 509 |
return (Taxon) getTaxonService().find(taxon.getUuid()); |
509 | 510 |
} |
510 | 511 |
|
511 |
private NonViralName<?> parseScientificName(String scientificName){
|
|
512 |
private ITaxonNameBase parseScientificName(String scientificName){
|
|
512 | 513 |
if (DEBUG) { |
513 | 514 |
logger.debug("in parseScientificName"); |
514 | 515 |
} |
515 | 516 |
NonViralNameParserImpl nvnpi = NonViralNameParserImpl.NewInstance(); |
516 |
NonViralName<?>taxonName = null;
|
|
517 |
ITaxonNameBase taxonName = null;
|
|
517 | 518 |
boolean problem=false; |
518 | 519 |
|
519 | 520 |
if (DEBUG) { |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx2013/TaxonXAddSources.java | ||
---|---|---|
19 | 19 |
import eu.etaxonomy.cdm.model.description.IndividualsAssociation; |
20 | 20 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
21 | 21 |
import eu.etaxonomy.cdm.model.description.TextData; |
22 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
23 | 24 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
24 | 25 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
187 | 188 |
* @param refMods |
188 | 189 |
* @param nameToBeFilled |
189 | 190 |
*/ |
190 |
protected void addSource(Reference refMods, TaxonNameBase<?,?> nameToBeFilled) {
|
|
191 |
protected void addSource(Reference refMods, ITaxonNameBase nameToBeFilled) {
|
|
191 | 192 |
//logger.info("addSource"); |
192 | 193 |
sourceUrlRef=CdmBase.deproxy(sourceUrlRef, Reference.class); |
193 | 194 |
Reference sec = CdmBase.deproxy(configState.getConfig().getSecundum(), Reference.class); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx2013/TaxonXTreatmentExtractor.java | ||
---|---|---|
49 | 49 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
50 | 50 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
51 | 51 |
import eu.etaxonomy.cdm.model.description.TextData; |
52 |
import eu.etaxonomy.cdm.model.name.BacterialName; |
|
53 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
54 | 52 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
55 | 53 |
import eu.etaxonomy.cdm.model.name.ITaxonNameBase; |
56 | 54 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
57 | 55 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
58 | 56 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
59 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
60 | 57 |
import eu.etaxonomy.cdm.model.name.Rank; |
61 | 58 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
62 | 59 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
... | ... | |
1587 | 1584 |
} |
1588 | 1585 |
|
1589 | 1586 |
|
1590 |
private boolean addFollowingTextToName(TaxonNameBase nameToBeFilled, String followingText) { |
|
1587 |
private boolean addFollowingTextToName(ITaxonNameBase nameToBeFilled, String followingText) {
|
|
1591 | 1588 |
if (nameToBeFilled != null && StringUtils.isNotBlank(followingText)){ |
1592 | 1589 |
if (! followingText.matches("\\d\\.?")){ |
1593 | 1590 |
|
... | ... | |
1617 | 1614 |
acceptedTaxon = CdmBase.deproxy(acceptedTaxon, Taxon.class); |
1618 | 1615 |
|
1619 | 1616 |
NodeList children = refgroup.getChildNodes(); |
1620 |
NonViralName<?> nameToBeFilled = getNonViralNameAccNomenclature();
|
|
1617 |
INonViralName nameToBeFilled = getNonViralNameAccNomenclature();
|
|
1621 | 1618 |
|
1622 | 1619 |
ReferenceBuilder refBuild = new ReferenceBuilder(sourceHandler); |
1623 | 1620 |
for (int i=0;i<children.getLength();i++){ |
... | ... | |
1665 | 1662 |
* @return |
1666 | 1663 |
*/ |
1667 | 1664 |
|
1668 |
private NonViralName<?> getNonViralNameAccNomenclature() {
|
|
1669 |
return (NonViralName<?>)nomenclaturalCode.getNewTaxonNameInstance(null);
|
|
1665 |
private INonViralName getNonViralNameAccNomenclature() {
|
|
1666 |
return nomenclaturalCode.getNewTaxonNameInstance(null); |
|
1670 | 1667 |
} |
1671 | 1668 |
|
1672 | 1669 |
/** |
... | ... | |
1692 | 1689 |
* handle cases where the bibref are inside <p> and outside |
1693 | 1690 |
*/ |
1694 | 1691 |
@SuppressWarnings("rawtypes") |
1695 |
private void extractReferenceRawText(NodeList references, NonViralName<?> nameToBeFilled, Reference refMods,
|
|
1692 |
private void extractReferenceRawText(NodeList references, INonViralName nameToBeFilled, Reference refMods,
|
|
1696 | 1693 |
Taxon acceptedTaxon) { |
1697 | 1694 |
logger.info("extractReferenceRawText"); |
1698 | 1695 |
String refString=""; |
... | ... | |
1975 | 1972 |
nameTBF = TaxonNameFactory.NewBotanicalInstance(null); |
1976 | 1973 |
} |
1977 | 1974 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICZN)){ |
1978 |
nameTBF = ZoologicalName.NewInstance(null);
|
|
1975 |
nameTBF = TaxonNameFactory.NewZoologicalInstance(null);
|
|
1979 | 1976 |
} |
1980 | 1977 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNB)){ |
1981 |
nameTBF= BacterialName.NewInstance(null);
|
|
1978 |
nameTBF= TaxonNameFactory.NewBacterialInstance(null);
|
|
1982 | 1979 |
} |
1983 | 1980 |
parser.parseReferencedName(nameTBF, fullname, rank, false); |
1984 | 1981 |
retry++; |
... | ... | |
2093 | 2090 |
// System.out.println("COLLECTION EVENT INSIDE NOMENCLATURE"); |
2094 | 2091 |
extractMaterialsDirect(childNode, acceptedTaxon, refMods, "collection", currentMyName.getTaxonNameBase()); |
2095 | 2092 |
}else if(childName.equalsIgnoreCase("tax:name")){ |
2096 |
NonViralName<?> nameToBeFilled;
|
|
2093 |
INonViralName nameToBeFilled;
|
|
2097 | 2094 |
//System.out.println("HANDLE FIRST NAME OF THE LIST"); |
2098 | 2095 |
if(!containsSynonyms){ |
2099 | 2096 |
wasSynonym = false; |
... | ... | |
2220 | 2217 |
}else if (childName.equalsIgnoreCase("tax:bibref")){ |
2221 | 2218 |
logger.warn(childName + " still preliminary"); |
2222 | 2219 |
|
2223 |
NonViralName<?> currentName = currentMyName == null ? null : currentMyName.getTaxonNameBase();
|
|
2220 |
INonViralName currentName = currentMyName == null ? null : currentMyName.getTaxonNameBase();
|
|
2224 | 2221 |
boolean handled = addFollowingTextToName (currentName, childNode.getTextContent() ); |
2225 | 2222 |
if (! handled){ |
2226 | 2223 |
setParticularDescription(freetext.trim(), acceptedTaxon,acceptedTaxon, refMods, getNotMarkedUpFeatureObject()); |
... | ... | |
2230 | 2227 |
} |
2231 | 2228 |
if(!stringIsEmpty(freetext.trim())) {; |
2232 | 2229 |
if (! freetext.matches("\\d\\.?")){ |
2233 |
NonViralName<?> currentName = currentMyName == null ? null : currentMyName.getTaxonNameBase();
|
|
2230 |
INonViralName currentName = currentMyName == null ? null : currentMyName.getTaxonNameBase();
|
|
2234 | 2231 |
boolean handled = false; |
2235 | 2232 |
if (currentName != null && !wasSynonym){ |
2236 | 2233 |
handled = addFollowingTextToName (currentName, childNode.getTextContent() ); |
... | ... | |
2308 | 2305 |
nameToBeFilled = TaxonNameFactory.NewBotanicalInstance(null); |
2309 | 2306 |
} |
2310 | 2307 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICZN)){ |
2311 |
nameToBeFilled = ZoologicalName.NewInstance(null);
|
|
2308 |
nameToBeFilled = TaxonNameFactory.NewZoologicalInstance(null);
|
|
2312 | 2309 |
} |
2313 | 2310 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNB)){ |
2314 |
nameToBeFilled = BacterialName.NewInstance(null);
|
|
2311 |
nameToBeFilled = TaxonNameFactory.NewBacterialInstance(null);
|
|
2315 | 2312 |
} |
2316 | 2313 |
nameToBeFilled.setTitleCache(s, true); |
2317 | 2314 |
nameToBeFilled.setRank(getRank(r), true); |
... | ... | |
3050 | 3047 |
private void createUnparsedSynonymNew(Rank rank, String newName, HashMap<String, String> atomisedMap, MyName myname, Reference refMods) { |
3051 | 3048 |
logger.info("createSynonym"); |
3052 | 3049 |
|
3053 |
NonViralName<?> nameToBeFilled = this.getNonViralNameAccNomenclature();
|
|
3050 |
INonViralName nameToBeFilled = this.getNonViralNameAccNomenclature();
|
|
3054 | 3051 |
//System.out.println("createsynonym"); |
3055 | 3052 |
if(rank.equals(Rank.UNKNOWN_RANK())){ |
3056 | 3053 |
//TODO |
... | ... | |
3209 | 3206 |
classification = classification2; |
3210 | 3207 |
} |
3211 | 3208 |
|
3212 |
/** |
|
3213 |
* @param tnb |
|
3214 |
* cast the current taxonnamebase into a botanical name or zoological or bacterial name |
|
3215 |
* if errors, cast into a classis nonviralname |
|
3216 |
* @param taxonnamebase2 |
|
3217 |
*/ |
|
3218 |
@SuppressWarnings("rawtypes") |
|
3219 |
public NonViralName<?> castTaxonNameBase(TaxonNameBase tnb, NonViralName<?> nvn) { |
|
3220 |
|
|
3221 |
//logger.info("castTaxonNameBase"); |
|
3222 |
NonViralName<?> taxonnamebase2 = nvn; |
|
3223 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNAFP)) { |
|
3224 |
try{ |
|
3225 |
taxonnamebase2=(BotanicalName) tnb; |
|
3226 |
}catch(Exception e){ |
|
3227 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3228 |
} |
|
3229 |
} |
|
3230 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICZN)) { |
|
3231 |
try{ |
|
3232 |
taxonnamebase2=(ZoologicalName) tnb; |
|
3233 |
}catch(Exception e){ |
|
3234 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3235 |
} |
|
3236 |
} |
|
3237 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNB)) { |
|
3238 |
try{ |
|
3239 |
taxonnamebase2=(BacterialName) tnb; |
|
3240 |
}catch(Exception e){ |
|
3241 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3242 |
} |
|
3243 |
} |
|
3244 |
return taxonnamebase2; |
|
3245 |
} |
|
3246 | 3209 |
|
3247 |
/** |
|
3248 |
* @param tnb |
|
3249 |
* cast the current taxonnamebase into a botanical name or zoological or bacterial name |
|
3250 |
* if errors, cast into a classis nonviralname |
|
3251 |
* @param taxonnamebase2 |
|
3252 |
*/ |
|
3253 |
@SuppressWarnings("rawtypes") |
|
3254 |
public NonViralName<?> castTaxonNameBase(TaxonNameBase tnb) { |
|
3255 |
//logger.info("castTaxonNameBase2"); |
|
3256 |
NonViralName<?> taxonnamebase2 = null; |
|
3257 |
tnb=CdmBase.deproxy(tnb, TaxonNameBase.class); |
|
3258 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNAFP)) { |
|
3259 |
try{ |
|
3260 |
taxonnamebase2=(BotanicalName) tnb; |
|
3261 |
}catch(Exception e){ |
|
3262 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3263 |
} |
|
3264 |
} |
|
3265 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICZN)) { |
|
3266 |
try{ |
|
3267 |
taxonnamebase2=(ZoologicalName) tnb; |
|
3268 |
}catch(Exception e){ |
|
3269 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3270 |
} |
|
3271 |
} |
|
3272 |
if (nomenclaturalCode.equals(NomenclaturalCode.ICNB)) { |
|
3273 |
try{ |
|
3274 |
taxonnamebase2=(BacterialName) tnb; |
|
3275 |
}catch(Exception e){ |
|
3276 |
taxonnamebase2= (NonViralName<?>) tnb; |
|
3277 |
} |
|
3278 |
} |
|
3279 |
return taxonnamebase2; |
|
3280 |
} |
|
3281 | 3210 |
|
3282 | 3211 |
public class MyName { |
3283 | 3212 |
/** |
... | ... | |
3295 | 3224 |
String status=""; |
3296 | 3225 |
String author=null; |
3297 | 3226 |
|
3298 |
NonViralName<?> taxonNameBase;
|
|
3227 |
TaxonNameBase<?,?> taxonNameBase;
|
|
3299 | 3228 |
|
3300 | 3229 |
Reference refMods ; |
3301 | 3230 |
|
3302 | 3231 |
Taxon family,subfamily,tribe,subtribe,genus,subgenus,species,subspecies, variety,form; |
3303 |
NonViralName<?> familyName, subfamilyName, tribeName,subtribeName,genusName,subgenusName,speciesName,subspeciesName;
|
|
3232 |
INonViralName familyName, subfamilyName, tribeName,subtribeName,genusName,subgenusName,speciesName,subspeciesName;
|
|
3304 | 3233 |
String familyStr, subfamilyStr, tribeStr,subtribeStr,genusStr,subgenusStr,speciesStr,subspeciesStr,formStr,varietyStr; |
3305 | 3234 |
Integer publicationYear; |
3306 | 3235 |
|
... | ... | |
3608 | 3537 |
this.syno=(Synonym)tmpTaxonBase; |
3609 | 3538 |
} |
3610 | 3539 |
|
3611 |
taxonNameBase = castTaxonNameBase(tnb, taxonNameBase);
|
|
3540 |
taxonNameBase = tnb;
|
|
3612 | 3541 |
|
3613 | 3542 |
} |
3614 | 3543 |
|
... | ... | |
3692 | 3621 |
author1=taxonNameBase.getAuthorshipCache(); |
3693 | 3622 |
} |
3694 | 3623 |
try { |
3695 |
if(castTaxonNameBase(bestMatchingTaxon.getName()).getAuthorshipCache()!=null) {
|
|
3696 |
author2=castTaxonNameBase(bestMatchingTaxon.getName()).getAuthorshipCache();
|
|
3624 |
if(bestMatchingTaxon.getName().getAuthorshipCache()!=null) {
|
|
3625 |
author2=bestMatchingTaxon.getName().getAuthorshipCache();
|
|
3697 | 3626 |
} |
3698 | 3627 |
} catch (Exception e) { |
3699 | 3628 |
// TODO Auto-generated catch block |
... | ... | |
3898 | 3827 |
/** |
3899 | 3828 |
* @param nameToBeFilledTest |
3900 | 3829 |
*/ |
3901 |
@SuppressWarnings("rawtypes") |
|
3902 | 3830 |
public void setParsedName(ITaxonNameBase nameToBeFilledTest) { |
3903 |
this.taxonNameBase = (NonViralName<?>) nameToBeFilledTest;
|
|
3831 |
this.taxonNameBase = TaxonNameBase.castAndDeproxy(nameToBeFilledTest);
|
|
3904 | 3832 |
|
3905 | 3833 |
} |
3906 | 3834 |
//variety dwcranks:varietyEpithet |
... | ... | |
3919 | 3847 |
/** |
3920 | 3848 |
* @return |
3921 | 3849 |
*/ |
3922 |
public NonViralName<?> getTaxonNameBase() {
|
|
3850 |
public TaxonNameBase<?,?> getTaxonNameBase() {
|
|
3923 | 3851 |
return taxonNameBase; |
3924 | 3852 |
} |
3925 | 3853 |
|
... | ... | |
4046 | 3974 |
} |
4047 | 3975 |
if ((tmp == null || !foundIdentic) || (tmp != null && !statusMatch) || (tmp != null && !appendedMatch && !statusMatch)){ |
4048 | 3976 |
|
4049 |
NonViralName<?> tnb = getNonViralNameAccNomenclature();
|
|
3977 |
INonViralName tnb = getNonViralNameAccNomenclature();
|
|
4050 | 3978 |
tnb.setRank(rank); |
4051 | 3979 |
|
4052 | 3980 |
if(statusType != null) { |
... | ... | |
4141 | 4069 |
* @param tnb |
4142 | 4070 |
* @return |
4143 | 4071 |
*/ |
4144 |
private Taxon buildSubfamily(NonViralName<?> tnb) {
|
|
4072 |
private Taxon buildSubfamily(INonViralName tnb) {
|
|
4145 | 4073 |
Taxon tmp; |
4146 | 4074 |
// tnb.generateTitle(); |
4147 | 4075 |
tmp = findMatchingTaxon(tnb,refMods); |
... | ... | |
4167 | 4095 |
* @param tnb |
4168 | 4096 |
* @return |
4169 | 4097 |
*/ |
4170 |
private Taxon buildFamily(NonViralName<?> tnb) {
|
|
4098 |
private Taxon buildFamily(INonViralName tnb) {
|
|
4171 | 4099 |
Taxon tmp; |
4172 | 4100 |
// tnb.generateTitle(); |
4173 | 4101 |
tmp = findMatchingTaxon(tnb,refMods); |
... | ... | |
4188 | 4116 |
* @param tnb |
4189 | 4117 |
* @return |
4190 | 4118 |
*/ |
4191 |
private Taxon buildForm(String fullname, String partialname, NonViralName<?> tnb) {
|
|
4119 |
private Taxon buildForm(String fullname, String partialname, INonViralName tnb) {
|
|
4192 | 4120 |
if (genusName !=null) { |
4193 | 4121 |
tnb.setGenusOrUninomial(genusName.getGenusOrUninomial()); |
4194 | 4122 |
} |
... | ... | |
4237 | 4165 |
* @param tnb |
4238 | 4166 |
* @return |
4239 | 4167 |
*/ |
4240 |
private Taxon buildVariety(String fullname, String partialname, NonViralName<?> tnb) {
|
|
4168 |
private Taxon buildVariety(String fullname, String partialname, INonViralName tnb) {
|
|
4241 | 4169 |
Taxon tmp; |
4242 | 4170 |
if (genusName !=null) { |
4243 | 4171 |
tnb.setGenusOrUninomial(genusName.getGenusOrUninomial()); |
... | ... | |
4287 | 4215 |
* @param tnb |
4288 | 4216 |
* @return |
4289 | 4217 |
*/ |
4290 |
private Taxon buildSubspecies(String partialname, NonViralName<?> tnb) {
|
|
4218 |
private Taxon buildSubspecies(String partialname, INonViralName tnb) {
|
|
4291 | 4219 |
if (genusName !=null) { |
4292 | 4220 |
tnb.setGenusOrUninomial(genusName.getGenusOrUninomial()); |
4293 | 4221 |
} |
... | ... | |
4327 | 4255 |
* @param tnb |
4328 | 4256 |
* @return |
4329 | 4257 |
*/ |
4330 |
private Taxon buildSpecies(String partialname, NonViralName<?> tnb) {
|
|
4258 |
private Taxon buildSpecies(String partialname, INonViralName tnb) {
|
|
4331 | 4259 |
if (genusName !=null) { |
4332 | 4260 |
tnb.setGenusOrUninomial(genusName.getGenusOrUninomial()); |
4333 | 4261 |
} |
... | ... | |
4366 | 4294 |
* @param tnb |
4367 | 4295 |
* @return |
4368 | 4296 |
*/ |
4369 |
private Taxon buildSubgenus(String partialname, NonViralName<?> tnb) {
|
|
4297 |
private Taxon buildSubgenus(String partialname, INonViralName tnb) {
|
|
4370 | 4298 |
tnb.setInfraGenericEpithet(partialname); |
4371 | 4299 |
if (genusName !=null) { |
4372 | 4300 |
tnb.setGenusOrUninomial(genusName.getGenusOrUninomial()); |
... | ... | |
4395 | 4323 |
* @param tnb |
4396 | 4324 |
* @return |
4397 | 4325 |
*/ |
4398 |
private Taxon buildGenus(String partialname, NonViralName<?> tnb) {
|
|
4326 |
private Taxon buildGenus(String partialname, INonViralName tnb) {
|
|
4399 | 4327 |
Taxon tmp; |
4400 | 4328 |
tnb.setGenusOrUninomial(partialname); |
4401 | 4329 |
|
... | ... | |
4444 | 4372 |
* @param tnb |
4445 | 4373 |
* @return |
4446 | 4374 |
*/ |
4447 |
private Taxon buildSubtribe(NonViralName<?> tnb) {
|
|
4375 |
private Taxon buildSubtribe(INonViralName tnb) {
|
|
4448 | 4376 |
Taxon tmp = findMatchingTaxon(tnb,refMods); |
4449 | 4377 |
if(tmp==null){ |
4450 | 4378 |
tmp = Taxon.NewInstance(tnb, sourceUrlRef); |
... | ... | |
4468 | 4396 |
* @param tnb |
4469 | 4397 |
* @return |
4470 | 4398 |
*/ |
4471 |
private Taxon buildTribe(NonViralName<?> tnb) {
|
|
4399 |
private Taxon buildTribe(INonViralName tnb) {
|
|
4472 | 4400 |
Taxon tmp = findMatchingTaxon(tnb,refMods); |
4473 | 4401 |
if(tmp==null){ |
4474 | 4402 |
tmp = Taxon.NewInstance(tnb, sourceUrlRef); |
... | ... | |
4665 | 4593 |
@SuppressWarnings("rawtypes") |
4666 | 4594 |
public void setFamily(Taxon family) { |
4667 | 4595 |
this.family = family; |
4668 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(family.getName(), TaxonNameBase.class); |
|
4669 |
familyName = castTaxonNameBase(taxonNameBase,familyName); |
|
4596 |
familyName = CdmBase.deproxy(family.getName()); |
|
4670 | 4597 |
} |
4671 | 4598 |
/** |
4672 | 4599 |
* @return the subfamily |
... | ... | |
4680 | 4607 |
@SuppressWarnings("rawtypes") |
4681 | 4608 |
public void setSubfamily(Taxon subfamily) { |
4682 | 4609 |
this.subfamily = subfamily; |
4683 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(subfamily.getName(), TaxonNameBase.class); |
|
4684 |
subfamilyName = castTaxonNameBase(taxonNameBase,subfamilyName); |
|
4610 |
subfamilyName = CdmBase.deproxy(subfamily.getName()); |
|
4685 | 4611 |
} |
4686 | 4612 |
/** |
4687 | 4613 |
* @return the tribe |
... | ... | |
4695 | 4621 |
@SuppressWarnings("rawtypes") |
4696 | 4622 |
public void setTribe(Taxon tribe) { |
4697 | 4623 |
this.tribe = tribe; |
4698 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(tribe.getName(), TaxonNameBase.class); |
|
4699 |
tribeName = castTaxonNameBase(taxonNameBase,tribeName); |
|
4624 |
tribeName = CdmBase.deproxy(tribe.getName()); |
|
4700 | 4625 |
} |
4701 | 4626 |
/** |
4702 | 4627 |
* @return the subtribe |
... | ... | |
4710 | 4635 |
@SuppressWarnings("rawtypes") |
4711 | 4636 |
public void setSubtribe(Taxon subtribe) { |
4712 | 4637 |
this.subtribe = subtribe; |
4713 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(subtribe.getName(), TaxonNameBase.class); |
|
4714 |
subtribeName =castTaxonNameBase(taxonNameBase,subtribeName); |
|
4638 |
subtribeName =CdmBase.deproxy(subtribe.getName()); |
|
4715 | 4639 |
} |
4716 | 4640 |
/** |
4717 | 4641 |
* @return the genus |
... | ... | |
4726 | 4650 |
public void setGenus(Taxon genus) { |
4727 | 4651 |
if (genus != null){ |
4728 | 4652 |
this.genus = genus; |
4729 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(genus.getName(), TaxonNameBase.class); |
|
4730 |
genusName = castTaxonNameBase(taxonNameBase,genusName); |
|
4653 |
genusName = CdmBase.deproxy(genus.getName()); |
|
4731 | 4654 |
} |
4732 | 4655 |
} |
4733 | 4656 |
/** |
... | ... | |
4742 | 4665 |
@SuppressWarnings("rawtypes") |
4743 | 4666 |
public void setSubgenus(Taxon subgenus) { |
4744 | 4667 |
this.subgenus = subgenus; |
4745 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(subgenus.getName(), TaxonNameBase.class); |
|
4746 |
subgenusName = castTaxonNameBase(taxonNameBase,subgenusName); |
|
4668 |
subgenusName = CdmBase.deproxy(subgenus.getName()); |
|
4747 | 4669 |
} |
4748 | 4670 |
/** |
4749 | 4671 |
* @return the species |
... | ... | |
4757 | 4679 |
public void setSpecies(Taxon species) { |
4758 | 4680 |
if (species != null){ |
4759 | 4681 |
this.species = species; |
4760 |
@SuppressWarnings("rawtypes") |
|
4761 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(species.getName(), TaxonNameBase.class); |
|
4762 |
speciesName = castTaxonNameBase(taxonNameBase,speciesName); |
|
4682 |
speciesName = CdmBase.deproxy(species.getName()); |
|
4763 | 4683 |
} |
4764 | 4684 |
} |
4765 | 4685 |
/** |
... | ... | |
4774 | 4694 |
@SuppressWarnings("rawtypes") |
4775 | 4695 |
public void setSubspecies(Taxon subspecies) { |
4776 | 4696 |
this.subspecies = subspecies; |
4777 |
TaxonNameBase taxonNameBase = CdmBase.deproxy(subspecies.getName(), TaxonNameBase.class); |
|
4778 |
subspeciesName = castTaxonNameBase(taxonNameBase,subspeciesName); |
|
4697 |
subspeciesName = CdmBase.deproxy(subspecies.getName()); |
|
4779 | 4698 |
|
4780 | 4699 |
} |
4781 | 4700 |
|
... | ... | |
4838 | 4757 |
e.printStackTrace(); |
4839 | 4758 |
} |
4840 | 4759 |
try { |
4841 |
if(castTaxonNameBase(bestMatchingTaxon.getName()).getAuthorshipCache()!=null) {
|
|
4842 |
author2=castTaxonNameBase(bestMatchingTaxon.getName()).getAuthorshipCache();
|
|
4760 |
if(bestMatchingTaxon.getName().getAuthorshipCache()!=null) {
|
|
4761 |
author2=bestMatchingTaxon.getName().getAuthorshipCache();
|
|
4843 | 4762 |
} |
4844 | 4763 |
} catch (Exception e) { |
4845 | 4764 |
// TODO Auto-generated catch block |
... | ... | |
5019 | 4938 |
* @param taxonNameBase |
5020 | 4939 |
*/ |
5021 | 4940 |
@SuppressWarnings("rawtypes") |
5022 |
public void lookForParentNode(NonViralName<?> taxonNameBase, Taxon tax, Reference ref, MyName myName) {
|
|
4941 |
public void lookForParentNode(INonViralName taxonNameBase, Taxon tax, Reference ref, MyName myName) {
|
|
5023 | 4942 |
logger.info("lookForParentNode "+taxonNameBase.getTitleCache()+" for "+myName.toString()); |
5024 | 4943 |
//System.out.println("LOOK FOR PARENT NODE "+taxonnamebase.toString()+"; "+tax.toString()+"; "+taxonnamebase.getRank()); |
5025 | 4944 |
INonViralNameParser parser = NonViralNameParserImpl.NewInstance(); |
... | ... | |
5079 | 4998 |
} |
5080 | 4999 |
} |
5081 | 5000 |
if(parent == null) { |
5082 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5001 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5083 | 5002 |
Taxon tmp = findMatchingTaxon(parentNameName,ref); |
5084 | 5003 |
if(tmp ==null) |
5085 | 5004 |
{ |
... | ... | |
5109 | 5028 |
r = Rank.FAMILY(); |
5110 | 5029 |
} |
5111 | 5030 |
if(parentStr!=null){ |
5112 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5031 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5113 | 5032 |
Taxon parent = Taxon.NewInstance(parentNameName, ref); //sec set null |
5114 | 5033 |
// importer.getTaxonService().save(parent); |
5115 | 5034 |
// parent = CdmBase.deproxy(parent, Taxon.class); |
... | ... | |
5161 | 5080 |
r = Rank.FAMILY(); |
5162 | 5081 |
} |
5163 | 5082 |
if(parentStr!=null){ |
5164 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5083 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5165 | 5084 |
Taxon parent = Taxon.NewInstance(parentNameName, ref); //sec set null |
5166 | 5085 |
// importer.getTaxonService().save(parent); |
5167 | 5086 |
// parent = CdmBase.deproxy(parent, Taxon.class); |
... | ... | |
5218 | 5137 |
r = Rank.FAMILY(); |
5219 | 5138 |
} |
5220 | 5139 |
if(parentStr!=null){ |
5221 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5140 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5222 | 5141 |
Taxon parent = Taxon.NewInstance(parentNameName, ref); //sec set null |
5223 | 5142 |
// importer.getTaxonService().save(parent); |
5224 | 5143 |
// parent = CdmBase.deproxy(parent, Taxon.class); |
... | ... | |
5281 | 5200 |
r = Rank.FAMILY(); |
5282 | 5201 |
} |
5283 | 5202 |
if(parentStr!=null){ |
5284 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5203 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5285 | 5204 |
Taxon parent = Taxon.NewInstance(parentNameName, ref); //sec set null |
5286 | 5205 |
// importer.getTaxonService().save(parent); |
5287 | 5206 |
// parent = CdmBase.deproxy(parent, Taxon.class); |
... | ... | |
5503 | 5422 |
* @return |
5504 | 5423 |
*/ |
5505 | 5424 |
private Taxon handleParentName(Reference ref, MyName myName, INonViralNameParser<?> parser, String parentStr, Rank r) { |
5506 |
NonViralName<?> parentNameName = (NonViralName<?>) parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5425 |
INonViralName parentNameName = parser.parseFullName(parentStr, nomenclaturalCode, r);
|
|
5507 | 5426 |
Taxon parent = Taxon.NewInstance(parentNameName, ref); //sec set null |
5508 | 5427 |
// importer.getTaxonService().save(parent); |
5509 | 5428 |
// parent = CdmBase.deproxy(parent, Taxon.class); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsrdf/TcsRdfTaxonNameImport.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.model.common.Marker; |
37 | 37 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
38 | 38 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
39 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
39 | 40 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
40 | 41 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
41 | 42 |
import eu.etaxonomy.cdm.model.name.Rank; |
... | ... | |
223 | 224 |
} |
224 | 225 |
|
225 | 226 |
if (nameBase instanceof NonViralName){ |
226 |
NonViralName<?> nonViralName = (NonViralName<?>)nameBase;
|
|
227 |
INonViralName nonViralName = nameBase;
|
|
227 | 228 |
prop = nameAbout.getModel().getProperty(config.getTnNamespaceURIString()+"genusPart"); |
228 | 229 |
String strGenusPart; |
229 | 230 |
try{ |
... | ... | |
432 | 433 |
} |
433 | 434 |
|
434 | 435 |
if (nameBase instanceof NonViralName){ |
435 |
NonViralName<?> nonViralName = (NonViralName<?>)nameBase;
|
|
436 |
INonViralName nonViralName = nameBase;
|
|
436 | 437 |
String strGenusPart = XmlHelp.getChildContent(elTaxonName, "TaxonName", taxonNameNamespace, "genusPart", rdfNamespace); |
437 | 438 |
|
438 | 439 |
//for names of rank genus the uninomial property should be used |
... | ... | |
608 | 609 |
} |
609 | 610 |
|
610 | 611 |
if (nameBase instanceof NonViralName){ |
611 |
NonViralName<?> nonViralName = (NonViralName<?>)nameBase;
|
|
612 |
INonViralName nonViralName = nameBase;
|
|
612 | 613 |
String strGenusPart = XmlHelp.getChildContent(elTaxonName, "TaxonName", taxonNameNamespace, "genusPart", rdfNamespace); |
613 | 614 |
|
614 | 615 |
//for names of rank genus the uninomial property should be used |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameImport.java | ||
---|---|---|
433 | 433 |
String simple = (elSimple == null)? "" : elSimple.getTextNormalize(); |
434 | 434 |
name.setFullTitleCache(simple, cacheProtected); |
435 | 435 |
|
436 |
if (name instanceof NonViralName<?>){
|
|
437 |
NonViralName<?> nonViralName = (NonViralName<?>)name;
|
|
436 |
if (name instanceof NonViralName){ |
|
437 |
INonViralName nonViralName = name;
|
|
438 | 438 |
childName = "Uninomial"; |
439 | 439 |
obligatory = false; |
440 | 440 |
Element elUninomial = XmlHelp.getSingleChildElement(success, elCanonicalName, childName, ns, obligatory); |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/dwca/in/DatabaseMappingTest.java | ||
---|---|---|
22 | 22 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
23 | 23 |
import eu.etaxonomy.cdm.io.dwca.in.IImportMapping.CdmKey; |
24 | 24 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
25 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
25 | 26 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
26 | 27 |
|
27 | 28 |
/** |
... | ... | |
77 | 78 |
ICdmDataSource datasource = mapping.getDatabase(); |
78 | 79 |
Assert.assertNotNull("Datasource should not be null", datasource); |
79 | 80 |
|
80 |
BotanicalName botName1 = TaxonNameFactory.NewBotanicalInstance(null);
|
|
81 |
TaxonNameBase<?,?> botName1 = TaxonNameFactory.NewBotanicalInstance(null);
|
|
81 | 82 |
int id = 23; |
82 | 83 |
botName1.setId(id); |
83 | 84 |
String sourceNS = "sourceNS"; |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImportTest.java | ||
---|---|---|
48 | 48 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
49 | 49 |
import eu.etaxonomy.cdm.model.description.TextData; |
50 | 50 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
51 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
52 | 51 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
53 | 52 |
import eu.etaxonomy.cdm.model.reference.Reference; |
54 | 53 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
161 | 160 |
Set<Synonym> synonyms = noctuaPronubaTaxon.getSynonyms(); |
162 | 161 |
assertEquals("Number of synonyms should be 1", 1, synonyms.size()); |
163 | 162 |
Synonym synonym = synonyms.iterator().next(); |
164 |
assertEquals("Synonym name should be ", "Noctua atlantica", ((NonViralName<?>)synonym.getName()).getNameCache());
|
|
163 |
assertEquals("Synonym name should be ", "Noctua atlantica", synonym.getName().getNameCache());
|
|
165 | 164 |
Set<TaxonDescription> descriptions = noctuaPronubaTaxon.getDescriptions(); |
166 | 165 |
Assert.assertEquals("Number of descriptions should be 1", 1, descriptions.size()); |
167 | 166 |
TaxonDescription taxonDescription = descriptions.iterator().next(); |
... | ... | |
222 | 221 |
Set<Synonym> synonyms = noctuaPronubaTaxon.getSynonyms(); |
223 | 222 |
assertEquals("Number of synonyms should be 1", 1, synonyms.size()); |
224 | 223 |
Synonym synonym = synonyms.iterator().next(); |
225 |
assertEquals("Synonym name should be ", "Noctua atlantica", ((NonViralName<?>)synonym.getName()).getNameCache());
|
|
224 |
assertEquals("Synonym name should be ", "Noctua atlantica", synonym.getName().getNameCache());
|
|
226 | 225 |
Set<TaxonDescription> descriptions = noctuaPronubaTaxon.getDescriptions(); |
227 | 226 |
Assert.assertEquals("Number of descriptions should be 1", 1, descriptions.size()); |
228 | 227 |
TaxonDescription taxonDescription = descriptions.iterator().next(); |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/jaxb/TaxonNameTest.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 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 |
|
19 | 19 |
import org.junit.Test; |
20 | 20 |
|
21 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
21 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
22 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
23 | 24 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
24 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
25 | 25 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
26 | 26 |
|
27 | 27 |
public class TaxonNameTest { |
28 |
|
|
28 |
|
|
29 | 29 |
private String resource = "/eu/etaxonomy/cdm/io/jaxb/TaxonNameTest.xml"; |
30 |
|
|
30 |
|
|
31 | 31 |
@Test |
32 | 32 |
public void testUnmarshalName() throws Exception { |
33 | 33 |
CdmDocumentBuilder cdmDocumentBuilder = new CdmDocumentBuilder(); |
34 | 34 |
URI uri = new URI(URIEncoder.encode(this.getClass().getResource(resource).toString())); |
35 | 35 |
DataSet dataSet = cdmDocumentBuilder.unmarshal(DataSet.class, new InputStreamReader(this.getClass().getResourceAsStream(resource)),uri.toString()); |
36 |
|
|
37 |
BotanicalName botanicalName = (BotanicalName)dataSet.getTaxonomicNames().get(0);
|
|
36 |
|
|
37 |
IBotanicalName botanicalName = dataSet.getTaxonomicNames().get(0);
|
|
38 | 38 |
assertNotNull("BotanicalName must not be null",botanicalName); |
39 | 39 |
DerivedUnit specimen = (DerivedUnit)dataSet.getOccurrences().get(0); |
40 |
|
|
40 |
|
|
41 | 41 |
assertNotNull("BotanicalName.typeDesignations must not be null",botanicalName.getTypeDesignations()); |
42 | 42 |
assertFalse("BotanicalName.typeDesignations must contain TypeDesignation entities", botanicalName.getTypeDesignations().isEmpty()); |
43 |
|
|
43 |
|
|
44 | 44 |
SpecimenTypeDesignation specimenTypeDesignation = (SpecimenTypeDesignation)botanicalName.getTypeDesignations().iterator().next(); |
45 | 45 |
assertNotNull("SpecimenTypeDesignation.typifiedNames must not be null",specimenTypeDesignation.getTypifiedNames()); |
46 | 46 |
assertFalse("SpecimenTypeDesignation.typifiedNames must not be empty",specimenTypeDesignation.getTypifiedNames().isEmpty()); |
47 | 47 |
assertTrue("SpecimenTypeDesignation.typifiedNames must contain BotanicalName",specimenTypeDesignation.getTypifiedNames().contains(botanicalName)); |
48 |
|
|
48 |
|
|
49 | 49 |
assertNotNull("SpecimenTypeDesignation.typeSpecimen must not be null",specimenTypeDesignation.getTypeSpecimen()); |
50 | 50 |
assertEquals("SpecimenTypeDesignation.typeSpecimen must equal Specimen",specimen,specimenTypeDesignation.getTypeSpecimen()); |
51 |
|
|
52 |
ZoologicalName zoologicalName = (ZoologicalName)dataSet.getTaxonomicNames().get(5);
|
|
51 |
|
|
52 |
IZoologicalName zoologicalName = dataSet.getTaxonomicNames().get(5);
|
|
53 | 53 |
assertNotNull("ZoologicalName must not be null",zoologicalName); |
54 |
|
|
54 |
|
|
55 | 55 |
NameTypeDesignation nameTypeDesignation = (NameTypeDesignation)zoologicalName.getTypeDesignations().iterator().next(); |
56 | 56 |
assertNotNull("NameTypeDesignation.typeName must not be null",nameTypeDesignation.getTypeName()); |
57 | 57 |
assertEquals("NameTypeDesignation.typeName must equal ZoologicalName",dataSet.getTaxonomicNames().get(6),nameTypeDesignation.getTypeName()); |
58 |
|
|
58 |
|
|
59 | 59 |
} |
60 | 60 |
} |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest.java | ||
---|---|---|
44 | 44 |
import eu.etaxonomy.cdm.model.agent.Institution; |
45 | 45 |
import eu.etaxonomy.cdm.model.agent.Person; |
46 | 46 |
import eu.etaxonomy.cdm.model.molecular.DnaSample; |
47 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
48 | 47 |
import eu.etaxonomy.cdm.model.name.Rank; |
49 | 48 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
50 | 49 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
283 | 282 |
assertEquals(2, derivedUnit.getDeterminations().size()); |
284 | 283 |
for(DeterminationEvent determinationEvent:derivedUnit.getDeterminations()){ |
285 | 284 |
if(determinationEvent.getPreferredFlag()){ |
286 |
assertEquals(preferredNameCache,((NonViralName<?>) determinationEvent.getTaxonName()).getNameCache());
|
|
285 |
assertEquals(preferredNameCache,determinationEvent.getTaxonName().getNameCache());
|
|
287 | 286 |
} |
288 | 287 |
else{ |
289 |
assertEquals(nonPreferredNameCache,((NonViralName<?>) determinationEvent.getTaxonName()).getNameCache());
|
|
288 |
assertEquals(nonPreferredNameCache,determinationEvent.getTaxonName().getNameCache());
|
|
290 | 289 |
} |
291 | 290 |
} |
292 | 291 |
|
... | ... | |
522 | 521 |
// Team team = Team.NewTitledInstance("different author", "different author"); |
523 | 522 |
// secReference.setAuthorship(team); |
524 | 523 |
// |
525 |
// NonViralName<?> taxonName = TaxonNameFactory.NewNonViralInstance(Rank.VARIETY());
|
|
524 |
// INonViralName taxonName = TaxonNameFactory.NewNonViralInstance(Rank.VARIETY());
|
|
526 | 525 |
// taxonName.setGenusOrUninomial("Campanula"); |
527 | 526 |
// taxonName.setSpecificEpithet("versicolor"); |
528 | 527 |
// taxonName.setInfraSpecificEpithet("tomentella"); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java | ||
---|---|---|
48 | 48 |
import org.hibernate.search.annotations.SortableField; |
49 | 49 |
import org.hibernate.search.annotations.Store; |
50 | 50 |
import org.hibernate.validator.constraints.NotEmpty; |
51 |
|
|
51 | 52 |
|
52 | 53 |
import eu.etaxonomy.cdm.hibernate.search.StripHtmlBridge; |
53 | 54 |
import eu.etaxonomy.cdm.jaxb.FormattedTextAdapter; |
... | ... | |
522 | 523 |
} |
523 | 524 |
|
524 | 525 |
|
525 |
|
|
526 |
|
|
527 | 526 |
/** |
528 | 527 |
* Returns the {@link eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy cache strategy} used to generate |
529 | 528 |
* several strings corresponding to <i>this</i> identifiable entity |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java | ||
---|---|---|
84 | 84 |
* Returns the {@link NomenclaturalCode nomenclatural code} that governs |
85 | 85 |
* the construction of <i>this</i> bacterial taxon name, that is the |
86 | 86 |
* International Code of Nomenclature of Bacteria. This method overrides |
87 |
* the getNomenclaturalCode method from {@link NonViralName NonViralName}. |
|
87 |
* the getNomenclaturalCode method from {@link INonViralName NonViralName}.
|
|
88 | 88 |
* |
89 | 89 |
* @return the nomenclatural code for bacteria |
90 | 90 |
* @see NonViralName#isCodeCompliant() |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java | ||
---|---|---|
158 | 158 |
* Returns the {@link NomenclaturalCode nomenclatural code} that governs |
159 | 159 |
* the construction of <i>this</i> botanical taxon name, that is the |
160 | 160 |
* International Code of Botanical Nomenclature. This method overrides |
161 |
* the getNomenclaturalCode method from {@link NonViralName NonViralName}. |
|
161 |
* the getNomenclaturalCode method from {@link INonViralName NonViralName}.
|
|
162 | 162 |
* |
163 | 163 |
* @return the nomenclatural code for plants |
164 | 164 |
* @see NonViralName#isCodeCompliant() |
... | ... | |
202 | 202 |
*/ |
203 | 203 |
@Override |
204 | 204 |
public Object clone() { |
205 |
BotanicalName result = (BotanicalName)super.clone();
|
|
205 |
IBotanicalName result = (IBotanicalName)super.clone();
|
|
206 | 206 |
//no changes to: |
207 | 207 |
return result; |
208 | 208 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/CultivarPlantName.java | ||
---|---|---|
107 | 107 |
*/ |
108 | 108 |
@Override |
109 | 109 |
public Object clone() { |
110 |
BotanicalName result = (BotanicalName)super.clone();
|
|
110 |
CultivarPlantName result = (CultivarPlantName)super.clone();
|
|
111 | 111 |
//no changes to: |
112 | 112 |
return result; |
113 | 113 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroup.java | ||
---|---|---|
308 | 308 |
// * Open: All types of relationships to replaced synonyms |
309 | 309 |
// */ |
310 | 310 |
// public void guessAndSetBasionym(){ |
311 |
// Map<String, NonViralName<?>> candidates = new HashMap<NonViralName<?>>();
|
|
311 |
// Map<String, INonViralName> candidates = new HashMap<>();
|
|
312 | 312 |
// for (TaxonNameBase<?,?> typifiedName : this.typifiedNames){ |
313 | 313 |
// if (! typifiedName.protectedAuthorshipCache && nvn.getBasionymAuthorship() == null){ |
314 | 314 |
// candidates.add(typifiedName); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HybridRelationship.java | ||
---|---|---|
55 | 55 |
}) |
56 | 56 |
@Entity |
57 | 57 |
@Audited |
58 |
public class HybridRelationship extends RelationshipBase<TaxonNameBase, TaxonNameBase, HybridRelationshipType> implements Cloneable, Comparable<HybridRelationship>{
|
|
58 |
public class HybridRelationship extends RelationshipBase<INonViralName, INonViralName, HybridRelationshipType> implements Cloneable, Comparable<HybridRelationship>{
|
|
59 | 59 |
private static final Logger logger = Logger.getLogger(HybridRelationship.class); |
60 | 60 |
|
61 | 61 |
//The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in |
... | ... | |
68 | 68 |
@XmlSchemaType(name = "IDREF") |
69 | 69 |
@ManyToOne(fetch=FetchType.LAZY) |
70 | 70 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
71 |
private TaxonNameBase relatedFrom; |
|
71 |
private TaxonNameBase<?,?> relatedFrom;
|
|
72 | 72 |
|
73 | 73 |
@XmlElement(name = "RelatedTo") |
74 | 74 |
@XmlIDREF |
75 | 75 |
@XmlSchemaType(name = "IDREF") |
76 | 76 |
@ManyToOne(fetch=FetchType.LAZY) |
77 | 77 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
78 |
private TaxonNameBase relatedTo; |
|
78 |
private TaxonNameBase<?,?> relatedTo;
|
|
79 | 79 |
|
80 | 80 |
@XmlElement(name = "Type") |
81 | 81 |
@XmlIDREF |
... | ... | |
103 | 103 |
* @param type the relationship type to be assigned to the new hybrid relationship |
104 | 104 |
* @param ruleConsidered the string indicating the article of the ICBN for the hybrid taxon name |
105 | 105 |
* @see #HybridRelationship(BotanicalName, BotanicalName, HybridRelationshipType, Reference, String, String) |
106 |
* @see BotanicalName#addHybridRelationship(HybridRelationship)
|
|
106 |
* @see TaxonNameBase#addHybridRelationship(HybridRelationship)
|
|
107 | 107 |
*/ |
108 |
protected HybridRelationship(TaxonNameBase hybridName, TaxonNameBase parentName, HybridRelationshipType type, String ruleConsidered) {
|
|
108 |
protected HybridRelationship(INonViralName hybridName, INonViralName parentName, HybridRelationshipType type, String ruleConsidered) {
|
|
109 | 109 |
this(hybridName, parentName, type, null, null, ruleConsidered); |
110 | 110 |
} |
111 | 111 |
|
... | ... | |
121 | 121 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
122 | 122 |
* @param ruleConsidered the string indicating the article of the ICBN for the hybrid taxon name |
123 | 123 |
* @see #HybridRelationship(BotanicalName, BotanicalName, HybridRelationshipType, String) |
124 |
* @see BotanicalName#addHybridRelationship(HybridRelationship)
|
|
124 |
* @see TaxonNameBase#addHybridRelationship(HybridRelationship)
|
|
125 | 125 |
*/ |
126 |
protected HybridRelationship(TaxonNameBase hybridName, TaxonNameBase parentName, HybridRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered) {
|
|
126 |
protected HybridRelationship(INonViralName hybridName, INonViralName parentName, HybridRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered) {
|
|
127 | 127 |
super(parentName, hybridName, type, citation, citationMicroReference); |
128 | 128 |
this.setRuleConsidered(ruleConsidered); |
129 | 129 |
} |
... | ... | |
198 | 198 |
} |
199 | 199 |
|
200 | 200 |
@Override |
201 |
protected void setRelatedFrom(TaxonNameBase relatedFrom) {
|
|
202 |
this.relatedFrom = relatedFrom;
|
|
201 |
protected void setRelatedFrom(INonViralName relatedFrom) {
|
|
202 |
this.relatedFrom = TaxonNameBase.castAndDeproxy(relatedFrom);
|
|
203 | 203 |
} |
204 | 204 |
|
205 | 205 |
@Override |
206 |
protected void setRelatedTo(TaxonNameBase relatedTo) {
|
|
207 |
this.relatedTo = relatedTo;
|
|
206 |
protected void setRelatedTo(INonViralName relatedTo) {
|
|
207 |
this.relatedTo = TaxonNameBase.castAndDeproxy(relatedTo);
|
|
208 | 208 |
} |
209 | 209 |
|
210 | 210 |
@Override |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HybridRelationshipType.java | ||
---|---|---|
124 | 124 |
|
125 | 125 |
/** |
126 | 126 |
* Returns the "first parent" hybrid relationship type. The elements of the |
127 |
* {@link NonViralName non-viral taxon name} used as "first parent" affect the |
|
127 |
* {@link INonViralName non-viral taxon name} used as "first parent" affect the
|
|
128 | 128 |
* taxon name string of the hybrid (see Appendix I of the ICBN). |
129 | 129 |
* |
130 | 130 |
* @see #SECOND_PARENT() |
... | ... | |
139 | 139 |
|
140 | 140 |
/** |
141 | 141 |
* Returns the "second parent" hybrid relationship type. The elements of the |
142 |
* {@link NonViralName non-viral taxon name} used as "second parent" affect the |
|
142 |
* {@link INonViralName non-viral taxon name} used as "second parent" affect the
|
|
143 | 143 |
* taxon name string of the hybrid (see Appendix I of the ICBN). |
144 | 144 |
* |
145 | 145 |
* @see #FIRST_PARENT() |
... | ... | |
152 | 152 |
|
153 | 153 |
/** |
154 | 154 |
* Returns the "third parent" hybrid relationship type. The elements of the |
155 |
* {@link NonViralName non viral taxon name} used as "third parent" affect the |
|
155 |
* {@link INonViralName non viral taxon name} used as "third parent" affect the
|
|
156 | 156 |
* taxon name string of the hybrid (see Appendix I of the ICBN). |
157 | 157 |
* |
158 | 158 |
* @see #FIRST_PARENT() |
... | ... | |
163 | 163 |
|
164 | 164 |
/** |
165 | 165 |
* Returns the "fourth parent" hybrid relationship type. The elements of the |
166 |
* {@link NonViralName non viral taxon name} used as "third parent" affect the |
|
166 |
* {@link INonViralName non viral taxon name} used as "third parent" affect the
|
|
167 | 167 |
* taxon name string of the hybrid (see Appendix I of the ICBN). |
168 | 168 |
* |
169 | 169 |
* @see #FIRST_PARENT() |
... | ... | |
175 | 175 |
/** |
176 | 176 |
* Returns the "female parent" hybrid relationship type. The taxon the name |
177 | 177 |
* of which plays the female parent role is the genetic mother of the taxon |
178 |
* which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name})<BR> |
|
178 |
* which is the hybrid (and has the hybrid {@link INonViralName non-viral taxon name})<BR>
|
|
179 | 179 |
* For nomenclature purposes a "female parent" is also a "first parent". |
180 | 180 |
* |
181 | 181 |
* @see #MALE_PARENT() |
... | ... | |
188 | 188 |
/** |
189 | 189 |
* Returns the "male parent" hybrid relationship type. The taxon the name |
190 | 190 |
* of which plays the male parent role is the genetic father of the taxon |
191 |
* which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name}).<BR> |
|
191 |
* which is the hybrid (and has the hybrid {@link INonViralName non-viral taxon name}).<BR>
|
|
192 | 192 |
* For nomenclature purposes a "male parent" is also a "second parent". |
193 | 193 |
* |
194 | 194 |
* @see #MALE_PARENT() |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/IBotanicalName.java | ||
---|---|---|
20 | 20 |
*/ |
21 | 21 |
public interface IBotanicalName extends INonViralName { |
22 | 22 |
|
23 |
/** |
|
24 |
* Returns the boolean value of the flag indicating whether the specimen |
|
25 |
* type of <i>this</i> botanical taxon name for a fungus is asexual (true) or not |
|
26 |
* (false). This applies only in case of fungi. The Article 59 of the ICBN |
|
27 |
* permits mycologists to give asexually reproducing fungi (anamorphs) |
|
28 |
* separate names from their sexual states (teleomorphs). |
|
29 |
* |
|
30 |
* @return the boolean value of the isAnamorphic flag |
|
31 |
*/ |
|
32 |
public boolean isAnamorphic(); |
|
33 |
|
|
34 |
/** |
|
35 |
* @see #isAnamorphic() |
|
36 |
*/ |
|
37 |
public void setAnamorphic(boolean anamorphic); |
|
23 |
// /**
|
|
24 |
// * Returns the boolean value of the flag indicating whether the specimen
|
|
25 |
// * type of <i>this</i> botanical taxon name for a fungus is asexual (true) or not
|
|
26 |
// * (false). This applies only in case of fungi. The Article 59 of the ICBN
|
|
27 |
// * permits mycologists to give asexually reproducing fungi (anamorphs)
|
|
28 |
// * separate names from their sexual states (teleomorphs).
|
|
29 |
// *
|
|
30 |
// * @return the boolean value of the isAnamorphic flag
|
|
31 |
// */
|
|
32 |
// public boolean isAnamorphic();
|
|
33 |
// |
|
34 |
// /**
|
|
35 |
// * @see #isAnamorphic()
|
|
36 |
// */
|
|
37 |
// public void setAnamorphic(boolean anamorphic);
|
|
38 | 38 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/INonViralName.java | ||
---|---|---|
39 | 39 |
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String) |
40 | 40 |
* @see #addNameRelationship(NameRelationship) |
41 | 41 |
*/ |
42 |
public HybridRelationship addHybridChild(NonViralName childName, HybridRelationshipType type, String ruleConsidered); |
|
42 |
public HybridRelationship addHybridChild(INonViralName childName, HybridRelationshipType type, String ruleConsidered);
|
|
43 | 43 |
|
44 | 44 |
/** |
45 | 45 |
* Creates a new {@link HybridRelationship#HybridRelationship(TaxonNameBase, TaxonNameBase, HybridRelationshipType, String) hybrid relationship} |
... | ... | |
58 | 58 |
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String) |
59 | 59 |
* @see #addNameRelationship(NameRelationship) |
60 | 60 |
*/ |
61 |
public HybridRelationship addHybridParent(NonViralName parentName, HybridRelationshipType type, String ruleConsidered); |
|
61 |
public HybridRelationship addHybridParent(INonViralName parentName, HybridRelationshipType type, String ruleConsidered);
|
|
62 | 62 |
|
63 | 63 |
/** |
64 | 64 |
* Shortcut. Returns the basionym authors title cache. Returns null if no basionym author exists. |
... | ... | |
365 | 365 |
*/ |
366 | 366 |
public boolean isProtectedNameCache(); |
367 | 367 |
|
368 |
public void removeHybridChild(NonViralName child); |
|
368 |
public void removeHybridChild(INonViralName child);
|
|
369 | 369 |
|
370 |
public void removeHybridParent(NonViralName parent); |
|
370 |
public void removeHybridParent(INonViralName parent);
|
|
371 | 371 |
|
372 | 372 |
/** |
373 | 373 |
* Removes one {@link HybridRelationship hybrid relationship} from the set of |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/ITaxonNameBase.java | ||
---|---|---|
49 | 49 |
public interface ITaxonNameBase |
50 | 50 |
extends IIdentifiableEntity, IParsable, IRelated, IMatchable, Cloneable{ |
51 | 51 |
|
52 |
public int compareTo(IdentifiableEntity identifiableEntity); |
|
53 |
|
|
54 |
public Object clone(); |
|
55 |
|
|
52 | 56 |
public String generateFullTitle(); |
53 | 57 |
|
54 | 58 |
@Transient |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/IZoologicalName.java | ||
---|---|---|
65 | 65 |
* @see #getPublicationYear() |
66 | 66 |
*/ |
67 | 67 |
public void setPublicationYear(Integer publicationYear); |
68 |
|
|
68 | 69 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationshipType.java | ||
---|---|---|
313 | 313 |
* {@link Rank ranks}) must be (almost) identical, so one could be mistaken for |
314 | 314 |
* the other one. The first taxon name is "illegitimate" and the second one |
315 | 315 |
* is "legitimate" (this corresponds to "invalid" and "valid" in case of |
316 |
* {@link ZoologicalName zoological names}).<BR> |
|
316 |
* {@link IZoologicalName zoological names}).<BR>
|
|
317 | 317 |
* For instance <i>Astragalus rhizanthus</i> Boiss. is a later homonym of |
318 | 318 |
* <i>Astragalus rhizanthus</i> Royle.<BR> |
319 | 319 |
* This type is not symmetric but transitive. |
... | ... | |
335 | 335 |
* {@link Rank#isInfraSpecific() infraspecific ranks} and {@link NonViralName#getAuthorshipCache() authorship}) must be |
336 | 336 |
* almost identical (so one could be mistaken for the other). The first |
337 | 337 |
* taxon name is "illegitimate" and the second one is "legitimate" (this |
338 |
* corresponds to "invalid" and "valid" in case of {@link ZoologicalName zoological names}).<BR> |
|
338 |
* corresponds to "invalid" and "valid" in case of {@link IZoologicalName zoological names}).<BR>
|
|
339 | 339 |
* This type is not symmetric but transitive. |
340 | 340 |
* |
341 | 341 |
* @see #LATER_HOMONYM() |
... | ... | |
433 | 433 |
* Competent authorities decided, regardless of the general |
434 | 434 |
* nomenclatural rules, to handle the first one as the "legitimate" |
435 | 435 |
* one and the second taxon name as "illegitimate" (this corresponds to |
436 |
* "valid" and "invalid" in case of {@link ZoologicalName zoological names}).<BR> |
|
436 |
* "valid" and "invalid" in case of {@link IZoologicalName zoological names}).<BR>
|
|
437 | 437 |
* For instance <i>Cephaloziella</i> (Spruce) Schiffn. is conserved against |
438 | 438 |
* <i>Dichiton</i> Mont.<BR> |
439 | 439 |
* This type is neither symmetric nor transitive. |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalStatusType.java | ||
---|---|---|
191 | 191 |
/** |
192 | 192 |
* Returns the boolean value indicating whether <i>this</i> nomenclatural status |
193 | 193 |
* type is itself "invalid" or a kind of "invalid" (true) or not (false) - |
194 |
* this corresponds to "not available" for {@link ZoologicalName zoological names} -. |
|
194 |
* this corresponds to "not available" for {@link IZoologicalName zoological names} -.
|
|
195 | 195 |
* Returns false if <i>this</i> nomenclatural status type is null. The use |
196 | 196 |
* of "invalid" {@link TaxonNameBase taxon names} should be avoided.<BR> |
197 | 197 |
* A taxon name is "invalid" if it is not "valid"; this means that |
... | ... | |
226 | 226 |
/** |
Also available in: Unified diff
ref #6362, ref #6365 remove occurrence of NonViralName, BotanicalName, ZoologicalName and others