ref #10177: add names only once to the list of namesToBeSaved
authorKatja Luther <k.luther@bgbm.org>
Wed, 26 Oct 2022 11:15:48 +0000 (13:15 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 26 Oct 2022 11:15:48 +0000 (13:15 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java

index acfd4651813a6590493da3bdbaab6ffdae58a268..e876f52b4db1c5f470d9f9161846f5de456294a0 100644 (file)
@@ -75,8 +75,8 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput<TaxonNode>
 
     private Map<TaxonBase, TaxonBaseDeletionConfigurator> toDeletes = new HashMap<>();
     private Set<Synonym> toSaveNewSynonyms = new HashSet<>();
-    private List<TaxonBase> toSaveConcepts = new ArrayList<>();
-    private List<TaxonName> toSaveNewNames = new ArrayList<>();
+    private Set<TaxonBase> toSaveConcepts = new HashSet<>();
+    private Set<TaxonName> toSaveNewNames = new HashSet<>();
 
     private Set<AbstractPostOperation> operations = new HashSet<>();
 
@@ -396,10 +396,12 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput<TaxonNode>
 //        }
 
         if (!toSaveNewNames.isEmpty()){
-            CdmStore.getService(INameService.class).merge(toSaveNewNames, true);
+               List<TaxonName> listNames = new ArrayList(toSaveNewNames);
+            CdmStore.getService(INameService.class).merge(listNames, true);
         }
         if (!toSaveConcepts.isEmpty()){
-            CdmStore.getService(ITaxonService.class).merge(toSaveConcepts, true);
+               List<TaxonBase> listTaxa = new ArrayList(toSaveConcepts);
+            CdmStore.getService(ITaxonService.class).merge(listTaxa, true);
         }
 
         toSaveNewNames.clear();