handle missing parent for polytomous key generation
authorKatja Luther <k.luther@bgbm.org>
Tue, 25 Jan 2022 09:48:33 +0000 (10:48 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 25 Jan 2022 09:48:33 +0000 (10:48 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/handler/GeneratePolytomousKeyHandler.java

index 0b10ea3da30fba3def481a6c982b8a7c4e8fd525..08ceefa17fc0ecf7e3a1451ee3c54b19dd958302 100755 (executable)
@@ -57,11 +57,21 @@ public class GeneratePolytomousKeyHandler {
         
         TaxonNodeDto parentDto = CdmStore.getService(ITaxonNodeService.class).findCommonParentDto(nodeDtos);
         UUID taxonUuid = parentDto.getTaxonUuid();
-        int response = MessagingUtils.confirmDialog(
+        int response = 0;
+        if (parentDto == null){
+               response = MessagingUtils.confirmDialog(
+                    "Choose taxonomic scope",
+                    "There is no common parent taxon for this dataset is:\n\n"
+                            + "Do you want to choose the taxonomic scope for the polytomous key?"
+                            , "Choose taxon", "Cancel");
+               response++;
+        }else{
+               response = MessagingUtils.confirmDialog(
                 "Choose taxonomic scope",
                 String.format("The common parent taxon of this dataset is :\n%s\n\n"
                         + "Do you want to use this as the taxonomic scope for the polytomous key?"
                         , parentDto.getTaxonTitleCache()), "Yes", "Choose different taxon", "Cancel");
+        }
         if(response==2){
             return;
         }