Revision 9ec434f6
Added by Andreas Müller over 2 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java | ||
---|---|---|
188 | 188 |
|
189 | 189 |
// ****************************** METHODS ********************************/ |
190 | 190 |
|
191 |
|
|
192 |
/** |
|
193 |
* {@inheritDoc} |
|
194 |
*/ |
|
195 | 191 |
@Override |
196 | 192 |
public TaxonBase load(UUID uuid, boolean includeUnpublished, List<String> propertyPaths) { |
197 | 193 |
return dao.load(uuid, includeUnpublished, propertyPaths); |
... | ... | |
238 | 234 |
newTaxon.removeTaxonRelation(taxonRelationship); |
239 | 235 |
} |
240 | 236 |
|
241 |
|
|
242 | 237 |
for(TaxonRelationship taxonRelationship : acceptedTaxon.getTaxonRelations()){ |
243 | 238 |
Taxon fromTaxon = HibernateProxyHelper.deproxy(taxonRelationship.getFromTaxon()); |
244 | 239 |
Taxon toTaxon = HibernateProxyHelper.deproxy(taxonRelationship.getToTaxon()); |
... | ... | |
262 | 257 |
taxonRelationship.setFromTaxon(null); |
263 | 258 |
} |
264 | 259 |
|
265 |
|
|
266 | 260 |
//Move descriptions to new taxon |
267 | 261 |
List<TaxonDescription> descriptions = new ArrayList<TaxonDescription>( newTaxon.getDescriptions()); //to avoid concurrent modification errors (newAcceptedTaxon.addDescription() modifies also oldtaxon.descritpions()) |
268 | 262 |
for(TaxonDescription description : descriptions){ |
... | ... | |
281 | 275 |
// //oldTaxon.removeDescription(description, false); |
282 | 276 |
// newTaxon.addDescription(description); |
283 | 277 |
} |
284 |
List<TaxonNode> nodes = new ArrayList(acceptedTaxon.getTaxonNodes()); |
|
278 |
List<TaxonNode> nodes = new ArrayList<>(acceptedTaxon.getTaxonNodes());
|
|
285 | 279 |
for (TaxonNode node: nodes){ |
286 | 280 |
node = HibernateProxyHelper.deproxy(node, TaxonNode.class); |
287 | 281 |
TaxonNode parent = node.getParent(); |
... | ... | |
315 | 309 |
} |
316 | 310 |
result.includeResult(deleteResult); |
317 | 311 |
return result; |
318 |
|
|
319 |
|
|
320 | 312 |
} |
321 | 313 |
|
322 |
|
|
323 | 314 |
@Override |
324 | 315 |
@Transactional(readOnly = false) |
325 | 316 |
public UpdateResult changeSynonymToAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, boolean deleteSynonym) { |
... | ... | |
388 | 379 |
return result; |
389 | 380 |
} |
390 | 381 |
|
391 |
|
|
392 |
|
|
393 |
|
|
394 | 382 |
@Override |
395 | 383 |
@Transactional(readOnly = false) |
396 | 384 |
public UpdateResult changeSynonymToRelatedTaxon(UUID synonymUuid, |
... | ... | |
486 | 474 |
SynonymType relType = isHomotypicToTaxon? SynonymType.HOMOTYPIC_SYNONYM_OF() : SynonymType.HETEROTYPIC_SYNONYM_OF(); |
487 | 475 |
targetTaxon.addSynonym(synonym, relType); |
488 | 476 |
} |
489 |
|
|
490 | 477 |
} |
491 | 478 |
|
492 | 479 |
@Override |
... | ... | |
504 | 491 |
this.dao = dao; |
505 | 492 |
} |
506 | 493 |
|
507 |
|
|
508 | 494 |
@Override |
509 | 495 |
public <T extends TaxonBase> Pager<T> findTaxaByName(Class<T> clazz, String uninomial, String infragenericEpithet, String specificEpithet, |
510 | 496 |
String infraspecificEpithet, String authorshipCache, Rank rank, Integer pageSize,Integer pageNumber, List<String> propertyPaths) { |
... | ... | |
656 | 642 |
return relatedTaxa; |
657 | 643 |
} |
658 | 644 |
|
659 |
|
|
660 | 645 |
/** |
661 | 646 |
* Recursively collect related taxa for the given <code>taxon</code> . The returned list will also include the |
662 | 647 |
* <code>taxon</code> supplied as parameter. |
... | ... | |
737 | 722 |
taxon = (Taxon)dao.load(taxon.getUuid(), propertyPaths); |
738 | 723 |
HomotypicGroupTaxonComparator comparator = new HomotypicGroupTaxonComparator(taxon); |
739 | 724 |
|
740 |
|
|
741 | 725 |
//homotypic |
742 | 726 |
result.add(taxon.getHomotypicSynonymsByHomotypicGroup(comparator)); |
743 | 727 |
|
... | ... | |
748 | 732 |
} |
749 | 733 |
|
750 | 734 |
return result; |
751 |
|
|
752 | 735 |
} |
753 | 736 |
|
754 | 737 |
@Override |
... | ... | |
786 | 769 |
@Override |
787 | 770 |
public Pager<IdentifiableEntity> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator) { |
788 | 771 |
|
772 |
@SuppressWarnings("rawtypes") |
|
789 | 773 |
List<IdentifiableEntity> results = new ArrayList<>(); |
790 | 774 |
long numberOfResults = 0; // overall number of results (as opposed to number of results per page) |
791 | 775 |
List<TaxonBase> taxa = null; |
... | ... | |
814 | 798 |
configurator.getMatchMode(), configurator.getNamedAreas(), configurator.isIncludeUnpublished(), |
815 | 799 |
configurator.getOrder(), configurator.getPageSize(), configurator.getPageNumber(), propertyPath); |
816 | 800 |
} |
817 |
} |
|
801 |
}
|
|
818 | 802 |
|
819 | 803 |
if (logger.isDebugEnabled()) { logger.debug(numberTaxaResults + " matching taxa counted"); } |
820 | 804 |
|
... | ... | |
913 | 897 |
|
914 | 898 |
if(includeOccurrences != null && includeOccurrences) { |
915 | 899 |
logger.trace("listMedia() - includeOccurrences"); |
900 |
@SuppressWarnings("rawtypes") |
|
916 | 901 |
Set<SpecimenOrObservationBase> specimensOrObservations = new HashSet<>(); |
917 | 902 |
// --- Specimens |
918 | 903 |
for (Taxon t : taxa) { |
... | ... | |
968 | 953 |
} |
969 | 954 |
} |
970 | 955 |
|
971 |
|
|
972 | 956 |
logger.trace("listMedia() - initialize"); |
973 | 957 |
beanInitializer.initializeAll(taxonMedia, propertyPath); |
974 | 958 |
|
... | ... | |
992 | 976 |
return this.dao.countSynonyms(onlyAttachedToTaxon); |
993 | 977 |
} |
994 | 978 |
|
995 |
|
|
996 |
|
|
997 | 979 |
@Override |
998 | 980 |
@Transactional(readOnly=false) |
999 | 981 |
public DeleteResult deleteTaxon(UUID taxonUUID, TaxonDeletionConfigurator config, UUID classificationUuid) { |
... | ... | |
1076 | 1058 |
break; |
1077 | 1059 |
} |
1078 | 1060 |
removeDescriptions.add(desc); |
1079 |
|
|
1080 |
|
|
1081 | 1061 |
} |
1082 | 1062 |
if (result.isOk()){ |
1083 | 1063 |
for (TaxonDescription desc: removeDescriptions){ |
... | ... | |
1089 | 1069 |
} |
1090 | 1070 |
} |
1091 | 1071 |
|
1092 |
|
|
1093 |
if (! config.isDeleteTaxonNodes() || (!config.isDeleteInAllClassifications() && classification == null && taxon.getTaxonNodes().size() > 1)){ |
|
1094 |
result.addException(new Exception( "Taxon can't be deleted as it is used in more than one classification.")); |
|
1095 |
}else{ |
|
1096 |
if (taxon.getTaxonNodes().size() != 0){ |
|
1097 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
|
1098 |
Iterator<TaxonNode> iterator = nodes.iterator(); |
|
1099 |
TaxonNode node = null; |
|
1100 |
boolean deleteChildren; |
|
1101 |
if (config.getTaxonNodeConfig().getChildHandling().equals(ChildHandling.DELETE)){ |
|
1102 |
deleteChildren = true; |
|
1103 |
}else { |
|
1104 |
deleteChildren = false; |
|
1105 |
} |
|
1106 |
boolean success = true; |
|
1107 |
if (!config.isDeleteInAllClassifications() && !(classification == null)){ |
|
1108 |
while (iterator.hasNext()){ |
|
1109 |
node = iterator.next(); |
|
1110 |
if (node.getClassification().equals(classification)){ |
|
1111 |
break; |
|
1112 |
} |
|
1113 |
node = null; |
|
1114 |
} |
|
1115 |
if (node != null){ |
|
1116 |
HibernateProxyHelper.deproxy(node, TaxonNode.class); |
|
1117 |
success =taxon.removeTaxonNode(node, deleteChildren); |
|
1118 |
nodeService.delete(node); |
|
1119 |
result.addDeletedObject(node); |
|
1120 |
} else { |
|
1121 |
result.setError(); |
|
1122 |
result.addException(new Exception("The taxon can not be deleted because it is not used in defined classification.")); |
|
1072 |
if (! config.isDeleteTaxonNodes() || (!config.isDeleteInAllClassifications() && classification == null && taxon.getTaxonNodes().size() > 1)){ |
|
1073 |
result.addException(new Exception( "Taxon can't be deleted as it is used in more than one classification.")); |
|
1074 |
}else{ |
|
1075 |
if (taxon.getTaxonNodes().size() != 0){ |
|
1076 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
|
1077 |
Iterator<TaxonNode> iterator = nodes.iterator(); |
|
1078 |
TaxonNode node = null; |
|
1079 |
boolean deleteChildren; |
|
1080 |
if (config.getTaxonNodeConfig().getChildHandling().equals(ChildHandling.DELETE)){ |
|
1081 |
deleteChildren = true; |
|
1082 |
}else { |
|
1083 |
deleteChildren = false; |
|
1123 | 1084 |
} |
1124 |
} else if (config.isDeleteInAllClassifications()){ |
|
1125 |
List<TaxonNode> nodesList = new ArrayList<>(); |
|
1126 |
nodesList.addAll(taxon.getTaxonNodes()); |
|
1127 |
for (ITaxonTreeNode treeNode: nodesList){ |
|
1128 |
TaxonNode taxonNode = (TaxonNode) treeNode; |
|
1129 |
if(!deleteChildren){ |
|
1130 |
Object[] childNodes = taxonNode.getChildNodes().toArray(); |
|
1131 |
for (Object childNode: childNodes){ |
|
1132 |
TaxonNode childNodeCast = (TaxonNode) childNode; |
|
1133 |
taxonNode.getParent().addChildNode(childNodeCast, childNodeCast.getReference(), childNodeCast.getMicroReference()); |
|
1085 |
boolean success = true; |
|
1086 |
if (!config.isDeleteInAllClassifications() && !(classification == null)){ |
|
1087 |
while (iterator.hasNext()){ |
|
1088 |
node = iterator.next(); |
|
1089 |
if (node.getClassification().equals(classification)){ |
|
1090 |
break; |
|
1091 |
} |
|
1092 |
node = null; |
|
1093 |
} |
|
1094 |
if (node != null){ |
|
1095 |
HibernateProxyHelper.deproxy(node, TaxonNode.class); |
|
1096 |
success =taxon.removeTaxonNode(node, deleteChildren); |
|
1097 |
nodeService.delete(node); |
|
1098 |
result.addDeletedObject(node); |
|
1099 |
} else { |
|
1100 |
result.setError(); |
|
1101 |
result.addException(new Exception("The taxon can not be deleted because it is not used in defined classification.")); |
|
1102 |
} |
|
1103 |
} else if (config.isDeleteInAllClassifications()){ |
|
1104 |
List<TaxonNode> nodesList = new ArrayList<>(); |
|
1105 |
nodesList.addAll(taxon.getTaxonNodes()); |
|
1106 |
for (ITaxonTreeNode treeNode: nodesList){ |
|
1107 |
TaxonNode taxonNode = (TaxonNode) treeNode; |
|
1108 |
if(!deleteChildren){ |
|
1109 |
Object[] childNodes = taxonNode.getChildNodes().toArray(); |
|
1110 |
for (Object childNode: childNodes){ |
|
1111 |
TaxonNode childNodeCast = (TaxonNode) childNode; |
|
1112 |
taxonNode.getParent().addChildNode(childNodeCast, childNodeCast.getReference(), childNodeCast.getMicroReference()); |
|
1113 |
} |
|
1134 | 1114 |
} |
1135 | 1115 |
} |
1116 |
config.getTaxonNodeConfig().setDeleteElement(false); |
|
1117 |
DeleteResult resultNodes = nodeService.deleteTaxonNodes(nodesList, config); |
|
1118 |
if (!resultNodes.isOk()){ |
|
1119 |
result.addExceptions(resultNodes.getExceptions()); |
|
1120 |
result.setStatus(resultNodes.getStatus()); |
|
1121 |
} else { |
|
1122 |
result.addUpdatedObjects(resultNodes.getUpdatedObjects()); |
|
1123 |
} |
|
1136 | 1124 |
} |
1137 |
config.getTaxonNodeConfig().setDeleteElement(false); |
|
1138 |
DeleteResult resultNodes = nodeService.deleteTaxonNodes(nodesList, config); |
|
1139 |
if (!resultNodes.isOk()){ |
|
1140 |
result.addExceptions(resultNodes.getExceptions()); |
|
1141 |
result.setStatus(resultNodes.getStatus()); |
|
1142 |
} else { |
|
1143 |
result.addUpdatedObjects(resultNodes.getUpdatedObjects()); |
|
1125 |
if (!success){ |
|
1126 |
result.setError(); |
|
1127 |
result.addException(new Exception("The taxon can not be deleted because the taxon node can not be removed.")); |
|
1144 | 1128 |
} |
1145 | 1129 |
} |
1146 |
if (!success){ |
|
1147 |
result.setError(); |
|
1148 |
result.addException(new Exception("The taxon can not be deleted because the taxon node can not be removed.")); |
|
1149 |
} |
|
1150 |
} |
|
1151 |
} |
|
1152 |
TaxonName name = taxon.getName(); |
|
1153 |
taxon.setName(null); |
|
1154 |
this.saveOrUpdate(taxon); |
|
1155 |
|
|
1156 |
if ((taxon.getTaxonNodes() == null || taxon.getTaxonNodes().size()== 0) && result.isOk()){ |
|
1157 |
try{ |
|
1158 |
dao.delete(taxon); |
|
1159 |
result.addDeletedObject(taxon); |
|
1160 |
}catch(Exception e){ |
|
1161 |
result.addException(e); |
|
1162 |
result.setError(); |
|
1163 | 1130 |
} |
1164 |
} else { |
|
1165 |
result.setError(); |
|
1166 |
result.addException(new Exception("The Taxon can't be deleted because it is used in a classification.")); |
|
1131 |
TaxonName name = taxon.getName(); |
|
1132 |
taxon.setName(null); |
|
1133 |
this.saveOrUpdate(taxon); |
|
1134 |
|
|
1135 |
if ((taxon.getTaxonNodes() == null || taxon.getTaxonNodes().size()== 0) && result.isOk()){ |
|
1136 |
try{ |
|
1137 |
dao.delete(taxon); |
|
1138 |
result.addDeletedObject(taxon); |
|
1139 |
}catch(Exception e){ |
|
1140 |
result.addException(e); |
|
1141 |
result.setError(); |
|
1142 |
} |
|
1143 |
} else { |
|
1144 |
result.setError(); |
|
1145 |
result.addException(new Exception("The Taxon can't be deleted because it is used in a classification.")); |
|
1167 | 1146 |
|
1168 |
} |
|
1169 |
//TaxonName |
|
1170 |
if (config.isDeleteNameIfPossible() && result.isOk()){ |
|
1171 |
DeleteResult nameResult = new DeleteResult(); |
|
1172 |
//remove name if possible (and required) |
|
1173 |
if (name != null ){ |
|
1174 |
nameResult = nameService.delete(name.getUuid(), config.getNameDeletionConfig()); |
|
1175 |
} |
|
1176 |
if (nameResult.isError() || nameResult.isAbort()){ |
|
1177 |
result.addRelatedObject(name); |
|
1178 |
result.addExceptions(nameResult.getExceptions()); |
|
1179 |
}else{ |
|
1180 |
result.includeResult(nameResult); |
|
1181 |
} |
|
1182 |
} |
|
1147 |
}
|
|
1148 |
//TaxonName
|
|
1149 |
if (config.isDeleteNameIfPossible() && result.isOk()){
|
|
1150 |
DeleteResult nameResult = new DeleteResult();
|
|
1151 |
//remove name if possible (and required)
|
|
1152 |
if (name != null ){
|
|
1153 |
nameResult = nameService.delete(name.getUuid(), config.getNameDeletionConfig());
|
|
1154 |
}
|
|
1155 |
if (nameResult.isError() || nameResult.isAbort()){
|
|
1156 |
result.addRelatedObject(name);
|
|
1157 |
result.addExceptions(nameResult.getExceptions());
|
|
1158 |
}else{
|
|
1159 |
result.includeResult(nameResult);
|
|
1160 |
}
|
|
1161 |
}
|
|
1183 | 1162 |
} |
1184 | 1163 |
|
1185 | 1164 |
return result; |
1186 |
|
|
1187 | 1165 |
} |
1188 | 1166 |
|
1189 | 1167 |
@Override |
... | ... | |
1197 | 1175 |
@Transactional(readOnly = false) |
1198 | 1176 |
public DeleteResult deleteSynonym(UUID synonymUuid, SynonymDeletionConfigurator config) { |
1199 | 1177 |
return deleteSynonym((Synonym)dao.load(synonymUuid), config); |
1200 |
|
|
1201 | 1178 |
} |
1202 | 1179 |
|
1203 |
|
|
1204 | 1180 |
@Override |
1205 | 1181 |
@Transactional(readOnly = false) |
1206 | 1182 |
public DeleteResult deleteSynonym(Synonym synonym, SynonymDeletionConfigurator config) { |
... | ... | |
1251 | 1227 |
result.addDeletedObject(name); |
1252 | 1228 |
} |
1253 | 1229 |
} |
1254 |
|
|
1255 | 1230 |
} |
1256 | 1231 |
return result; |
1257 | 1232 |
} |
... | ... | |
1261 | 1236 |
return this.dao.findIdenticalNames(sourceRefUuids, propertyPaths); |
1262 | 1237 |
} |
1263 | 1238 |
|
1264 |
|
|
1265 | 1239 |
@Override |
1266 | 1240 |
public Taxon findBestMatchingTaxon(String taxonName) { |
1267 | 1241 |
MatchingTaxonConfigurator config = MatchingTaxonConfigurator.NewInstance(); |
... | ... | |
1307 | 1281 |
countEqualCandidates = 1; |
1308 | 1282 |
continue; |
1309 | 1283 |
} |
1310 |
|
|
1311 | 1284 |
}else{ //not Taxon.class |
1312 | 1285 |
continue; |
1313 | 1286 |
} |
... | ... | |
1324 | 1297 |
} |
1325 | 1298 |
} |
1326 | 1299 |
|
1327 |
|
|
1328 | 1300 |
// 2. search for synonyms |
1329 | 1301 |
if (config.isIncludeSynonyms()){ |
1330 | 1302 |
List<TaxonBase> synonymList = dao.findByNameTitleCache(false, true, config.isIncludeUnpublished(), |
... | ... | |
1506 | 1478 |
|
1507 | 1479 |
// --- initialize taxa, thighlight matches .... |
1508 | 1480 |
ISearchResultBuilder searchResultBuilder = new SearchResultBuilder(luceneSearch, luceneSearch.getQuery()); |
1481 |
@SuppressWarnings("rawtypes") |
|
1509 | 1482 |
List<SearchResult<TaxonBase>> searchResults = searchResultBuilder.createResultSet( |
1510 | 1483 |
topDocsResultSet, luceneSearch.getHighlightFields(), dao, idFieldMap, propertyPaths); |
1511 | 1484 |
|
... | ... | |
1513 | 1486 |
return new DefaultPagerImpl<>(pageNumber, totalHits, pageSize, searchResults); |
1514 | 1487 |
} |
1515 | 1488 |
|
1516 |
|
|
1517 |
|
|
1518 | 1489 |
@Transactional(readOnly = true) |
1519 | 1490 |
@Override |
1520 | 1491 |
public <S extends TaxonBase> Pager<S> findByTitleWithRestrictions(Class<S> clazz, String queryString, MatchMode matchmode, List<Restriction<?>> restrictions, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) { |
... | ... | |
1531 | 1502 |
return new DefaultPagerImpl<>(pageNumber, numberOfResults, pageSize, results); |
1532 | 1503 |
} |
1533 | 1504 |
|
1534 |
|
|
1535 | 1505 |
@Transactional(readOnly = true) |
1536 | 1506 |
@Override |
1537 | 1507 |
public <S extends TaxonBase> Pager<S> findByTitle(Class<S> clazz, String queryString,MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) { |
... | ... | |
1553 | 1523 |
return new DefaultPagerImpl<>(pageNumber, numberOfResults, pageSize, results); |
1554 | 1524 |
} |
1555 | 1525 |
|
1556 |
|
|
1557 | 1526 |
@Override |
1558 | 1527 |
public Pager<SearchResult<TaxonBase>> findByDistribution(List<NamedArea> areaFilter, List<PresenceAbsenceTerm> statusFilter, |
1559 | 1528 |
Classification classification, TaxonNode subtree, |
... | ... | |
1780 | 1749 |
// SortField[] sortFields = new SortField[]{SortField.FIELD_SCORE, new SortField("id", SortField.STRING, false)}; |
1781 | 1750 |
// SortField[] sortFields = new SortField[]{new SortField(NomenclaturalSortOrderBrigde.NAME_SORT_FIELD_NAME, SortField.STRING, false)}; |
1782 | 1751 |
|
1783 |
|
|
1784 | 1752 |
boolean addDistributionFilter = namedAreas != null && namedAreas.size() > 0; |
1785 | 1753 |
|
1786 | 1754 |
List<LuceneSearch> luceneSearches = new ArrayList<>(); |
... | ... | |
1984 | 1952 |
} |
1985 | 1953 |
} |
1986 | 1954 |
|
1987 |
|
|
1988 | 1955 |
// search by pro parte synonyms |
1989 | 1956 |
if(searchModes.contains(TaxaAndNamesSearchMode.doSynonyms)) { |
1990 | 1957 |
//TODO merge with misapplied name search once #7487 is fixed |
... | ... | |
2006 | 1973 |
} |
2007 | 1974 |
}//end pro parte synonyms |
2008 | 1975 |
|
2009 |
|
|
2010 |
|
|
2011 | 1976 |
LuceneMultiSearch multiSearch = new LuceneMultiSearch(luceneIndexToolProvider, |
2012 | 1977 |
luceneSearches.toArray(new LuceneSearch[luceneSearches.size()])); |
2013 | 1978 |
|
2014 |
|
|
2015 | 1979 |
if(addDistributionFilter){ |
2016 | 1980 |
|
2017 | 1981 |
// B) |
... | ... | |
2153 | 2117 |
Classification classification, TaxonNode subtree, List<Feature> features, List<Language> languages, |
2154 | 2118 |
boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException { |
2155 | 2119 |
|
2156 |
|
|
2157 | 2120 |
LuceneSearch luceneSearch = prepareByDescriptionElementFullTextSearch(clazz, queryString, classification, subtree, features, languages, highlightFragments); |
2158 | 2121 |
|
2159 | 2122 |
// --- execute search |
... | ... | |
2177 | 2140 |
|
2178 | 2141 |
int totalHits = topDocsResultSet != null ? topDocsResultSet.totalGroupCount : 0; |
2179 | 2142 |
return new DefaultPagerImpl<>(pageNumber, Long.valueOf(totalHits), pageSize, searchResults); |
2180 |
|
|
2181 | 2143 |
} |
2182 | 2144 |
|
2183 |
|
|
2184 | 2145 |
@Override |
2185 | 2146 |
public Pager<SearchResult<TaxonBase>> findByEverythingFullText(String queryString, |
2186 | 2147 |
Classification classification, TaxonNode subtree, boolean includeUnpublished, List<Language> languages, boolean highlightFragments, |
... | ... | |
2216 | 2177 |
|
2217 | 2178 |
int totalHits = topDocsResultSet != null ? topDocsResultSet.totalGroupCount : 0; |
2218 | 2179 |
return new DefaultPagerImpl<>(pageNumber, Long.valueOf(totalHits), pageSize, searchResults); |
2219 |
|
|
2220 | 2180 |
} |
2221 | 2181 |
|
2222 |
|
|
2223 | 2182 |
/** |
2224 | 2183 |
* @param clazz |
2225 | 2184 |
* @param queryString |
... | ... | |
2331 | 2290 |
@Override |
2332 | 2291 |
public List<Synonym> createInferredSynonyms(Taxon taxon, Classification classification, SynonymType type, boolean doWithMisappliedNames){ |
2333 | 2292 |
|
2334 |
|
|
2335 | 2293 |
List <Synonym> inferredSynonyms = new ArrayList<>(); |
2336 | 2294 |
List<Synonym> inferredSynonymsToBeRemoved = new ArrayList<>(); |
2337 | 2295 |
|
... | ... | |
2428 | 2386 |
} |
2429 | 2387 |
|
2430 | 2388 |
if (!taxonNames.isEmpty()){ |
2431 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames); |
|
2432 |
IZoologicalName name;
|
|
2433 |
if (!synNotInCDM.isEmpty()){
|
|
2434 |
inferredSynonymsToBeRemoved.clear(); |
|
2435 |
|
|
2436 |
for (Synonym syn :inferredSynonyms){
|
|
2437 |
name = getZoologicalName(syn.getName().getUuid(), zooHashMap);
|
|
2438 |
if (!synNotInCDM.contains(name.getNameCache())){
|
|
2439 |
inferredSynonymsToBeRemoved.add(syn);
|
|
2389 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames);
|
|
2390 |
if (!synNotInCDM.isEmpty()){
|
|
2391 |
inferredSynonymsToBeRemoved.clear();
|
|
2392 |
|
|
2393 |
for (Synonym syn :inferredSynonyms){ |
|
2394 |
IZoologicalName name = getZoologicalName(syn.getName().getUuid(), zooHashMap);
|
|
2395 |
if (!synNotInCDM.contains(name.getNameCache())){
|
|
2396 |
inferredSynonymsToBeRemoved.add(syn);
|
|
2397 |
}
|
|
2440 | 2398 |
} |
2441 |
} |
|
2442 | 2399 |
|
2443 |
// Remove identified Synonyms from inferredSynonyms |
|
2444 |
for (Synonym synonym : inferredSynonymsToBeRemoved) { |
|
2445 |
inferredSynonyms.remove(synonym); |
|
2400 |
// Remove identified Synonyms from inferredSynonyms |
|
2401 |
for (Synonym synonym : inferredSynonymsToBeRemoved) { |
|
2402 |
inferredSynonyms.remove(synonym); |
|
2403 |
} |
|
2446 | 2404 |
} |
2447 | 2405 |
} |
2448 |
} |
|
2449 |
|
|
2450 |
}else if (type.equals(SynonymType.INFERRED_GENUS_OF())){ |
|
2451 | 2406 |
|
2452 |
for (Synonym synonymRelationOfTaxon:synonymsOfTaxon){
|
|
2407 |
}else if (type.equals(SynonymType.INFERRED_GENUS_OF())){
|
|
2453 | 2408 |
|
2454 |
inferredGenus = createInferredGenus(taxon, |
|
2455 |
zooHashMap, taxonName, epithetOfTaxon, |
|
2456 |
genusOfTaxon, taxonNames, zooParentName, synonymRelationOfTaxon); |
|
2457 |
|
|
2458 |
inferredSynonyms.add(inferredGenus); |
|
2459 |
zooHashMap.put(inferredGenus.getName().getUuid(), inferredGenus.getName()); |
|
2460 |
taxonNames.add(inferredGenus.getName().getNameCache()); |
|
2461 |
} |
|
2462 |
|
|
2463 |
if (doWithMisappliedNames){ |
|
2409 |
for (Synonym synonymRelationOfTaxon:synonymsOfTaxon){ |
|
2464 | 2410 |
|
2465 |
for (TaxonRelationship taxonRelationship: taxonRelListTaxon){
|
|
2466 |
Taxon misappliedName = taxonRelationship.getFromTaxon();
|
|
2467 |
inferredGenus = createInferredGenus(taxon, zooHashMap, taxonName, infraspecificEpithetOfTaxon, genusOfTaxon, taxonNames, zooParentName, misappliedName);
|
|
2411 |
inferredGenus = createInferredGenus(taxon,
|
|
2412 |
zooHashMap, taxonName, epithetOfTaxon,
|
|
2413 |
genusOfTaxon, taxonNames, zooParentName, synonymRelationOfTaxon);
|
|
2468 | 2414 |
|
2469 | 2415 |
inferredSynonyms.add(inferredGenus); |
2470 | 2416 |
zooHashMap.put(inferredGenus.getName().getUuid(), inferredGenus.getName()); |
2471 |
taxonNames.add(inferredGenus.getName().getNameCache());
|
|
2417 |
taxonNames.add(inferredGenus.getName().getNameCache()); |
|
2472 | 2418 |
} |
2473 |
} |
|
2474 |
|
|
2475 | 2419 |
|
2476 |
if (!taxonNames.isEmpty()){ |
|
2477 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames); |
|
2478 |
IZoologicalName name; |
|
2479 |
if (!synNotInCDM.isEmpty()){ |
|
2480 |
inferredSynonymsToBeRemoved.clear(); |
|
2420 |
if (doWithMisappliedNames){ |
|
2481 | 2421 |
|
2482 |
for (Synonym syn :inferredSynonyms){ |
|
2483 |
name = getZoologicalName(syn.getName().getUuid(), zooHashMap); |
|
2484 |
if (!synNotInCDM.contains(name.getNameCache())){ |
|
2485 |
inferredSynonymsToBeRemoved.add(syn); |
|
2486 |
} |
|
2487 |
} |
|
2422 |
for (TaxonRelationship taxonRelationship: taxonRelListTaxon){ |
|
2423 |
Taxon misappliedName = taxonRelationship.getFromTaxon(); |
|
2424 |
inferredGenus = createInferredGenus(taxon, zooHashMap, taxonName, infraspecificEpithetOfTaxon, genusOfTaxon, taxonNames, zooParentName, misappliedName); |
|
2488 | 2425 |
|
2489 |
// Remove identified Synonyms from inferredSynonyms
|
|
2490 |
for (Synonym synonym : inferredSynonymsToBeRemoved) {
|
|
2491 |
inferredSynonyms.remove(synonym);
|
|
2426 |
inferredSynonyms.add(inferredGenus);
|
|
2427 |
zooHashMap.put(inferredGenus.getName().getUuid(), inferredGenus.getName());
|
|
2428 |
taxonNames.add(inferredGenus.getName().getNameCache());
|
|
2492 | 2429 |
} |
2493 | 2430 |
} |
2494 |
} |
|
2495 |
|
|
2496 |
}else if (type.equals(SynonymType.POTENTIAL_COMBINATION_OF())){ |
|
2497 |
|
|
2498 |
Reference sourceReference = null; // TODO: Determination of sourceReference is redundant |
|
2499 |
//for all synonyms of the parent... |
|
2500 |
for (Synonym synonymRelationOfParent:synonyMsOfParent){ |
|
2501 |
TaxonName synName; |
|
2502 |
HibernateProxyHelper.deproxy(synonymRelationOfParent); |
|
2503 |
|
|
2504 |
synName = synonymRelationOfParent.getName(); |
|
2505 |
|
|
2506 |
// Set the sourceReference |
|
2507 |
sourceReference = synonymRelationOfParent.getSec(); |
|
2508 |
|
|
2509 |
// Determine the idInSource |
|
2510 |
String idInSourceParent = getIdInSource(synonymRelationOfParent); |
|
2511 |
|
|
2512 |
IZoologicalName parentSynZooName = getZoologicalName(synName.getUuid(), zooHashMap); |
|
2513 |
String synParentGenus = parentSynZooName.getGenusOrUninomial(); |
|
2514 |
String synParentInfragenericName = null; |
|
2515 |
String synParentSpecificEpithet = null; |
|
2516 |
|
|
2517 |
if (parentSynZooName.isInfraGeneric()){ |
|
2518 |
synParentInfragenericName = parentSynZooName.getInfraGenericEpithet(); |
|
2519 |
} |
|
2520 |
if (parentSynZooName.isSpecies()){ |
|
2521 |
synParentSpecificEpithet = parentSynZooName.getSpecificEpithet(); |
|
2522 |
} |
|
2523 |
|
|
2524 |
/* if (synGenusName != null && !synonymsGenus.containsKey(synGenusName)){ |
|
2525 |
synonymsGenus.put(synGenusName, idInSource); |
|
2526 |
}*/ |
|
2527 | 2431 |
|
2528 |
//for all synonyms of the taxon |
|
2529 | 2432 |
|
2530 |
for (Synonym synonymRelationOfTaxon:synonymsOfTaxon){ |
|
2531 |
|
|
2532 |
IZoologicalName zooSynName = getZoologicalName(synonymRelationOfTaxon.getName().getUuid(), zooHashMap); |
|
2533 |
potentialCombination = createPotentialCombination(idInSourceParent, parentSynZooName, zooSynName, |
|
2534 |
synParentGenus, |
|
2535 |
synParentInfragenericName, |
|
2536 |
synParentSpecificEpithet, synonymRelationOfTaxon, zooHashMap); |
|
2433 |
if (!taxonNames.isEmpty()){ |
|
2434 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames); |
|
2435 |
IZoologicalName name; |
|
2436 |
if (!synNotInCDM.isEmpty()){ |
|
2437 |
inferredSynonymsToBeRemoved.clear(); |
|
2537 | 2438 |
|
2538 |
taxon.addSynonym(potentialCombination, SynonymType.POTENTIAL_COMBINATION_OF()); |
|
2539 |
inferredSynonyms.add(potentialCombination); |
|
2540 |
zooHashMap.put(potentialCombination.getName().getUuid(), potentialCombination.getName()); |
|
2541 |
taxonNames.add(potentialCombination.getName().getNameCache()); |
|
2439 |
for (Synonym syn :inferredSynonyms){ |
|
2440 |
name = getZoologicalName(syn.getName().getUuid(), zooHashMap); |
|
2441 |
if (!synNotInCDM.contains(name.getNameCache())){ |
|
2442 |
inferredSynonymsToBeRemoved.add(syn); |
|
2443 |
} |
|
2444 |
} |
|
2542 | 2445 |
|
2446 |
// Remove identified Synonyms from inferredSynonyms |
|
2447 |
for (Synonym synonym : inferredSynonymsToBeRemoved) { |
|
2448 |
inferredSynonyms.remove(synonym); |
|
2449 |
} |
|
2450 |
} |
|
2543 | 2451 |
} |
2544 | 2452 |
|
2545 |
} |
|
2546 |
|
|
2547 |
if (doWithMisappliedNames){ |
|
2453 |
}else if (type.equals(SynonymType.POTENTIAL_COMBINATION_OF())){ |
|
2548 | 2454 |
|
2549 |
for (TaxonRelationship parentRelationship: taxonRelListParent){ |
|
2550 |
|
|
2551 |
TaxonName misappliedParentName; |
|
2552 |
|
|
2553 |
Taxon misappliedParent = parentRelationship.getFromTaxon(); |
|
2554 |
misappliedParentName = misappliedParent.getName(); |
|
2455 |
Reference sourceReference = null; // TODO: Determination of sourceReference is redundant |
|
2456 |
//for all synonyms of the parent... |
|
2457 |
for (Synonym synonymRelationOfParent:synonyMsOfParent){ |
|
2458 |
TaxonName synName; |
|
2459 |
HibernateProxyHelper.deproxy(synonymRelationOfParent); |
|
2555 | 2460 |
|
2556 |
HibernateProxyHelper.deproxy(misappliedParent);
|
|
2461 |
synName = synonymRelationOfParent.getName();
|
|
2557 | 2462 |
|
2558 | 2463 |
// Set the sourceReference |
2559 |
sourceReference = misappliedParent.getSec();
|
|
2464 |
sourceReference = synonymRelationOfParent.getSec();
|
|
2560 | 2465 |
|
2561 | 2466 |
// Determine the idInSource |
2562 |
String idInSourceParent = getIdInSource(misappliedParent);
|
|
2467 |
String idInSourceParent = getIdInSource(synonymRelationOfParent);
|
|
2563 | 2468 |
|
2564 |
IZoologicalName parentSynZooName = getZoologicalName(misappliedParentName.getUuid(), zooHashMap);
|
|
2469 |
IZoologicalName parentSynZooName = getZoologicalName(synName.getUuid(), zooHashMap);
|
|
2565 | 2470 |
String synParentGenus = parentSynZooName.getGenusOrUninomial(); |
2566 | 2471 |
String synParentInfragenericName = null; |
2567 | 2472 |
String synParentSpecificEpithet = null; |
... | ... | |
2573 | 2478 |
synParentSpecificEpithet = parentSynZooName.getSpecificEpithet(); |
2574 | 2479 |
} |
2575 | 2480 |
|
2481 |
/* if (synGenusName != null && !synonymsGenus.containsKey(synGenusName)){ |
|
2482 |
synonymsGenus.put(synGenusName, idInSource); |
|
2483 |
}*/ |
|
2576 | 2484 |
|
2577 |
for (TaxonRelationship taxonRelationship: taxonRelListTaxon){ |
|
2578 |
Taxon misappliedName = taxonRelationship.getFromTaxon(); |
|
2579 |
IZoologicalName zooMisappliedName = getZoologicalName(misappliedName.getName().getUuid(), zooHashMap); |
|
2580 |
potentialCombination = createPotentialCombination( |
|
2581 |
idInSourceParent, parentSynZooName, zooMisappliedName, |
|
2485 |
//for all synonyms of the taxon |
|
2486 |
|
|
2487 |
for (Synonym synonymRelationOfTaxon:synonymsOfTaxon){ |
|
2488 |
|
|
2489 |
IZoologicalName zooSynName = getZoologicalName(synonymRelationOfTaxon.getName().getUuid(), zooHashMap); |
|
2490 |
potentialCombination = createPotentialCombination(idInSourceParent, parentSynZooName, zooSynName, |
|
2582 | 2491 |
synParentGenus, |
2583 | 2492 |
synParentInfragenericName, |
2584 |
synParentSpecificEpithet, misappliedName, zooHashMap); |
|
2585 |
|
|
2493 |
synParentSpecificEpithet, synonymRelationOfTaxon, zooHashMap); |
|
2586 | 2494 |
|
2587 | 2495 |
taxon.addSynonym(potentialCombination, SynonymType.POTENTIAL_COMBINATION_OF()); |
2588 | 2496 |
inferredSynonyms.add(potentialCombination); |
... | ... | |
2590 | 2498 |
taxonNames.add(potentialCombination.getName().getNameCache()); |
2591 | 2499 |
} |
2592 | 2500 |
} |
2593 |
} |
|
2594 | 2501 |
|
2595 |
if (!taxonNames.isEmpty()){ |
|
2596 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames); |
|
2597 |
IZoologicalName name; |
|
2598 |
if (!synNotInCDM.isEmpty()){ |
|
2599 |
inferredSynonymsToBeRemoved.clear(); |
|
2600 |
for (Synonym syn :inferredSynonyms){ |
|
2601 |
try{ |
|
2602 |
name = syn.getName(); |
|
2603 |
}catch (ClassCastException e){ |
|
2604 |
name = getZoologicalName(syn.getName().getUuid(), zooHashMap); |
|
2502 |
if (doWithMisappliedNames){ |
|
2503 |
|
|
2504 |
for (TaxonRelationship parentRelationship: taxonRelListParent){ |
|
2505 |
|
|
2506 |
TaxonName misappliedParentName; |
|
2507 |
|
|
2508 |
Taxon misappliedParent = parentRelationship.getFromTaxon(); |
|
2509 |
misappliedParentName = misappliedParent.getName(); |
|
2510 |
|
|
2511 |
HibernateProxyHelper.deproxy(misappliedParent); |
|
2512 |
|
|
2513 |
// Set the sourceReference |
|
2514 |
sourceReference = misappliedParent.getSec(); |
|
2515 |
|
|
2516 |
// Determine the idInSource |
|
2517 |
String idInSourceParent = getIdInSource(misappliedParent); |
|
2518 |
|
|
2519 |
IZoologicalName parentSynZooName = getZoologicalName(misappliedParentName.getUuid(), zooHashMap); |
|
2520 |
String synParentGenus = parentSynZooName.getGenusOrUninomial(); |
|
2521 |
String synParentInfragenericName = null; |
|
2522 |
String synParentSpecificEpithet = null; |
|
2523 |
|
|
2524 |
if (parentSynZooName.isInfraGeneric()){ |
|
2525 |
synParentInfragenericName = parentSynZooName.getInfraGenericEpithet(); |
|
2605 | 2526 |
} |
2606 |
if (!synNotInCDM.contains(name.getNameCache())){ |
|
2607 |
inferredSynonymsToBeRemoved.add(syn); |
|
2527 |
if (parentSynZooName.isSpecies()){ |
|
2528 |
synParentSpecificEpithet = parentSynZooName.getSpecificEpithet(); |
|
2529 |
} |
|
2530 |
|
|
2531 |
for (TaxonRelationship taxonRelationship: taxonRelListTaxon){ |
|
2532 |
Taxon misappliedName = taxonRelationship.getFromTaxon(); |
|
2533 |
IZoologicalName zooMisappliedName = getZoologicalName(misappliedName.getName().getUuid(), zooHashMap); |
|
2534 |
potentialCombination = createPotentialCombination( |
|
2535 |
idInSourceParent, parentSynZooName, zooMisappliedName, |
|
2536 |
synParentGenus, |
|
2537 |
synParentInfragenericName, |
|
2538 |
synParentSpecificEpithet, misappliedName, zooHashMap); |
|
2539 |
|
|
2540 |
taxon.addSynonym(potentialCombination, SynonymType.POTENTIAL_COMBINATION_OF()); |
|
2541 |
inferredSynonyms.add(potentialCombination); |
|
2542 |
zooHashMap.put(potentialCombination.getName().getUuid(), potentialCombination.getName()); |
|
2543 |
taxonNames.add(potentialCombination.getName().getNameCache()); |
|
2544 |
} |
|
2545 |
} |
|
2546 |
} |
|
2547 |
|
|
2548 |
if (!taxonNames.isEmpty()){ |
|
2549 |
List<String> synNotInCDM = dao.taxaByNameNotInDB(taxonNames); |
|
2550 |
IZoologicalName name; |
|
2551 |
if (!synNotInCDM.isEmpty()){ |
|
2552 |
inferredSynonymsToBeRemoved.clear(); |
|
2553 |
for (Synonym syn :inferredSynonyms){ |
|
2554 |
try{ |
|
2555 |
name = syn.getName(); |
|
2556 |
}catch (ClassCastException e){ |
|
2557 |
name = getZoologicalName(syn.getName().getUuid(), zooHashMap); |
|
2558 |
} |
|
2559 |
if (!synNotInCDM.contains(name.getNameCache())){ |
|
2560 |
inferredSynonymsToBeRemoved.add(syn); |
|
2561 |
} |
|
2562 |
} |
|
2563 |
// Remove identified Synonyms from inferredSynonyms |
|
2564 |
for (Synonym synonym : inferredSynonymsToBeRemoved) { |
|
2565 |
inferredSynonyms.remove(synonym); |
|
2608 | 2566 |
} |
2609 |
} |
|
2610 |
// Remove identified Synonyms from inferredSynonyms |
|
2611 |
for (Synonym synonym : inferredSynonymsToBeRemoved) { |
|
2612 |
inferredSynonyms.remove(synonym); |
|
2613 | 2567 |
} |
2614 | 2568 |
} |
2615 |
} |
|
2616 | 2569 |
} |
2617 | 2570 |
}else { |
2618 | 2571 |
logger.info("The synonym type is not defined."); |
... | ... | |
2620 | 2573 |
} |
2621 | 2574 |
} |
2622 | 2575 |
} |
2623 |
|
|
2624 | 2576 |
} |
2625 | 2577 |
|
2626 | 2578 |
return inferredSynonyms; |
... | ... | |
2676 | 2628 |
inferredSynName.setInfraGenericEpithet(synParentInfragenericName); |
2677 | 2629 |
} |
2678 | 2630 |
|
2679 |
|
|
2680 | 2631 |
potentialCombination = Synonym.NewInstance(inferredSynName, null); |
2681 | 2632 |
|
2682 | 2633 |
// Set the sourceReference |
... | ... | |
2719 | 2670 |
synName = syn.getName(); |
2720 | 2671 |
IZoologicalName synZooName = getZoologicalName(synName.getUuid(), zooHashMap); |
2721 | 2672 |
String synSpeciesEpithetName = synZooName.getSpecificEpithet(); |
2722 |
/* if (synonymsEpithet != null && !synonymsEpithet.contains(synSpeciesEpithetName)){
|
|
2673 |
/* if (synonymsEpithet != null && !synonymsEpithet.contains(synSpeciesEpithetName)){ |
|
2723 | 2674 |
synonymsEpithet.add(synSpeciesEpithetName); |
2724 | 2675 |
}*/ |
2725 | 2676 |
|
2726 | 2677 |
inferredSynName = TaxonNameFactory.NewZoologicalInstance(taxon.getName().getRank()); |
2727 | 2678 |
//TODO:differ between parent is genus and taxon is species, parent is subgenus and taxon is species, parent is species and taxon is subspecies and parent is genus and taxon is subgenus... |
2728 | 2679 |
|
2729 |
|
|
2730 | 2680 |
inferredSynName.setGenusOrUninomial(genusOfTaxon); |
2731 | 2681 |
if (zooParentName.isInfraGeneric()){ |
2732 | 2682 |
inferredSynName.setInfraGenericEpithet(zooParentName.getInfraGenericEpithet()); |
... | ... | |
2740 | 2690 |
inferredSynName.setInfraSpecificEpithet(synZooName.getInfraGenericEpithet()); |
2741 | 2691 |
} |
2742 | 2692 |
|
2743 |
|
|
2744 | 2693 |
inferredGenus = Synonym.NewInstance(inferredSynName, null); |
2745 | 2694 |
|
2746 | 2695 |
// Set the sourceReference |
... | ... | |
2810 | 2759 |
synSpecificEpithet = zooSynName.getSpecificEpithet(); |
2811 | 2760 |
} |
2812 | 2761 |
|
2813 |
/* if (synGenusName != null && !synonymsGenus.containsKey(synGenusName)){
|
|
2762 |
/* if (synGenusName != null && !synonymsGenus.containsKey(synGenusName)){ |
|
2814 | 2763 |
synonymsGenus.put(synGenusName, idInSource); |
2815 | 2764 |
}*/ |
2816 | 2765 |
|
... | ... | |
2861 | 2810 |
|
2862 | 2811 |
inferredSynName.addSource(originalSource); |
2863 | 2812 |
|
2864 |
|
|
2865 |
|
|
2866 | 2813 |
taxon.addSynonym(inferredEpithet, SynonymType.INFERRED_EPITHET_OF()); |
2867 | 2814 |
|
2868 | 2815 |
return inferredEpithet; |
... | ... | |
2909 | 2856 |
logger.warn("No idInSource for TaxonBase " + taxonBase.getUuid() + " - " + taxonBase.getTitleCache()); |
2910 | 2857 |
} |
2911 | 2858 |
|
2912 |
|
|
2913 | 2859 |
return idInSource; |
2914 | 2860 |
} |
2915 | 2861 |
|
2916 |
|
|
2917 | 2862 |
/** |
2918 | 2863 |
* Returns the citation for a given Synonym. |
2919 | 2864 |
* @param syn |
... | ... | |
3031 | 2976 |
Set<CdmBase> references = commonService.getReferencingObjectsForDeletion(taxonBase); |
3032 | 2977 |
if (taxonBase instanceof Taxon){ |
3033 | 2978 |
TaxonDeletionConfigurator taxonConfig = (TaxonDeletionConfigurator) config; |
3034 |
List<String> propertyPaths = new ArrayList(); |
|
2979 |
List<String> propertyPaths = new ArrayList<>();
|
|
3035 | 2980 |
propertyPaths.add("taxonNodes"); |
3036 | 2981 |
Taxon taxon = (Taxon)load(taxonBaseUuid, propertyPaths); |
3037 | 2982 |
|
... | ... | |
3058 | 3003 |
return result; |
3059 | 3004 |
} |
3060 | 3005 |
|
3061 |
|
|
3062 |
|
|
3063 | 3006 |
private DeleteResult isDeletableForTaxon(Set<CdmBase> references, TaxonDeletionConfigurator config){ |
3064 | 3007 |
String message = null; |
3065 | 3008 |
DeleteResult result = new DeleteResult(); |
... | ... | |
3097 | 3040 |
message = "Taxon can't be deleted as it is used in an identification key. Remove from identification key prior to deleting this taxon"; |
3098 | 3041 |
} |
3099 | 3042 |
|
3100 |
|
|
3101 | 3043 |
/* //PolytomousKeyNode |
3102 | 3044 |
if (referencingObject.isInstanceOf(PolytomousKeyNode.class)){ |
3103 | 3045 |
String message = "Taxon" + taxon.getTitleCache() + " can't be deleted as it is used in polytomous key node"; |
... | ... | |
3256 | 3198 |
|
3257 | 3199 |
@Override |
3258 | 3200 |
public List<TaxonBase> findTaxaByName(MatchingTaxonConfigurator config){ |
3201 |
@SuppressWarnings("rawtypes") |
|
3259 | 3202 |
List<TaxonBase> taxonList = dao.getTaxaByName(true, config.isIncludeSynonyms(), false, false, false, |
3260 | 3203 |
config.getTaxonNameTitle(), null, null, MatchMode.EXACT, null, config.isIncludeSynonyms(), null, 0, 0, config.getPropertyPath()); |
3261 | 3204 |
return taxonList; |
... | ... | |
3375 | 3318 |
return this.swapSynonymAndAcceptedTaxon(syn, taxon, setNameInSource); |
3376 | 3319 |
} |
3377 | 3320 |
|
3378 |
/** |
|
3379 |
* {@inheritDoc} |
|
3380 |
*/ |
|
3381 | 3321 |
@Override |
3382 | 3322 |
public TaxonRelationshipsDTO listTaxonRelationships(UUID taxonUuid, Set<TaxonRelationshipType> directTypes, |
3383 | 3323 |
Set<TaxonRelationshipType> inversTypes, |
... | ... | |
3430 | 3370 |
return dto; |
3431 | 3371 |
} |
3432 | 3372 |
} |
3433 |
|
|
3434 | 3373 |
} |
Also available in: Unified diff
cleanup