Add check for remoting to decide whether to merge or save
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 30 Sep 2015 16:56:34 +0000 (18:56 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 30 Sep 2015 16:57:26 +0000 (18:57 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java

index 4a300dc7afc066d296d488e2980b541eb75b3131..a792ed4d3c5da5a9b02325a61fc53c8ef6079145 100644 (file)
@@ -53,7 +53,11 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<ITaxonTreeNode>{
             Taxon taxon = taxonNodePage.getTaxon();
             try{
                 TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
-                taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
+                if(CdmStore.getCurrentSessionManager().isRemoting()) {
+                    taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
+                } else {
+                    taxonNode = CdmStore.getService(ITaxonNodeService.class).save(taxonNode);
+                }
                 generatedTaxonNodeUuid = taxonNode.getUuid();
                 Set<CdmBase> affectedObjects = new HashSet<CdmBase>();
                 //FIXME:Remoting Hack for now - need to generalise this