Revision db183545
Added by Andreas Müller almost 7 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java | ||
---|---|---|
449 | 449 |
} |
450 | 450 |
|
451 | 451 |
|
452 |
private List<TaxonName<?,?>> 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<TaxonName<?,?>> 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(); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java | ||
---|---|---|
1038 | 1038 |
* |
1039 | 1039 |
* @see #getTaxonDescription(Taxon, boolean, boolean) |
1040 | 1040 |
*/ |
1041 |
public TaxonNameDescription getTaxonNameDescription(TaxonName<?,?> 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/mapping/out/DbDescriptionElementTaxonMapper.java | ||
---|---|---|
76 | 76 |
} |
77 | 77 |
}else if (inDescription.isInstanceOf(TaxonNameDescription.class)){ |
78 | 78 |
TaxonNameDescription nameDescription = CdmBase.deproxy(inDescription, TaxonNameDescription.class); |
79 |
TaxonName<?,?> 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 | ||
---|---|---|
52 | 52 |
if (cdmBase.isInstanceOf(OriginalSourceBase.class)){ |
53 | 53 |
OriginalSourceBase<?> source = CdmBase.deproxy(cdmBase, OriginalSourceBase.class); |
54 | 54 |
String nameString = source.getOriginalNameString(); |
55 |
TaxonName<?,?> 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 | ||
---|---|---|
364 | 364 |
private void initNameMap(STATE state) { |
365 | 365 |
if (!nameMapIsInitialized && repository != null){ |
366 | 366 |
List<String> propertyPaths = Arrays.asList(""); |
367 |
List<TaxonName<?,?>> existingNames = repository.getNameService().list(null, null, null, null, propertyPaths);
|
|
368 |
for (TaxonName<?,?> 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/dwca/in/DwcTaxonStreamItem2CdmTaxonConverter.java | ||
---|---|---|
133 | 133 |
Rank rank = getRank(csvTaxonRecord, nomCode); |
134 | 134 |
|
135 | 135 |
//name && name published in |
136 |
TaxonName<?,?> 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 TaxonName<?,?> getScientificName(StreamItem item, NomenclaturalCode nomCode, Rank rank, List<MappedCdmBase> resultList, Reference sourceReference) {
|
|
504 |
TaxonName<?,?> 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 = (TaxonName<?,?>)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(TaxonName<?,?> 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 |
TaxonName<?,?> 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/out/DwcaTypesExport.java | ||
---|---|---|
241 | 241 |
return true; |
242 | 242 |
} |
243 | 243 |
|
244 |
private TaxonName<?,?> 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/distribution/DistributionImport.java | ||
---|---|---|
186 | 186 |
} |
187 | 187 |
|
188 | 188 |
// get the taxa for the matching names |
189 |
for(TaxonName<?,?> dbTaxonName: taxonNames) {
|
|
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 | ||
---|---|---|
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(TaxonName<?,?> 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/markup/MarkupNomenclatureImport.java | ||
---|---|---|
164 | 164 |
// this a rule? |
165 | 165 |
TaxonName speciesName = TaxonName.castAndDeproxy( |
166 | 166 |
handleNom(state, reader, next, null)); |
167 |
for (TaxonName<?, ?> 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); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/outputmodel/OutputModelClassificationExport.java | ||
---|---|---|
1074 | 1074 |
* TypeDesignatedByRef_Fk |
1075 | 1075 |
*/ |
1076 | 1076 |
|
1077 |
private void handleTypeDesignations(OutputModelExportState state, TaxonName name){ |
|
1078 |
Set<SpecimenTypeDesignation> typeDesignations = name.getTypeDesignations(); |
|
1077 |
private void handleSpecimenTypeDesignations(OutputModelExportState state, TaxonName name){
|
|
1078 |
Set<SpecimenTypeDesignation> typeDesignations = name.getSpecimenTypeDesignations();
|
|
1079 | 1079 |
OutputModelTable table = OutputModelTable.TYPE_DESIGNATION; |
1080 | 1080 |
String nameId = getId(state, name); |
1081 | 1081 |
String[] csvLine = new String[table.getSize()]; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/SpecimenImportBase.java | ||
---|---|---|
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
if(taxonName==null && atomisedTaxonName!=null){ |
153 |
taxonName = (TaxonName<?, ?>) atomisedTaxonName;
|
|
153 |
taxonName = (TaxonName) atomisedTaxonName; |
|
154 | 154 |
state.getReport().addName(taxonName); |
155 | 155 |
logger.info("Created new taxon name "+taxonName); |
156 | 156 |
if(taxonName.hasProblem()){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenCdmExcelImport.java | ||
---|---|---|
845 | 845 |
if (result == null){ |
846 | 846 |
NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance(); |
847 | 847 |
NomenclaturalCode code = state.getConfig().getNomenclaturalCode(); |
848 |
result = (TaxonName<?,?>)parser.parseFullName(name, code, null);
|
|
848 |
result = (TaxonName)parser.parseFullName(name, code, null); |
|
849 | 849 |
|
850 | 850 |
} |
851 | 851 |
if (result != null){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenSythesysExcelImport.java | ||
---|---|---|
455 | 455 |
taxonName = TaxonNameFactory.NewNonViralInstance(null); |
456 | 456 |
taxonName.setTitleCache(scientificName, true); |
457 | 457 |
} |
458 |
getNameService().save((TaxonName<?,?>)taxonName);
|
|
458 |
getNameService().save((TaxonName)taxonName); |
|
459 | 459 |
taxon = Taxon.NewInstance(taxonName, ref); //sec set null |
460 | 460 |
getTaxonService().save(taxon); |
461 | 461 |
// refreshTransaction(); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx/SimpleSpecimen.java | ||
---|---|---|
35 | 35 |
private DerivationEvent derivationEvent; |
36 | 36 |
private DerivedUnit specimen; |
37 | 37 |
private Collection collection; |
38 |
private TaxonName<?, ?> storedUnderName;
|
|
38 |
private TaxonName storedUnderName; |
|
39 | 39 |
private String titleCache; |
40 | 40 |
|
41 | 41 |
|
... | ... | |
95 | 95 |
/** |
96 | 96 |
* @return the storedUnderName |
97 | 97 |
*/ |
98 |
public TaxonName<?, ?> getStoredUnderName() {
|
|
98 |
public TaxonName getStoredUnderName() { |
|
99 | 99 |
return storedUnderName; |
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
/** |
103 | 103 |
* @param storedUnderName the storedUnderName to set |
104 | 104 |
*/ |
105 |
public void setStoredUnderName(TaxonName<?, ?> storedUnderName) {
|
|
105 |
public void setStoredUnderName(TaxonName storedUnderName) { |
|
106 | 106 |
this.storedUnderName = storedUnderName; |
107 | 107 |
} |
108 | 108 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx/TaxonXNomenclatureImport.java | ||
---|---|---|
512 | 512 |
String[] collectionStrings = typeLocStatus.substring(pos).split(","); |
513 | 513 |
for(String collectionString : collectionStrings){ |
514 | 514 |
if (taxonBase != null){ |
515 |
TaxonName<?,?> taxonName = taxonBase.getName();
|
|
515 |
TaxonName taxonName = taxonBase.getName(); |
|
516 | 516 |
if (taxonName != null){ |
517 | 517 |
Reference citation = null; |
518 | 518 |
String citationMicroReference = null; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonImport.java | ||
---|---|---|
122 | 122 |
|
123 | 123 |
logger.info("start make TaxonConcepts ..."); |
124 | 124 |
MapWrapper<TaxonBase> taxonMap = (MapWrapper<TaxonBase>)state.getStore(ICdmIO.TAXON_STORE); |
125 |
MapWrapper<TaxonName<?,?>> taxonNameMap = (MapWrapper<TaxonName<?,?>>)state.getStore(ICdmIO.TAXONNAME_STORE);
|
|
125 |
MapWrapper<TaxonName> taxonNameMap = (MapWrapper<TaxonName>)state.getStore(ICdmIO.TAXONNAME_STORE);
|
|
126 | 126 |
MapWrapper<Reference> referenceMap = (MapWrapper<Reference>)state.getStore(ICdmIO.REFERENCE_STORE); |
127 | 127 |
Map<String, CommonTaxonName> commonNameMap = new HashMap<String, CommonTaxonName>(); |
128 | 128 |
|
... | ... | |
311 | 311 |
* @param elTaxonRelationships |
312 | 312 |
* @param success |
313 | 313 |
*/ |
314 |
private TaxonName<?, ?> makeScientificName(Element elName, NomenclaturalCode code, MapWrapper<? extends TaxonName<?,?>> objectMap, ResultWrapper<Boolean> success){
|
|
315 |
TaxonName<?,?> result = null;
|
|
314 |
private TaxonName makeScientificName(Element elName, NomenclaturalCode code, MapWrapper<? extends TaxonName> objectMap, ResultWrapper<Boolean> success){
|
|
315 |
TaxonName result = null; |
|
316 | 316 |
if (elName != null){ |
317 | 317 |
String language = elName.getAttributeValue("language"); |
318 | 318 |
//Language |
... | ... | |
320 | 320 |
logger.warn("language for name not yet implemented. Language for scientific name should always be Latin"); |
321 | 321 |
} |
322 | 322 |
Class<? extends IdentifiableEntity> clazz = TaxonName.class; |
323 |
result = (TaxonName<?,?>)makeReferenceType (elName, clazz , objectMap, success);
|
|
323 |
result = (TaxonName)makeReferenceType (elName, clazz , objectMap, success); |
|
324 | 324 |
if(result == null){ |
325 | 325 |
logger.warn("Name not found"); |
326 | 326 |
success.setValue(false); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameRelationsImport.java | ||
---|---|---|
59 | 59 |
|
60 | 60 |
|
61 | 61 |
logger.info("start make taxon name relations ..."); |
62 |
MapWrapper<TaxonName<?,?>> taxonNameMap = (MapWrapper<TaxonName<?,?>>)state.getStore(ICdmIO.TAXONNAME_STORE);
|
|
62 |
MapWrapper<TaxonName> taxonNameMap = (MapWrapper<TaxonName>)state.getStore(ICdmIO.TAXONNAME_STORE);
|
|
63 | 63 |
MapWrapper<Reference> referenceMap = (MapWrapper<Reference>)state.getStore(ICdmIO.REFERENCE_STORE); |
64 | 64 |
|
65 | 65 |
Set<TaxonName> nameStore = new HashSet<TaxonName>(); |
... | ... | |
309 | 309 |
} |
310 | 310 |
|
311 | 311 |
|
312 |
private boolean makeNomenclaturalNoteType(TcsXmlImportConfigurator tcsConfig, Element elRelation, NameRelationshipType relType, MapWrapper<TaxonName<?,?>> taxonNameMap, Set<TaxonName> nameStore, String id, boolean inverse){
|
|
312 |
private boolean makeNomenclaturalNoteType(TcsXmlImportConfigurator tcsConfig, Element elRelation, NameRelationshipType relType, MapWrapper<TaxonName> taxonNameMap, Set<TaxonName> nameStore, String id, boolean inverse){ |
|
313 | 313 |
if (elRelation == null){ |
314 | 314 |
return false; |
315 | 315 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonRelationsImport.java | ||
---|---|---|
574 | 574 |
TaxonName aboutName = aboutTaxon.getName(); |
575 | 575 |
if (aboutName != null){ |
576 | 576 |
Set<TaxonName> typifiedNames = aboutName.getHomotypicalGroup().getTypifiedNames(); |
577 |
for (TaxonName<?,?> typifiedName : typifiedNames){
|
|
577 |
for (TaxonName typifiedName : typifiedNames){ |
|
578 | 578 |
//TODO check if name is part of this tcs file |
579 | 579 |
if (typifiedName.equals(aboutName)){ |
580 | 580 |
continue; |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/dwca/in/DatabaseMappingTest.java | ||
---|---|---|
77 | 77 |
ICdmDataSource datasource = mapping.getDatabase(); |
78 | 78 |
Assert.assertNotNull("Datasource should not be null", datasource); |
79 | 79 |
|
80 |
TaxonName<?,?> botName1 = TaxonNameFactory.NewBotanicalInstance(null);
|
|
80 |
TaxonName botName1 = TaxonNameFactory.NewBotanicalInstance(null); |
|
81 | 81 |
int id = 23; |
82 | 82 |
botName1.setId(id); |
83 | 83 |
String sourceNS = "sourceNS"; |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest.java | ||
---|---|---|
250 | 250 |
assertEquals(3, nameService.count(TaxonName.class)); |
251 | 251 |
assertEquals(1, occurrenceService.count(DerivedUnit.class)); |
252 | 252 |
boolean varietyFound = false; |
253 |
for(TaxonName<?, ?> name:nameService.list(TaxonName.class, null, null, null, null)){
|
|
253 |
for(TaxonName name:nameService.list(TaxonName.class, null, null, null, null)){ |
|
254 | 254 |
if(name.getRank().equals(Rank.VARIETY())){ |
255 | 255 |
varietyFound = true; |
256 | 256 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IntextReference.java | ||
---|---|---|
276 | 276 |
private void setTarget(IIntextReferenceTarget target) { |
277 | 277 |
target = CdmBase.deproxy(target); |
278 | 278 |
if (target instanceof TaxonName){ |
279 |
this.taxonName = (TaxonName<?,?>)target;
|
|
279 |
this.taxonName = (TaxonName)target; |
|
280 | 280 |
}else if (target instanceof TaxonBase){ |
281 | 281 |
this.taxon = (TaxonBase<?>)target; |
282 | 282 |
}else if (target instanceof SpecimenOrObservationBase){ |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionElementSource.java | ||
---|---|---|
122 | 122 |
@XmlSchemaType(name = "IDREF") |
123 | 123 |
@ManyToOne(fetch = FetchType.LAZY) |
124 | 124 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
125 |
private TaxonName<?,?> nameUsedInSource;
|
|
125 |
private TaxonName nameUsedInSource; |
|
126 | 126 |
|
127 | 127 |
//*********************** CONSTRUCTOR ******************************/ |
128 | 128 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TaxonNameDescription.java | ||
---|---|---|
62 | 62 |
@ManyToOne(fetch = FetchType.LAZY) |
63 | 63 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
64 | 64 |
@FieldBridge(impl=NotNullAwareIdBridge.class) |
65 |
private TaxonName<?,?> taxonName;
|
|
65 |
private TaxonName taxonName; |
|
66 | 66 |
|
67 | 67 |
//******************* FACTORY ********************************************/ |
68 | 68 |
|
... | ... | |
103 | 103 |
* Returns the {@link TaxonName taxon name} to which <i>this</i> taxon name description |
104 | 104 |
* provides additional information not ruled by a {@link NomenclaturalCode nomenclatural code}. |
105 | 105 |
*/ |
106 |
public TaxonName<?,?> getTaxonName() {
|
|
106 |
public TaxonName getTaxonName() { |
|
107 | 107 |
return taxonName; |
108 | 108 |
} |
109 | 109 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroup.java | ||
---|---|---|
309 | 309 |
// */ |
310 | 310 |
// public void guessAndSetBasionym(){ |
311 | 311 |
// Map<String, INonViralName> candidates = new HashMap<>(); |
312 |
// for (TaxonName<?,?> typifiedName : this.typifiedNames){
|
|
312 |
// for (TaxonName typifiedName : this.typifiedNames){ |
|
313 | 313 |
// if (! typifiedName.protectedAuthorshipCache && nvn.getBasionymAuthorship() == null){ |
314 | 314 |
// candidates.add(typifiedName); |
315 | 315 |
// } |
316 | 316 |
// } |
317 | 317 |
// if (candidates.size() == 1){ |
318 |
// for (TaxonName<?,?> typifiedName : this.typifiedNames){
|
|
318 |
// for (TaxonName typifiedName : this.typifiedNames){ |
|
319 | 319 |
// removeGroupBasionym(typifiedName); |
320 | 320 |
// } |
321 | 321 |
// this.setGroupBasionym(candidates.iterator().next()); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroupComparator.java | ||
---|---|---|
33 | 33 |
TaxonComparator taxComparator = new HomotypicGroupTaxonComparator(null); |
34 | 34 |
Set<TaxonName> typifiedNames1 = group1.getTypifiedNames(); |
35 | 35 |
List<TaxonBase> taxonBasesOfTypifiedNames = new ArrayList<>(); |
36 |
for (TaxonName<?,?> typifiedName:typifiedNames1){
|
|
36 |
for (TaxonName typifiedName:typifiedNames1){ |
|
37 | 37 |
if (!typifiedName.getTaxonBases().isEmpty()){ |
38 | 38 |
taxonBasesOfTypifiedNames.add(typifiedName.getTaxonBases().iterator().next()); |
39 | 39 |
} |
... | ... | |
43 | 43 |
|
44 | 44 |
Set<TaxonName> typifiedNames2 = group2.getTypifiedNames(); |
45 | 45 |
taxonBasesOfTypifiedNames = new ArrayList<TaxonBase>(); |
46 |
for (TaxonName<?,?> typifiedName:typifiedNames2){
|
|
46 |
for (TaxonName typifiedName:typifiedNames2){ |
|
47 | 47 |
if (!typifiedName.getTaxonBases().isEmpty()){ |
48 | 48 |
taxonBasesOfTypifiedNames.add(typifiedName.getTaxonBases().iterator().next()); |
49 | 49 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroupNameComparator.java | ||
---|---|---|
130 | 130 |
* @param name2 second name to compare |
131 | 131 |
* @return compare value according to the {@link Comparator#compare(Object, Object)} contract. |
132 | 132 |
*/ |
133 |
private int handleSameBasionym(TaxonName<?, ?> basionym,
|
|
134 |
TaxonName<?, ?> name1,
|
|
135 |
TaxonName<?, ?> name2) {
|
|
133 |
private int handleSameBasionym(TaxonName basionym, |
|
134 |
TaxonName name1, |
|
135 |
TaxonName name2) { |
|
136 | 136 |
|
137 | 137 |
if (basionym.equals(name1)){ |
138 | 138 |
return -1; |
... | ... | |
149 | 149 |
* @param basionym2 |
150 | 150 |
* @return |
151 | 151 |
*/ |
152 |
private int compareBasionyms(TaxonName<?,?> basionym1Orig, TaxonName basionym2Orig) {
|
|
152 |
private int compareBasionyms(TaxonName basionym1Orig, TaxonName basionym2Orig) { |
|
153 | 153 |
//one taxon is first in group |
154 | 154 |
TaxonName basionym1 = getFirstNameInGroup(basionym1Orig); |
155 | 155 |
TaxonName basionym2 = getFirstNameInGroup(basionym2Orig); |
... | ... | |
180 | 180 |
* @param basionym |
181 | 181 |
* @return |
182 | 182 |
*/ |
183 |
private TaxonName<?, ?> getFirstNameInGroup(TaxonName<?, ?> basionym) {
|
|
183 |
private TaxonName getFirstNameInGroup(TaxonName basionym) {
|
|
184 | 184 |
for (NameRelationship nameRel : basionym.getRelationsFromThisName()){ |
185 | 185 |
if (nameRel.getType() != null && nameRel.getType().equals(NameRelationshipType.BASIONYM())){ |
186 | 186 |
if (nameRel.getToName().equals(firstNameInGroup)){ |
... | ... | |
196 | 196 |
* @return |
197 | 197 |
*/ |
198 | 198 |
@SuppressWarnings("rawtypes") |
199 |
private Set<TaxonName> getReplacedSynonymClosure(TaxonName<?, ?> name) {
|
|
199 |
private Set<TaxonName> getReplacedSynonymClosure(TaxonName name) { |
|
200 | 200 |
Set<TaxonName> set = name.getReplacedSynonyms(); |
201 | 201 |
if (set.isEmpty()){ |
202 | 202 |
return set; |
203 | 203 |
} |
204 | 204 |
Set<TaxonName> result = new HashSet<TaxonName>(); |
205 |
for (TaxonName<?,?> replSyn : set){
|
|
205 |
for (TaxonName replSyn : set){ |
|
206 | 206 |
boolean notYetContained = result.add(replSyn); |
207 | 207 |
if (notYetContained){ |
208 | 208 |
result.addAll(replSyn.getReplacedSynonyms()); |
... | ... | |
215 | 215 |
* @param name |
216 | 216 |
* @return |
217 | 217 |
*/ |
218 |
private TaxonName getPreferredInBasionymGroup(TaxonName<?,?> name) {
|
|
218 |
private TaxonName getPreferredInBasionymGroup(TaxonName name) { |
|
219 | 219 |
Set<TaxonName> candidates = new HashSet<>(); |
220 | 220 |
//get all final basionyms, except for those being part of a basionym circle |
221 |
for (TaxonName<?,?> candidate : name.getBasionyms()){
|
|
221 |
for (TaxonName candidate : name.getBasionyms()){ |
|
222 | 222 |
if (candidate != null |
223 | 223 |
&& candidate.getHomotypicalGroup().equals(name.getHomotypicalGroup()) |
224 | 224 |
&& !hasBasionymCircle(candidate, null)){ |
... | ... | |
234 | 234 |
}else{ |
235 | 235 |
TaxonName result = candidates.iterator().next(); |
236 | 236 |
candidates.remove(result); |
237 |
for(TaxonName<?,?> candidate : candidates){
|
|
237 |
for(TaxonName candidate : candidates){ |
|
238 | 238 |
if (this.compare(result, candidate) > 0){ |
239 | 239 |
result = candidate; |
240 | 240 |
} |
... | ... | |
247 | 247 |
* @param candidate |
248 | 248 |
* @return |
249 | 249 |
*/ |
250 |
private boolean hasBasionymCircle(TaxonName<?, ?> name, Set<TaxonName<?,?>> existing) {
|
|
250 |
private boolean hasBasionymCircle(TaxonName name, Set<TaxonName> existing) {
|
|
251 | 251 |
if (existing == null){ |
252 | 252 |
existing = new HashSet<>(); |
253 | 253 |
} |
... | ... | |
336 | 336 |
* without status nom. illeg. |
337 | 337 |
* @return |
338 | 338 |
*/ |
339 |
protected int compare(TaxonName<?,?> name1, TaxonName name2, boolean includeNomIlleg) {
|
|
339 |
protected int compare(TaxonName name1, TaxonName name2, boolean includeNomIlleg) { |
|
340 | 340 |
int result; |
341 | 341 |
|
342 | 342 |
//dates |
... | ... | |
386 | 386 |
return result; |
387 | 387 |
} |
388 | 388 |
|
389 |
private Integer getIntegerDate(TaxonName<?,?> name){
|
|
389 |
private Integer getIntegerDate(TaxonName name){ |
|
390 | 390 |
Integer result; |
391 | 391 |
|
392 | 392 |
if (name == null){ |
... | ... | |
420 | 420 |
return result; |
421 | 421 |
} |
422 | 422 |
|
423 |
protected int compareNomIlleg(TaxonName<?,?> taxonName1, TaxonName taxonName2) {
|
|
423 |
protected int compareNomIlleg(TaxonName taxonName1, TaxonName taxonName2) { |
|
424 | 424 |
int isNomIlleg1 = isNomIlleg(taxonName1); |
425 | 425 |
int isNomIlleg2 = isNomIlleg(taxonName2); |
426 | 426 |
return isNomIlleg1 - isNomIlleg2; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HybridRelationship.java | ||
---|---|---|
68 | 68 |
@XmlSchemaType(name = "IDREF") |
69 | 69 |
@ManyToOne(fetch=FetchType.LAZY) |
70 | 70 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
71 |
private TaxonName<?,?> relatedFrom;
|
|
71 |
private TaxonName 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 TaxonName<?,?> relatedTo;
|
|
78 |
private TaxonName relatedTo; |
|
79 | 79 |
|
80 | 80 |
@XmlElement(name = "Type") |
81 | 81 |
@XmlIDREF |
... | ... | |
222 | 222 |
if (compareType != 0){ |
223 | 223 |
return compareType; |
224 | 224 |
}else{ |
225 |
TaxonName<?,?> related1 = this.getRelatedFrom();
|
|
226 |
TaxonName<?,?> related2 = rel2.getRelatedFrom();
|
|
225 |
TaxonName related1 = this.getRelatedFrom(); |
|
226 |
TaxonName related2 = rel2.getRelatedFrom(); |
|
227 | 227 |
if (related1 != related2){ |
228 | 228 |
related1 = this.getRelatedTo(); |
229 | 229 |
related2 = rel2.getRelatedTo(); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/ITaxonNameBase.java | ||
---|---|---|
828 | 828 |
* @return the compareTo result similar to {@link Comparable#compareTo(Object)} |
829 | 829 |
* @throws NullPointerException if otherTaxon is <code>null</code> |
830 | 830 |
*/ |
831 |
public int compareToName(TaxonName<?,?> otherName);
|
|
831 |
public int compareToName(TaxonName otherName); |
|
832 | 832 |
|
833 | 833 |
/** |
834 | 834 |
* This method returns als {@link Registration registrations} for the given name. |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonName.java | ||
---|---|---|
182 | 182 |
@NameMustHaveAuthority(groups = Level2.class) |
183 | 183 |
@NoDuplicateNames(groups = Level3.class) |
184 | 184 |
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonName") |
185 |
public class TaxonName<T extends TaxonName<?,?>, S extends INameCacheStrategy>
|
|
186 |
extends IdentifiableEntity<S>
|
|
185 |
public class TaxonName |
|
186 |
extends IdentifiableEntity<INameCacheStrategy>
|
|
187 | 187 |
implements ITaxonNameBase, INonViralName, IViralName, IBacterialName, IZoologicalName, |
188 | 188 |
IBotanicalName, ICultivarPlantName, IFungusName, |
189 | 189 |
IParsable, IRelated, IMatchable, IIntextReferenceTarget, Cloneable { |
... | ... | |
561 | 561 |
*/ |
562 | 562 |
protected static TaxonName NewInstance(NomenclaturalCode code, Rank rank, |
563 | 563 |
HomotypicalGroup homotypicalGroup) { |
564 |
TaxonName<?,?> result = new TaxonName<>(code, rank, homotypicalGroup);
|
|
564 |
TaxonName result = new TaxonName(code, rank, homotypicalGroup);
|
|
565 | 565 |
return result; |
566 | 566 |
} |
567 | 567 |
|
... | ... | |
583 | 583 |
String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, |
584 | 584 |
TeamOrPersonBase combinationAuthorship, Reference nomenclaturalReference, |
585 | 585 |
String nomenclMicroRef, HomotypicalGroup homotypicalGroup) { |
586 |
TaxonName result = new TaxonName<>(code, rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorship, nomenclaturalReference, nomenclMicroRef, homotypicalGroup);
|
|
586 |
TaxonName result = new TaxonName(code, rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorship, nomenclaturalReference, nomenclMicroRef, homotypicalGroup); |
|
587 | 587 |
return result; |
588 | 588 |
} |
589 | 589 |
|
... | ... | |
679 | 679 |
}else if (this.cacheStrategy != null){ |
680 | 680 |
// |
681 | 681 |
}else if (getNameType() == NomenclaturalCode.NonViral){ |
682 |
this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
|
|
682 |
this.cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance(); |
|
683 | 683 |
}else if (getNameType().isBotanical()){ |
684 |
this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
|
|
684 |
this.cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance(); |
|
685 | 685 |
}else if (getNameType() == NomenclaturalCode.ICZN){ |
686 |
this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
|
|
686 |
this.cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance(); |
|
687 | 687 |
}else if (getNameType() == NomenclaturalCode.ICNB){ |
688 |
this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();;
|
|
688 |
this.cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance();; |
|
689 | 689 |
}else if (getNameType() == NomenclaturalCode.ICVCN){ |
690 |
this.cacheStrategy = (S) ViralNameDefaultCacheStrategy.NewInstance();
|
|
690 |
this.cacheStrategy = ViralNameDefaultCacheStrategy.NewInstance(); |
|
691 | 691 |
} |
692 | 692 |
} |
693 | 693 |
|
... | ... | |
1354 | 1354 |
return; |
1355 | 1355 |
} |
1356 | 1356 |
|
1357 |
TaxonName<?,?> parent = hybridRelation.getParentName();
|
|
1358 |
TaxonName<?,?> child = hybridRelation.getHybridName();
|
|
1357 |
TaxonName parent = hybridRelation.getParentName(); |
|
1358 |
TaxonName child = hybridRelation.getHybridName(); |
|
1359 | 1359 |
if (this.equals(parent)){ |
1360 | 1360 |
this.hybridParentRelations.remove(hybridRelation); |
1361 | 1361 |
child.hybridChildRelations.remove(hybridRelation); |
... | ... | |
1373 | 1373 |
//********* METHODS **************************************/ |
1374 | 1374 |
|
1375 | 1375 |
@Override |
1376 |
public S getCacheStrategy() {
|
|
1376 |
public INameCacheStrategy getCacheStrategy() {
|
|
1377 | 1377 |
rectifyNameCacheStrategy(); |
1378 | 1378 |
return this.cacheStrategy; |
1379 | 1379 |
} |
... | ... | |
1430 | 1430 |
@Override |
1431 | 1431 |
@Transient |
1432 | 1432 |
public List<TaggedText> getTaggedName(){ |
1433 |
S strat = getCacheStrategy();
|
|
1433 |
INameCacheStrategy strat = getCacheStrategy();
|
|
1434 | 1434 |
return strat.getTaggedTitle(this); |
1435 | 1435 |
} |
1436 | 1436 |
|
... | ... | |
2046 | 2046 |
Set<NameRelationship> rels = this.getRelationsToThisName(); |
2047 | 2047 |
for (NameRelationship rel : rels){ |
2048 | 2048 |
if (rel.getType()!= null && rel.getType().isBasionymRelation()){ |
2049 |
TaxonName<?,?> basionym = rel.getFromName();
|
|
2049 |
TaxonName basionym = rel.getFromName(); |
|
2050 | 2050 |
result.add(basionym); |
2051 | 2051 |
} |
2052 | 2052 |
} |
... | ... | |
2934 | 2934 |
return false; |
2935 | 2935 |
} |
2936 | 2936 |
|
2937 |
for (TaxonName<?,?> taxonName : typifiedNames) {
|
|
2937 |
for (TaxonName taxonName : typifiedNames) { |
|
2938 | 2938 |
if (!taxonName.equals(this)) { |
2939 | 2939 |
if (! isBasionymFor(taxonName)) { |
2940 | 2940 |
return false; |
... | ... | |
3175 | 3175 |
Set<NameRelationship> relations = new HashSet<NameRelationship>(); |
3176 | 3176 |
Set<NameRelationship> removeRelations = new HashSet<NameRelationship>(); |
3177 | 3177 |
|
3178 |
for(TaxonName<?, ?> typifiedName : homotypicalGroup.getTypifiedNames()){
|
|
3178 |
for(TaxonName typifiedName : homotypicalGroup.getTypifiedNames()){ |
|
3179 | 3179 |
|
3180 | 3180 |
Set<NameRelationship> nameRelations = typifiedName.getRelationsFromThisName(); |
3181 | 3181 |
|
... | ... | |
3201 | 3201 |
this.removeNameRelationship(relation); |
3202 | 3202 |
} |
3203 | 3203 |
|
3204 |
for (TaxonName<?, ?> name : homotypicalGroup.getTypifiedNames()) {
|
|
3204 |
for (TaxonName name : homotypicalGroup.getTypifiedNames()) { |
|
3205 | 3205 |
if (!name.equals(this)) { |
3206 | 3206 |
|
3207 | 3207 |
// First check whether the relationship already exists |
... | ... | |
3234 | 3234 |
Set<NameRelationship> relations = new HashSet<NameRelationship>(); |
3235 | 3235 |
Set<NameRelationship> removeRelations = new HashSet<NameRelationship>(); |
3236 | 3236 |
|
3237 |
for(TaxonName<?, ?> typifiedName : homotypicalGroup.getTypifiedNames()){
|
|
3237 |
for(TaxonName typifiedName : homotypicalGroup.getTypifiedNames()){ |
|
3238 | 3238 |
|
3239 | 3239 |
Set<NameRelationship> nameRelations = typifiedName.getRelationsFromThisName(); |
3240 | 3240 |
|
... | ... | |
3305 | 3305 |
// ***************** COMPARE ********************************/ |
3306 | 3306 |
|
3307 | 3307 |
@Override |
3308 |
public int compareToName(TaxonName<?,?> otherName){
|
|
3308 |
public int compareToName(TaxonName otherName){ |
|
3309 | 3309 |
|
3310 | 3310 |
int result = 0; |
3311 | 3311 |
|
... | ... | |
3425 | 3425 |
*/ |
3426 | 3426 |
@Override |
3427 | 3427 |
public Object clone() { |
3428 |
TaxonName<?,?> result;
|
|
3428 |
TaxonName result; |
|
3429 | 3429 |
try { |
3430 | 3430 |
result = (TaxonName)super.clone(); |
3431 | 3431 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameFactory.java | ||
---|---|---|
425 | 425 |
* @param rank |
426 | 426 |
* @return |
427 | 427 |
*/ |
428 |
public static TaxonName<?, ?> NewFungusInstance(Rank rank) {
|
|
428 |
public static TaxonName NewFungusInstance(Rank rank) { |
|
429 | 429 |
return TaxonName.NewInstance(NomenclaturalCode.Fungi, rank, null); |
430 | 430 |
} |
431 | 431 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/DeterminationEvent.java | ||
---|---|---|
89 | 89 |
@ManyToOne(fetch = FetchType.LAZY) |
90 | 90 |
@IndexedEmbedded(includeEmbeddedObjectId=true) |
91 | 91 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
92 |
private TaxonName<?,?> taxonName;
|
|
92 |
private TaxonName taxonName; |
|
93 | 93 |
|
94 | 94 |
@XmlElement(name = "Modifier") |
95 | 95 |
@XmlIDREF |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/HomotypicGroupTaxonComparator.java | ||
---|---|---|
201 | 201 |
* @param basionym |
202 | 202 |
* @return |
203 | 203 |
*/ |
204 |
private TaxonName getFirstNameInGroup(TaxonName<?,?> basionym) {
|
|
204 |
private TaxonName getFirstNameInGroup(TaxonName basionym) { |
|
205 | 205 |
for (NameRelationship nameRel : basionym.getRelationsFromThisName()){ |
206 | 206 |
if (nameRel.getType() != null && nameRel.getType().equals(NameRelationshipType.BASIONYM())){ |
207 | 207 |
if (nameRel.getToName().equals(firstNameInGroup)){ |
... | ... | |
217 | 217 |
* @return |
218 | 218 |
*/ |
219 | 219 |
@SuppressWarnings("rawtypes") |
220 |
private Set<TaxonName> getReplacedSynonymClosure(TaxonName<?, ?> name) {
|
|
220 |
private Set<TaxonName> getReplacedSynonymClosure(TaxonName name) { |
|
221 | 221 |
Set<TaxonName> set = name.getReplacedSynonyms(); |
222 | 222 |
if (set.isEmpty()){ |
223 | 223 |
return set; |
224 | 224 |
} |
225 | 225 |
Set<TaxonName> result = new HashSet<>(); |
226 |
for (TaxonName<?,?> replSyn : set){
|
|
226 |
for (TaxonName replSyn : set){ |
|
227 | 227 |
boolean notYetContained = result.add(replSyn); |
228 | 228 |
if (notYetContained){ |
229 | 229 |
result.addAll(replSyn.getReplacedSynonyms()); |
... | ... | |
236 | 236 |
* @param name |
237 | 237 |
* @return |
238 | 238 |
*/ |
239 |
private TaxonName getPreferredInBasionymGroup(TaxonName<?,?> name) {
|
|
240 |
Set<TaxonName<?,?>> candidates = new HashSet<>();
|
|
239 |
private TaxonName getPreferredInBasionymGroup(TaxonName name) { |
|
240 |
Set<TaxonName> candidates = new HashSet<>(); |
|
241 | 241 |
//get all final basionyms, except for those being part of a basionym circle |
242 |
for (TaxonName<?,?> candidate : name.getBasionyms()){
|
|
242 |
for (TaxonName candidate : name.getBasionyms()){ |
|
243 | 243 |
if (candidate != null |
244 | 244 |
&& candidate.getHomotypicalGroup().equals(name.getHomotypicalGroup()) |
245 | 245 |
&& !hasBasionymCircle(candidate, null)){ |
... | ... | |
255 | 255 |
}else{ |
256 | 256 |
TaxonName result = candidates.iterator().next(); |
257 | 257 |
candidates.remove(result); |
258 |
for (TaxonName<?,?> candidate : candidates){
|
|
258 |
for (TaxonName candidate : candidates){ |
|
259 | 259 |
if (super.compare(result, candidate, false) > 0){ |
260 | 260 |
result = candidate; |
261 | 261 |
} |
... | ... | |
268 | 268 |
* @param candidate |
269 | 269 |
* @return |
270 | 270 |
*/ |
271 |
private boolean hasBasionymCircle(TaxonName<?, ?> name, Set<TaxonName> existing) {
|
|
271 |
private boolean hasBasionymCircle(TaxonName name, Set<TaxonName> existing) { |
|
272 | 272 |
if (existing == null){ |
273 | 273 |
existing = new HashSet<>(); |
274 | 274 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonBase.java | ||
---|---|---|
128 | 128 |
@IndexedEmbedded(includeEmbeddedObjectId=true) |
129 | 129 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
130 | 130 |
@NotNull(groups = Level2.class) |
131 |
private TaxonName<?,?> name;
|
|
131 |
private TaxonName name; |
|
132 | 132 |
|
133 | 133 |
// The concept reference |
134 | 134 |
@XmlElement(name = "Sec") |
... | ... | |
404 | 404 |
|
405 | 405 |
otherTaxon = deproxy(otherTaxon); |
406 | 406 |
|
407 |
TaxonName<?,?> otherName = deproxy(otherTaxon.getName());
|
|
407 |
TaxonName otherName = deproxy(otherTaxon.getName()); |
|
408 | 408 |
ITaxonNameBase thisName = this.getName(); |
409 | 409 |
if ((otherName == null || thisName == null)){ |
410 | 410 |
if (otherName != thisName){ |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategy.java | ||
---|---|---|
93 | 93 |
|
94 | 94 |
private <X extends ITaxonNameBase> List<TaggedText> getNameTags(T taxonBase) { |
95 | 95 |
List<TaggedText> tags = new ArrayList<>(); |
96 |
TaxonName<?, INameCacheStrategy> name = CdmBase.deproxy(taxonBase.getName());
|
|
96 |
TaxonName name = CdmBase.deproxy(taxonBase.getName()); |
|
97 | 97 |
|
98 | 98 |
if (name != null){ |
99 | 99 |
INameCacheStrategy nameCacheStrategy = name.getCacheStrategy(); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/homotypicgroup/BasionymRelationCreator.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
//compare accepted against synonyms |
64 | 64 |
for (Synonym synonym: synonyms){ |
65 |
TaxonName<?, ?> basionym = compareHomotypic(taxon.getName(), synonym.getName());
|
|
65 |
TaxonName basionym = compareHomotypic(taxon.getName(), synonym.getName()); |
|
66 | 66 |
if (basionym != null){ |
67 | 67 |
synonym.setType(SynonymType.HOMOTYPIC_SYNONYM_OF()); |
68 | 68 |
adaptHomotypicGroup(basionym, taxon.getName(), synonym.getName()); |
... | ... | |
75 | 75 |
for (int j = i + 1; j < synonymList.size(); j++){ |
76 | 76 |
Synonym syn1 = synonymList.get(i); |
77 | 77 |
Synonym syn2 = synonymList.get(j); |
78 |
TaxonName<?, ?> basionym = compareHomotypic(syn1.getName(), syn2.getName());
|
|
78 |
TaxonName basionym = compareHomotypic(syn1.getName(), syn2.getName()); |
|
79 | 79 |
if (basionym != null){ |
80 | 80 |
adaptHomotypicGroup(basionym, syn1.getName(), syn2.getName()); |
81 | 81 |
if (taxon.getName().getBasionyms().contains(basionym)){ |
... | ... | |
92 | 92 |
* @param name |
93 | 93 |
* @param name2 |
94 | 94 |
*/ |
95 |
private void adaptHomotypicGroup(TaxonName<?, ?> basionym,
|
|
96 |
TaxonName<?,?> name1, TaxonName<?,?> name2) {
|
|
95 |
private void adaptHomotypicGroup(TaxonName basionym, |
|
96 |
TaxonName name1, TaxonName name2) {
|
|
97 | 97 |
if (basionym.equals(name1)){ |
98 | 98 |
if (!name2.getBasionyms().contains(name1)){ |
99 | 99 |
name2.addBasionym(name1); |
... | ... | |
109 | 109 |
* @param name |
110 | 110 |
* @param name2 |
111 | 111 |
*/ |
112 |
private TaxonName<?,?> compareHomotypic(TaxonName<?,?> name1, TaxonName<?,?> name2) {
|
|
112 |
private TaxonName compareHomotypic(TaxonName name1, TaxonName name2) {
|
|
113 | 113 |
if (name1 == null || name2 == null){ |
114 | 114 |
return null; |
115 | 115 |
} |
116 |
TaxonName<?,?> basionymCandidate = checkAuthors(name1, name2);
|
|
116 |
TaxonName basionymCandidate = checkAuthors(name1, name2); |
|
117 | 117 |
if (basionymCandidate == null){ |
118 | 118 |
return null; |
119 | 119 |
}else{ |
120 |
TaxonName<?,?> newCombinationCandidate
|
|
120 |
TaxonName newCombinationCandidate |
|
121 | 121 |
= basionymCandidate == name1? name2: name1; |
122 | 122 |
boolean isBasionym = compareNameParts(basionymCandidate, newCombinationCandidate); |
123 | 123 |
if (isBasionym){ |
... | ... | |
132 | 132 |
* @param basionymCandiate |
133 | 133 |
* @param newCombinationCandidate |
134 | 134 |
*/ |
135 |
private boolean compareNameParts(TaxonName<?, ?> basionymCandidate,
|
|
136 |
TaxonName<?, ?> newCombinationCandidate) {
|
|
135 |
private boolean compareNameParts(TaxonName basionymCandidate, |
|
136 |
TaxonName newCombinationCandidate) { |
|
137 | 137 |
if (basionymCandidate.isGenusOrSupraGeneric() || newCombinationCandidate.isGenusOrSupraGeneric()){ |
138 | 138 |
return false; |
139 | 139 |
}else if (matchLastNamePart(basionymCandidate, newCombinationCandidate)){ |
... | ... | |
147 | 147 |
* @param name2 |
148 | 148 |
* @return |
149 | 149 |
*/ |
150 |
private TaxonName<?,?> checkAuthors(TaxonName<?, ?> name1, TaxonName<?, ?> name2) {
|
|
150 |
private TaxonName checkAuthors(TaxonName name1, TaxonName name2) {
|
|
151 | 151 |
if (hasBasionymAuthorOf(name1, name2)){ |
152 | 152 |
return name1; |
153 | 153 |
}else if (hasBasionymAuthorOf(name2, name1)){ |
... | ... | |
162 | 162 |
* @param name2 |
163 | 163 |
* @return |
164 | 164 |
*/ |
165 |
private boolean hasBasionymAuthorOf(TaxonName<?,?> name1, TaxonName<?,?> name2) {
|
|
165 |
private boolean hasBasionymAuthorOf(TaxonName name1, TaxonName name2) {
|
|
166 | 166 |
TeamOrPersonBase<?> basAuthor2 = name2.getBasionymAuthorship(); |
167 | 167 |
TeamOrPersonBase<?> combinationAuthor = name1.getCombinationAuthorship(); |
168 | 168 |
TeamOrPersonBase<?> basAuthor1 = name1.getBasionymAuthorship(); |
... | ... | |
198 | 198 |
* @param newCombination |
199 | 199 |
* @return |
200 | 200 |
*/ |
201 |
public static boolean matchLastNamePart(TaxonName<?,?> name1, TaxonName<?,?> name2) {
|
|
201 |
public static boolean matchLastNamePart(TaxonName name1, TaxonName name2) {
|
|
202 | 202 |
String lastNamePart1 = name1.getLastNamePart(); |
203 | 203 |
String lastNamePart2 = name2.getLastNamePart(); |
204 | 204 |
if (lastNamePart1 != null && lastNamePart2 != null){ |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/BasionymsMustShareEpithetsAndAuthorsValidator.java | ||
---|---|---|
30 | 30 |
public boolean isValid(NameRelationship nameRelationship, ConstraintValidatorContext constraintContext) { |
31 | 31 |
boolean valid = true; |
32 | 32 |
if(nameRelationship.getType() != null && nameRelationship.getType().equals(NameRelationshipType.BASIONYM())) { |
33 |
TaxonName<?,?> from = CdmBase.deproxy(nameRelationship.getFromName(), TaxonName.class);
|
|
34 |
TaxonName<?,?> to = CdmBase.deproxy(nameRelationship.getToName(), TaxonName.class);
|
|
33 |
TaxonName from = CdmBase.deproxy(nameRelationship.getFromName(), TaxonName.class); |
|
34 |
TaxonName to = CdmBase.deproxy(nameRelationship.getToName(), TaxonName.class); |
|
35 | 35 |
|
36 | 36 |
if(from.isNonViral() && to.isNonViral()) { |
37 | 37 |
INonViralName fromName = from; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/ChildTaxaMustDeriveNameFromParentValidator.java | ||
---|---|---|
35 | 35 |
Taxon child = taxonNode.getTaxon(); |
36 | 36 |
|
37 | 37 |
if (parent != null && child != null && parent.getName() != null && child.getName() != null){ |
38 |
TaxonName<?,?> parentNameBase = CdmBase.deproxy(parent.getName(), TaxonName.class);
|
|
39 |
TaxonName<?,?> childNameBase = CdmBase.deproxy(child.getName(), TaxonName.class);
|
|
38 |
TaxonName parentNameBase = CdmBase.deproxy(parent.getName(), TaxonName.class); |
|
39 |
TaxonName childNameBase = CdmBase.deproxy(child.getName(), TaxonName.class); |
|
40 | 40 |
if(parentNameBase.isNonViral() && childNameBase.isNonViral()) { |
41 | 41 |
INonViralName parentName = parentNameBase; |
42 | 42 |
INonViralName childName = childNameBase; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/NameMustFollowCodeValidator.java | ||
---|---|---|
31 | 31 |
* |
32 | 32 |
*/ |
33 | 33 |
public class NameMustFollowCodeValidator implements |
34 |
ConstraintValidator<NameMustFollowCode, TaxonName<?,?>> {
|
|
34 |
ConstraintValidator<NameMustFollowCode, TaxonName> { |
|
35 | 35 |
|
36 | 36 |
@Override |
37 | 37 |
public void initialize(NameMustFollowCode nameMustFollowTheirCode) { } |
38 | 38 |
|
39 | 39 |
@Override |
40 |
public boolean isValid(TaxonName<?,?> name, ConstraintValidatorContext constraintContext) {
|
|
40 |
public boolean isValid(TaxonName name, ConstraintValidatorContext constraintContext) { |
|
41 | 41 |
name = CdmBase.deproxy(name); |
42 | 42 |
boolean valid = true; |
43 | 43 |
|
cdmlib-model/src/test/java/eu/etaxonomy/cdm/aspectj/PropertyChangeTest.java | ||
---|---|---|
39 | 39 |
@Test |
40 | 40 |
public void testPropertyChange() { |
41 | 41 |
INonViralName b = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES()); |
42 |
((TaxonName<?,?>)b).addPropertyChangeListener(this);
|
|
42 |
((TaxonName)b).addPropertyChangeListener(this); |
|
43 | 43 |
b.setGenusOrUninomial("Abies"); |
44 | 44 |
assertEquals(b.getGenusOrUninomial(), lastPropValue); |
45 | 45 |
b.setGenusOrUninomial("Picea"); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/TaxonNameTest.java | ||
---|---|---|
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
|
64 |
private class TaxonNameTestClass extends TaxonName<TaxonNameTestClass, INameCacheStrategy>{
|
|
64 |
private class TaxonNameTestClass extends TaxonName{ |
|
65 | 65 |
public TaxonNameTestClass(Rank rank, HomotypicalGroup hg){super(null, rank, hg);} |
66 | 66 |
@Override |
67 | 67 |
public void setCacheStrategy(INameCacheStrategy strategy){} |
... | ... | |
822 | 822 |
description.addElement(textData); |
823 | 823 |
|
824 | 824 |
//CLONE |
825 |
TaxonName<?,?> clone = (TaxonName)taxonName1.clone();
|
|
825 |
TaxonName clone = (TaxonName)taxonName1.clone(); |
|
826 | 826 |
TaxonName genusClone = (TaxonName)genusName.clone(); |
827 | 827 |
assertSame("Rank should be same", taxonName1.getRank(), clone.getRank()); |
828 | 828 |
assertTrue("TaxonBases should not be cloned", clone.getTaxonBases().isEmpty()); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/ClassificationTest.java | ||
---|---|---|
64 | 64 |
private static Taxon taxon3; |
65 | 65 |
private static Taxon taxon12; |
66 | 66 |
private static Taxon taxon121; |
67 |
private static TaxonName<?,?> taxonName1;
|
|
68 |
private static TaxonName<?,?> taxonName2;
|
|
69 |
private static TaxonName<?,?> taxonName3;
|
|
70 |
private static TaxonName<?,?> taxonName12;
|
|
71 |
private static TaxonName<?,?> taxonName121;
|
|
67 |
private static TaxonName taxonName1; |
|
68 |
private static TaxonName taxonName2; |
|
69 |
private static TaxonName taxonName3; |
|
70 |
private static TaxonName taxonName12; |
|
71 |
private static TaxonName taxonName121; |
|
72 | 72 |
private static Reference ref1; |
73 | 73 |
private static Reference ref2; |
74 | 74 |
private static Reference ref3; |
... | ... | |
129 | 129 |
*/ |
130 | 130 |
@Test |
131 | 131 |
public void testAddRoot() { |
132 |
TaxonName<?,?> synonymName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
132 |
TaxonName synonymName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
133 | 133 |
Synonym synonym = Synonym.NewInstance(synonymName, ref1); |
134 | 134 |
TaxonNode taxonNode1 = classification1.addChildTaxon(taxon1, null, null); |
135 | 135 |
taxonNode1.setSynonymToBeUsed(synonym); |
... | ... | |
230 | 230 |
@Test |
231 | 231 |
public void testAddParentChild() { |
232 | 232 |
|
233 |
TaxonName<?,?> synonymName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
233 |
TaxonName synonymName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
234 | 234 |
Synonym synonym = Synonym.NewInstance(synonymName, ref1); |
235 | 235 |
TaxonNode rootNode = classification1.addChildTaxon(taxon1, null, null); |
236 | 236 |
rootNode.setSynonymToBeUsed(synonym); |
... | ... | |
346 | 346 |
//genericDao.getCdmBasesByFieldAndClass(clazz, field.getName(), value); |
347 | 347 |
|
348 | 348 |
|
349 |
TaxonName<?,?> name = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS());
|
|
349 |
TaxonName name = TaxonNameFactory.NewBotanicalInstance(Rank.GENUS()); |
|
350 | 350 |
name.setTitleCache("A dummy name", true); |
351 | 351 |
result.add(name); |
352 | 352 |
Reference ref = ReferenceFactory.newBook(); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/TaxonBaseTest.java | ||
---|---|---|
166 | 166 |
@Test |
167 | 167 |
public void testCompareTo() { |
168 | 168 |
|
169 |
TaxonName<?,?> abies = TaxonNameFactory.NewNonViralInstance(Rank.GENUS(), null);
|
|
169 |
TaxonName abies = TaxonNameFactory.NewNonViralInstance(Rank.GENUS(), null); |
|
170 | 170 |
abies.setNameCache("Abies"); |
171 | 171 |
abies.setTitleCache("Abies", true); |
172 | 172 |
Reference sec = ReferenceFactory.newArticle(); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java | ||
---|---|---|
312 | 312 |
@Test |
313 | 313 |
public void testOriginalSpelling() { |
314 | 314 |
NameRelationshipType origSpellingType = NameRelationshipType.ORIGINAL_SPELLING(); |
315 |
TaxonName originalName = (TaxonName<?,?>)speciesName.clone();
|
|
315 |
TaxonName originalName = (TaxonName)speciesName.clone(); |
|
316 | 316 |
originalName.setSpecificEpithet("alpa"); |
317 | 317 |
Assert.assertEquals("Preconditions are wrong", "Abies alpa", originalName.getTitleCache()); |
318 | 318 |
Assert.assertEquals("Name cache should not show original spelling", "Abies alpa", originalName.getNameCache()); |
... | ... | |
331 | 331 |
|
332 | 332 |
//#3665 |
333 | 333 |
INonViralName correctName = NonViralNameParserImpl.NewInstance().parseFullName("Nepenthes glabrata J.R.Turnbull & A.T.Middleton"); |
334 |
TaxonName originalSpelling = (TaxonName<?,?>)NonViralNameParserImpl.NewInstance().parseFullName("Nepenthes glabratus");
|
|
334 |
TaxonName originalSpelling = (TaxonName)NonViralNameParserImpl.NewInstance().parseFullName("Nepenthes glabratus"); |
|
335 | 335 |
correctName.addRelationshipFromName(originalSpelling, origSpellingType, null); |
336 | 336 |
Assert.assertEquals("Nepenthes glabrata", correctName.getNameCache()); |
337 | 337 |
Assert.assertEquals("Nepenthes glabrata J.R.Turnbull & A.T.Middleton", correctName.getTitleCache()); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/homotypicgroup/BasionymRelationCreatorTest.java | ||
---|---|---|
40 | 40 |
private Synonym synonym1; |
41 | 41 |
private Synonym synonym2; |
42 | 42 |
private Synonym synonym3; |
43 |
private TaxonName<?,?> accName1;
|
|
44 |
private TaxonName<?,?> synName1;
|
|
45 |
private TaxonName<?,?> synName2;
|
|
46 |
private TaxonName<?,?> synName3;
|
|
43 |
private TaxonName accName1; |
|
44 |
private TaxonName synName1; |
|
45 |
private TaxonName synName2; |
|
46 |
private TaxonName synName3; |
|
47 | 47 |
private Person person1; |
48 | 48 |
private Person person2; |
49 | 49 |
private Person person3; |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/validation/NameMustFollowCodeTest.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
@Test |
64 | 64 |
public void testValidEmptyNames() { |
65 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations
|
|
65 |
Set<ConstraintViolation<TaxonName>> constraintViolations |
|
66 | 66 |
= validator.validate(cultivarName); |
67 | 67 |
assertTrue("There should be no constraint violations as this name has data set and therefore no unvalid attributes set", constraintViolations.isEmpty()); |
68 | 68 |
|
... | ... | |
82 | 82 |
@Test |
83 | 83 |
public void testMessage() { |
84 | 84 |
nonViralName.setAcronym("acronym"); |
85 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(nonViralName);
|
|
85 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(nonViralName); |
|
86 | 86 |
assertFalse("There should be a constraint violation as a nonViralName must not have an acronym", constraintViolations.isEmpty()); |
87 | 87 |
String message = constraintViolations.iterator().next().getMessage(); |
88 | 88 |
String expected = "Taxon name must only have attributes set that are available according to their code. E.g. 'acronym name' should only be available for viral names."; |
... | ... | |
92 | 92 |
@Test |
93 | 93 |
public void testValidNonViralName() { |
94 | 94 |
nonViralName.setAcronym("acronym"); |
95 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(nonViralName);
|
|
95 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(nonViralName); |
|
96 | 96 |
assertFalse("There should be a constraint violation as a nonViralName must not have an acronym", constraintViolations.isEmpty()); |
97 | 97 |
|
98 | 98 |
nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES()); |
... | ... | |
148 | 148 |
@Test |
149 | 149 |
public void testValidViralName() { |
150 | 150 |
viralName.setAcronym("acronym"); |
151 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(viralName);
|
|
151 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(viralName); |
|
152 | 152 |
assertTrue("There should be no constraint violation as a viral name may have acronym set", constraintViolations.isEmpty()); |
153 | 153 |
|
154 | 154 |
//Invalid |
... | ... | |
183 | 183 |
zoologicalName.setOriginalPublicationYear(1987); |
184 | 184 |
zoologicalName.setPublicationYear(2001); |
185 | 185 |
|
186 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(zoologicalName);
|
|
186 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(zoologicalName); |
|
187 | 187 |
assertTrue("There should be no constraint violation as a zoological name may have breed and years set", constraintViolations.isEmpty()); |
188 | 188 |
} |
189 | 189 |
|
... | ... | |
192 | 192 |
bacterialName.setSubGenusAuthorship("Subgenus author"); |
193 | 193 |
bacterialName.setNameApprobation("Name approbation"); |
194 | 194 |
|
195 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(bacterialName);
|
|
195 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(bacterialName); |
|
196 | 196 |
assertTrue("There should be no constraint violation as a bacterial name may have subgenus authorship or name approbation set", constraintViolations.isEmpty()); |
197 | 197 |
} |
198 | 198 |
|
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/DeduplicationHelper.java | ||
---|---|---|
265 | 265 |
//TODO cast |
266 | 266 |
getCollectionRoles(clazz, sessionFactory); |
267 | 267 |
|
268 |
TaxonName<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
|
268 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null); |
|
269 | 269 |
name1.getTaxonBases(); |
270 | 270 |
|
271 | 271 |
Type propType = sessionFactory.getReferencedPropertyType(TaxonName.class.getCanonicalName(), "taxonBases"); |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/name/TaxonNameDaoHibernateImpl.java | ||
---|---|---|
395 | 395 |
} |
396 | 396 |
|
397 | 397 |
|
398 |
public List<TaxonName<?,?>> searchNames(String queryString, MatchMode matchMode, Integer pageSize, Integer pageNumber) {
|
|
398 |
public List<TaxonName> searchNames(String queryString, MatchMode matchMode, Integer pageSize, Integer pageNumber) { |
|
399 | 399 |
checkNotInPriorView("TaxonNameDaoHibernateImpl.searchNames(String queryString, Integer pageSize, Integer pageNumber)"); |
400 | 400 |
Criteria criteria = getSession().createCriteria(TaxonName.class); |
401 | 401 |
|
... | ... | |
410 | 410 |
criteria.setFirstResult(0); |
411 | 411 |
} |
412 | 412 |
} |
413 |
List<TaxonName<?,?>> results = criteria.list();
|
|
413 |
List<TaxonName> results = criteria.list(); |
|
414 | 414 |
return results; |
415 | 415 |
} |
416 | 416 |
|
417 | 417 |
|
418 | 418 |
@Override |
419 |
public List<TaxonName<?,?>> searchNames(String queryString, Integer pageSize, Integer pageNumber) {
|
|
419 |
public List<TaxonName> searchNames(String queryString, Integer pageSize, Integer pageNumber) { |
|
420 | 420 |
return searchNames(queryString, MatchMode.BEGINNING, pageSize, pageNumber); |
421 | 421 |
} |
422 | 422 |
|
... | ... | |
521 | 521 |
} |
522 | 522 |
|
523 | 523 |
@Override |
524 |
public List<? extends TaxonName<?,?>> findByName(boolean doIncludeAuthors,
|
|
524 |
public List<? extends TaxonName> findByName(boolean doIncludeAuthors, |
|
525 | 525 |
String queryString, MatchMode matchmode, Integer pageSize, |
526 | 526 |
Integer pageNumber, List<Criterion> criteria, List<String> propertyPaths) { |
527 | 527 |
|
... | ... | |
564 | 564 |
} |
565 | 565 |
|
566 | 566 |
@SuppressWarnings("unchecked") |
567 |
List<? extends TaxonName<?,?>> results = crit.list();
|
|
567 |
List<? extends TaxonName> results = crit.list(); |
|
568 | 568 |
defaultBeanInitializer.initializeAll(results, propertyPaths); |
569 | 569 |
|
570 | 570 |
return results; |
571 | 571 |
} |
572 | 572 |
|
573 | 573 |
@Override |
574 |
public List<? extends TaxonName<?,?>> findByTitle(String queryString,
|
|
574 |
public List<? extends TaxonName> findByTitle(String queryString, |
|
575 | 575 |
MatchMode matchmode, Integer pageSize, Integer pageNumber, List<Criterion> criteria, List<String> propertyPaths) { |
576 | 576 |
|
577 | 577 |
Criteria crit = getSession().createCriteria(type); |
... | ... | |
594 | 594 |
} |
595 | 595 |
} |
596 | 596 |
|
597 |
List<? extends TaxonName<?,?>> results = crit.list();
|
|
597 |
List<? extends TaxonName> results = crit.list(); |
|
598 | 598 |
defaultBeanInitializer.initializeAll(results, propertyPaths); |
599 | 599 |
|
600 | 600 |
return results; |
... | ... | |
619 | 619 |
} |
620 | 620 |
crit.addOrder(Order.asc("uuid")); |
621 | 621 |
|
622 |
List<? extends TaxonName<?,?>> results = crit.list();
|
|
622 |
List<? extends TaxonName> results = crit.list(); |
|
623 | 623 |
if (results.size() == 1) { |
624 | 624 |
defaultBeanInitializer.initializeAll(results, propertyPaths); |
625 |
TaxonName<?, ?> taxonName = results.iterator().next();
|
|
625 |
TaxonName taxonName = results.iterator().next(); |
|
626 | 626 |
return taxonName; |
627 | 627 |
} else if (results.size() > 1) { |
628 | 628 |
logger.error("Multiple results for UUID: " + uuid); |
... | ... | |
701 | 701 |
public Integer countByName(String queryString, MatchMode matchmode, List<Criterion> criteria) { |
702 | 702 |
//TODO improve performance |
703 | 703 |
boolean includeAuthors = false; |
704 |
List<? extends TaxonName<?,?>> results = findByName(
|
|
704 |
List<? extends TaxonName> results = findByName( |
|
705 | 705 |
includeAuthors,queryString, matchmode, null, null, criteria, null); |
706 | 706 |
return results.size(); |
707 | 707 |
|
... | ... | |
791 | 791 |
} |
792 | 792 |
|
793 | 793 |
@SuppressWarnings("unchecked") |
794 |
List<? extends TaxonName<?,?>> results = criteria.list();
|
|
794 |
List<? extends TaxonName> results = criteria.list(); |
|
795 | 795 |
if (results.size() == 1) { |
796 | 796 |
defaultBeanInitializer.initializeAll(results, null); |
797 |
TaxonName<?, ?> taxonName = results.iterator().next();
|
|
797 |
TaxonName taxonName = results.iterator().next(); |
|
798 | 798 |
if (taxonName.isZoological()) { |
799 | 799 |
IZoologicalName zoologicalName = taxonName; |
800 | 800 |
return zoologicalName; |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import eu.etaxonomy.cdm.model.common.DefinedTerm; |
44 | 44 |
import eu.etaxonomy.cdm.model.common.IdentifiableEntity; |
45 |
import eu.etaxonomy.cdm.model.common.IdentifiableSource; |
|
45 | 46 |
import eu.etaxonomy.cdm.model.common.LSID; |
46 | 47 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
47 |
import eu.etaxonomy.cdm.model.common.OriginalSourceBase; |
|
48 | 48 |
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction; |
49 | 49 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
50 | 50 |
import eu.etaxonomy.cdm.model.name.Rank; |
... | ... | |
192 | 192 |
boolean includeAuthors = false; |
193 | 193 |
List<UuidAndTitleCache<IdentifiableEntity>> resultObjects = new ArrayList<UuidAndTitleCache<IdentifiableEntity>>(); |
194 | 194 |
if (doNamesWithoutTaxa){ |
195 |
List<? extends TaxonName<?,?>> nameResult = taxonNameDao.findByName(
|
|
195 |
List<? extends TaxonName> nameResult = taxonNameDao.findByName( |
|
196 | 196 |
includeAuthors, queryString, matchMode, null, null, null, null); |
197 | 197 |
|
198 | 198 |
for (TaxonName name: nameResult){ |
... | ... | |
1357 | 1357 |
query = getSession().createQuery("from ZoologicalName zn where zn.nameCache IN (:identicalNames)"); |
1358 | 1358 |
query.setParameterList("identicalNames", identicalNames); |
1359 | 1359 |
List<TaxonName> result = query.list(); |
1360 |
TaxonName temp = result.get(0); |
|
1360 |
TaxonName tempName = result.get(0);
|
|
1361 | 1361 |
|
1362 |
Iterator<OriginalSourceBase> sources = temp.getSources().iterator();
|
|
1362 |
Iterator<IdentifiableSource> sources = tempName.getSources().iterator();
|
|
1363 | 1363 |
|
1364 | 1364 |
TaxonNameComparator taxComp = new TaxonNameComparator(); |
1365 | 1365 |
Collections.sort(result, taxComp); |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/initializer/TitleAndNameCacheAutoInitializer.java | ||
---|---|---|
72 | 72 |
} |
73 | 73 |
} else if(bean instanceof TaxonName) { |
74 | 74 |
// ---> TaxonName |
75 |
TaxonName n = (TaxonName<?,?>)bean;
|
|
75 |
TaxonName n = (TaxonName)bean; |
|
76 | 76 |
if(!n.isProtectedFullTitleCache()) { |
77 | 77 |
n.getFullTitleCache(); |
78 | 78 |
} else if(!bean.isProtectedTitleCache()){ |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/name/ITaxonNameDao.java | ||
---|---|---|
229 | 229 |
* set (0 - based) |
230 | 230 |
* @return a List of TaxonName instances |
231 | 231 |
*/ |
232 |
public List<TaxonName<?, ?>> searchNames(String queryString,
|
|
232 |
public List<TaxonName> searchNames(String queryString, |
|
233 | 233 |
Integer pageSize, Integer pageNumber); |
234 | 234 |
|
235 | 235 |
|
... | ... | |
252 | 252 |
* @param propertyPaths TODO |
253 | 253 |
* @return |
254 | 254 |
*/ |
255 |
public List<? extends TaxonName<?, ?>> findByName(boolean doIncludeAuthors,
|
|
255 |
public List<? extends TaxonName> findByName(boolean doIncludeAuthors, |
|
256 | 256 |
String queryString, |
257 | 257 |
MatchMode matchmode, Integer pageSize, Integer pageNumber, |
258 | 258 |
List<Criterion> criteria, List<String> propertyPaths); |
... | ... | |
266 | 266 |
* @param propertyPaths TODO |
267 | 267 |
* @return |
268 | 268 |
*/ |
269 |
public List<? extends TaxonName<?, ?>> findByTitle(String queryString,
|
|
269 |
public List<? extends TaxonName> findByTitle(String queryString, |
|
270 | 270 |
MatchMode matchmode, Integer pageSize, Integer pageNumber, |
271 | 271 |
List<Criterion> criteria, List<String> propertyPaths); |
272 | 272 |
|
... | ... | |
281 | 281 |
* |
282 | 282 |
* @return |
283 | 283 |
*/ |
284 |
public TaxonName<?, ?> findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
|
|
284 |
public TaxonName findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths); |
|
285 | 285 |
|
286 | 286 |
/** |
287 | 287 |
* @param queryString |
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/BeanInitializerIntegration.java | ||
---|---|---|
98 | 98 |
propertyPaths.add("combinationAuthorship"); |
99 | 99 |
propertyPaths.add("hybridRelationships"); |
100 | 100 |
|
101 |
TaxonName<?,?> sphingidae = taxonNameDao.load(sphingidaeUuid, propertyPaths);
|
|
101 |
TaxonName sphingidae = taxonNameDao.load(sphingidaeUuid, propertyPaths); |
|
102 | 102 |
setComplete(); |
103 | 103 |
endTransaction(); |
104 | 104 |
|
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/CdmGenericDaoImplTest.java | ||
---|---|---|
492 | 492 |
// @Ignore |
493 | 493 |
public void testMergeCdmBaseReferenceAndIdentifiable() throws MergeException { |
494 | 494 |
|
495 |
TaxonName<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
495 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
496 | 496 |
name1.setTitleCache("BotanicalName1", true); |
497 | 497 |
|
498 |
TaxonName<?,?> name2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
498 |
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
499 | 499 |
name2.setTitleCache("BotanicalName2", true); |
500 | 500 |
|
501 | 501 |
TaxonName zooName1 = TaxonNameFactory.NewZoologicalInstance(Rank.SPECIES()); |
... | ... | |
622 | 622 |
@Test |
623 | 623 |
// @Ignore |
624 | 624 |
public void testMergeTaxonNameAndTaxon() throws MergeException { |
625 |
TaxonName<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
625 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
626 | 626 |
name1.setTitleCache("BotanicalName1", true); |
627 | 627 |
|
628 |
TaxonName<?,?> name2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
628 |
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
629 | 629 |
name2.setTitleCache("BotanicalName2", true); |
630 | 630 |
|
631 | 631 |
IBotanicalName name3 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
... | ... | |
869 | 869 |
UUID uuidAbiesAlba = UUID.fromString("6ed56b43-7cca-4c3b-bb90-7576da81c072"); |
870 | 870 |
|
871 | 871 |
// CREATE DATA |
872 |
TaxonName<?,?> pinusAlba = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
872 |
TaxonName pinusAlba = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
873 | 873 |
pinusAlba.setTitleCache("BotanicalName1", true); |
874 | 874 |
pinusAlba.setUuid(uuidPinusAlba); |
875 | 875 |
|
876 |
TaxonName<?,?> abiesAlba = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
876 |
TaxonName abiesAlba = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
877 | 877 |
abiesAlba.setTitleCache("Abies alba", true); |
878 | 878 |
abiesAlba.setUuid(uuidAbiesAlba); |
879 | 879 |
|
... | ... | |
912 | 912 |
@Test |
913 | 913 |
public void testReallocatePersonTeam() throws MergeException { |
914 | 914 |
|
915 |
TaxonName<?,?> name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
|
|
915 |
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()); |
|
916 | 916 |
name1.setTitleCache("BotanicalName1", true); |
917 | 917 |
|
918 | 918 |
IBook book1 = ReferenceFactory.newBook(); |
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/hibernate/CacheStrategyGeneratorTest.java | ||
---|---|---|
101 | 101 |
@ExpectedDataSet |
102 | 102 |
public void testOnSaveOrUpdateNames() { |
103 | 103 |
//names |
104 |
TaxonName<?,?> name = cdmEntityDaoBase.findByUuid(UUID.fromString("a49a3963-c4ea-4047-8588-2f8f15352730"));
|
|
104 |
TaxonName name = cdmEntityDaoBase.findByUuid(UUID.fromString("a49a3963-c4ea-4047-8588-2f8f15352730")); |
|
105 | 105 |
name.setTitleCache(null, false); |
106 | 106 |
name.setNameCache(null, false); |
107 | 107 |
name.setGenusOrUninomial("Abies"); |
108 | 108 |
name.setAuthorshipCache("Mill.", true); |
109 | 109 |
cdmEntityDaoBase.saveOrUpdate(name); |
110 |
TaxonName<?,?> name2 = cdmEntityDaoBase.findByUuid(UUID.fromString("05a438d6-065f-49ef-84db-c7dc2c259975"));
|
|
110 |
TaxonName name2 = cdmEntityDaoBase.findByUuid(UUID.fromString("05a438d6-065f-49ef-84db-c7dc2c259975")); |
|
111 | 111 |
name2.setProtectedFullTitleCache(false); |
112 | 112 |
name2.setProtectedTitleCache(false); |
113 | 113 |
name2.setProtectedNameCache(false); |
Also available in: Unified diff
ref #6630 and ref #6368 remove generics from TaxonName