Save edited character in FeatureTreeEditor
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 15 Apr 2019 12:27:37 +0000 (14:27 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 29 Apr 2019 08:11:59 +0000 (10:11 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java

index fef243c..26969d8 100644 (file)
@@ -47,8 +47,11 @@ import org.eclipse.ui.IMemento;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.term.FeatureNode;
 import eu.etaxonomy.cdm.model.term.FeatureTree;
+import eu.etaxonomy.cdm.model.term.TermType;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
 import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
@@ -247,6 +250,15 @@ public class FeatureTreeEditor implements IFeatureTreeEditor, ISelectionChangedL
 
         CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(getRootEntities());
 
+        List<FeatureTree> rootEntities = getRootEntities();
+        for (FeatureTree featureTree : rootEntities) {
+            if(featureTree.getTermType().equals(TermType.Character)){
+                FeatureTree<Character> characterTree = featureTree;
+                //save characters because they can be modified in this editor
+                characterTree.getDistinctFeatures().forEach(character->CdmStore.getService(ITermService.class).merge(character,true));
+            }
+        }
+
         initializeTrees();
 
         this.setDirty(false);