commit 90f49fe41d5816b7fce308a5200a950550758e1e
Author: Katja Luther <k.luther@bgbm.org>
Date:   Thu Sep 20 12:25:59 2018 +0200

    fix #3276: avoid exception when moving unpersisted facts

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java
index 75616255c..8cfc1edb3 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java
@@ -87,33 +87,45 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
         Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
         if(e4WrappedPart instanceof TaxonNameEditorE4){
             editor = (TaxonNameEditorE4) e4WrappedPart;
-
-
-
         }
         Taxon actualTaxon= null;
 
         List<DescriptionElementBase> elements = new ArrayList<DescriptionElementBase>();
-
+        DescriptionBase description = null;
         for (Iterator iter = viewselection.iterator(); iter.hasNext();) {
             Object object = iter.next();
             if (object instanceof DescriptionElementBase) {
                 UUID uuid = ((DescriptionElementBase) object).getUuid();
+                description = ((DescriptionElementBase) object).getInDescription();
+                DescriptionElementBase element ;
+                if (((DescriptionElementBase) object).getId() > 0){
+                    element = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null);
+                }else{
+                    element = ((DescriptionElementBase) object);
+                }
 
-                elements.add(CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null));
+                elements.add(element);
             } else if (object instanceof FeatureNodeContainer) {
                 for (DescriptionElementBase de : ((FeatureNodeContainer) object).getDescriptionElements()) {
-                    elements.add(
-                            CdmStore.getService(IDescriptionService.class).loadDescriptionElement(de.getUuid(), null));
+                    DescriptionElementBase element ;
+                    if (de.getId() > 0){
+                        element = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(de.getUuid(), null);
+                    }else{
+                        element = (de);
+                    }
+                    description = de.getInDescription();
+                    elements.add(element);
                 }
             }
         }
 
-        if(elements.size() == 0){
+        if(elements.size() == 0 ){
             return;
         }
 
-        DescriptionBase description = elements.get(0).getInDescription();
+        if (elements.get(0) != null){
+            description = elements.get(0).getInDescription();
+        }
         Set<UUID> excludeTaxa = new HashSet<>();
         if (description!=null && description.isInstanceOf(TaxonDescription.class)){
             TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(description, TaxonDescription.class);
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java
index 5da3c1819..805b9afd8 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java
@@ -16,8 +16,6 @@ import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.model.common.Annotation;
@@ -89,13 +87,6 @@ public class MoveDescriptionToOtherTaxonOperation extends
 		Annotation annotation = Annotation.NewInstance(moveMessage, Language.getDefaultLanguage());
 		annotation.setAnnotationType(AnnotationType.TECHNICAL());
 		description.addAnnotation(annotation);
-		newAcceptedTaxonNode.getTaxon().addDescription(description);
-		if (CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController) {
-            CdmStore.getService(IDescriptionService.class).merge(description, true);
-        } else {
-            CdmStore.getService(IDescriptionService.class).saveOrUpdate(description);
-        }
-
 		CdmStore.getService(IDescriptionService.class).moveTaxonDescription(description.getUuid(), newAcceptedTaxonNode.getTaxon().getUuid());
 		monitor.worked(40);
 
