fix #7472: always merge taxon relations in name editor before merging
authorKatja Luther <k.luther@bgbm.org>
Tue, 19 Jun 2018 14:16:58 +0000 (16:16 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 19 Jun 2018 14:18:26 +0000 (16:18 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java

index 182c1b52d6ab37ded46aa91d90747415958b56e3..336dfd2b434a5d74cbec47a30ac8cddebd78440b 100644 (file)
@@ -69,8 +69,8 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
 
     private Map<TaxonBase, TaxonBaseDeletionConfigurator> toDeletes = new HashMap<>();
     private Set<Synonym> toSaveNewSynonyms = new HashSet<>();
-    private Set<TaxonBase> toSaveNewConcepts = new HashSet<>();
-    private Set<TaxonName> toSaveNewNames = new HashSet<>();
+    private List<TaxonBase> toSaveNewConcepts = new ArrayList<>();
+    private List<TaxonName> toSaveNewNames = new ArrayList<>();
 
 
     private Set<AbstractPostTaxonOperation> operations = new HashSet<>();
@@ -312,9 +312,8 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
         this.toSaveNewSynonyms.add(toSaveNew);
     }
     public void addToSaveNewConcept(Taxon toSaveNew) {
-        if (!toSaveNew.isPersited()){
-            this.toSaveNewConcepts.add(toSaveNew);
-        }
+       this.toSaveNewConcepts.add(toSaveNew);
+
     }
 
     @Override
@@ -338,29 +337,29 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
 
         for (Synonym syn: toSaveNewSynonyms){
             for (HybridRelationship rel : syn.getName().getHybridChildRelations()){
-                if (!rel.getParentName().isPersited()) {
+//                if (!rel.getParentName().isPersited()) {
                     toSaveNewNames.add(rel.getParentName());
-                }
-                    if (!rel.getHybridName().isPersited()) {
+//                }
+//                    if (!rel.getHybridName().isPersited()) {
                    toSaveNewNames.add(rel.getHybridName());
-                }
+//                }
 
             }
         }
 
         for (TaxonBase concept: toSaveNewConcepts){
             for (HybridRelationship rel : concept.getName().getHybridChildRelations()){
-                if (!rel.getParentName().isPersited()) {
+//                if (!rel.getParentName().isPersited()) {
                     toSaveNewNames.add(rel.getParentName());
-                }
-                if (!rel.getHybridName().isPersited()) {
+//                }
+//                if (!rel.getHybridName().isPersited()) {
                     toSaveNewNames.add(rel.getHybridName());
-                }
+//                }
 
             }
         }
-        CdmStore.getService(INameService.class).save(toSaveNewNames);
-        CdmStore.getService(ITaxonService.class).save(toSaveNewConcepts);
+        CdmStore.getService(INameService.class).merge(toSaveNewNames, true);
+        CdmStore.getService(ITaxonService.class).merge(toSaveNewConcepts, true);
 
         toSaveNewNames.clear();
         toSaveNewConcepts.clear();