Revision 7d1f2d23
Added by Katja Luther over 8 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java | ||
---|---|---|
995 | 995 |
} |
996 | 996 |
// relationship will be deleted by hibernate automatically, |
997 | 997 |
// see comment above and http://dev.e-taxonomy.eu/trac/ticket/3797 |
998 |
// else{ |
|
999 |
// deleteSynonymRelationships(synonym, taxon); |
|
1000 |
// } |
|
998 |
|
|
1001 | 999 |
} |
1002 | 1000 |
} |
1003 | 1001 |
|
... | ... | |
1006 | 1004 |
if (taxon.getTaxonRelations().size() > 0){ |
1007 | 1005 |
String message = "Taxon can't be deleted as it is related to another taxon. " + |
1008 | 1006 |
"Remove taxon from all relations to other taxa prior to deletion."; |
1009 |
// throw new ReferencedObjectUndeletableException(message); |
|
1007 |
|
|
1010 | 1008 |
} |
1011 | 1009 |
} else{ |
1012 | 1010 |
for (TaxonRelationship taxRel: taxon.getTaxonRelations()){ |
... | ... | |
1019 | 1017 |
} |
1020 | 1018 |
} |
1021 | 1019 |
taxon.removeTaxonRelation(taxRel); |
1022 |
/*if (taxFrom.equals(taxon)){ |
|
1023 |
try{ |
|
1024 |
this.deleteTaxon(taxTo, taxConf, classification); |
|
1025 |
} catch(DataChangeNoRollbackException e){ |
|
1026 |
logger.debug("A related taxon will not be deleted." + e.getMessage()); |
|
1027 |
} |
|
1028 |
} else { |
|
1029 |
try{ |
|
1030 |
this.deleteTaxon(taxFrom, taxConf, classification); |
|
1031 |
} catch(DataChangeNoRollbackException e){ |
|
1032 |
logger.debug("A related taxon will not be deleted." + e.getMessage()); |
|
1033 |
} |
|
1034 | 1020 |
|
1035 |
}*/ |
|
1036 | 1021 |
} |
1037 | 1022 |
} |
1038 | 1023 |
|
... | ... | |
1046 | 1031 |
if (desc.getDescribedSpecimenOrObservation() != null){ |
1047 | 1032 |
String message = "Taxon can't be deleted as it is used in a TaxonDescription" + |
1048 | 1033 |
" which also describes specimens or abservations"; |
1049 |
//throw new ReferencedObjectUndeletableException(message); |
|
1050 | 1034 |
} |
1051 | 1035 |
removeDescriptions.add(desc); |
1052 | 1036 |
|
... | ... | |
1059 | 1043 |
} |
1060 | 1044 |
|
1061 | 1045 |
|
1062 |
/* //check references with only reverse mapping |
|
1063 |
String message = checkForReferences(taxon); |
|
1064 |
if (message != null){ |
|
1065 |
//throw new ReferencedObjectUndeletableException(message.toString()); |
|
1066 |
}*/ |
|
1067 |
|
|
1068 | 1046 |
if (! config.isDeleteTaxonNodes() || (!config.isDeleteInAllClassifications() && classification == null )){ |
1069 | 1047 |
//if (taxon.getTaxonNodes().size() > 0){ |
1070 | 1048 |
// message = "Taxon can't be deleted as it is used in a classification node. Remove taxon from all classifications prior to deletion or define a classification where it should be deleted or adapt the taxon deletion configurator."; |
... | ... | |
1091 | 1069 |
node = null; |
1092 | 1070 |
} |
1093 | 1071 |
if (node != null){ |
1072 |
HibernateProxyHelper.deproxy(node, TaxonNode.class); |
|
1094 | 1073 |
success =taxon.removeTaxonNode(node, deleteChildren); |
1095 | 1074 |
nodeService.delete(node); |
1096 | 1075 |
} else { |
Also available in: Unified diff
minor