#5160 Use new merge method with ids as arguments attic/branches/taxeditor/develop/25350
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 25 Aug 2015 11:09:07 +0000 (13:09 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 25 Aug 2015 11:28:18 +0000 (13:28 +0200)
Conflicts:
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java

index 82cd233..8cf5d33 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.ui.IPersistableElement;
 
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.MarkerType;
@@ -231,7 +232,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
     public boolean merge(T entity, T mergeTarget) {
                if (entity instanceof IMergable) {
                        try {
-                               CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity);
+                               CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), (Class<? extends CdmBase>)entity.getClass());
                        } catch (MergeException e) {
                                MessagingUtils.errorDialog("Bulk Editor Merge Error",
                                                this,
index bae1473..36a7cc9 100644 (file)
@@ -82,9 +82,14 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
     public boolean merge(TeamOrPersonBase entity, TeamOrPersonBase mergeTarget) {
                if (entity instanceof IMergable) {
                        try {
-                               IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
-                               strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
-                               CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, strategy);
+                               if(entity instanceof Person) {
+                                   IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
+                                   strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
+                                   CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), Person.class);
+                               } else {
+                                   IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(TeamOrPersonBase.class);
+                                   CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), TeamOrPersonBase.class);
+                               }
                        } catch (MergeException e) {
                                MessagingUtils.errorDialog("Bulk Editor Merge Error",
                                                this,