Update root entity merge calls to use new merge method.
authorCherian Mathew <c.mathew@bgbm.org>
Thu, 8 Oct 2015 09:12:39 +0000 (11:12 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Thu, 8 Oct 2015 10:48:10 +0000 (12:48 +0200)
24 files changed:
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/GroupEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/NullSession.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientAgentService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientCollectionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientDescriptionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientNameService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientReferenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTermService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionAwareTest.java

index cff075c..6423cec 100644 (file)
@@ -148,7 +148,7 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
        @Override
        public TeamOrPersonBase save(TeamOrPersonBase entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true);
+               return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(IAgentService.class).saveOrUpdate(entity) ;
                return entity;
index 6e44e52..0082939 100644 (file)
@@ -63,7 +63,7 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
        @Override
        public Group save(Group entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return CdmStore.getService(IGroupService.class).merge(entity, true) ;
+               return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(IGroupService.class).saveOrUpdate(entity);
                return entity;
index 8b56ea1..6116162 100644 (file)
@@ -119,7 +119,7 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonNameBase> {
        @Override
     public TaxonNameBase save(TaxonNameBase entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return CdmStore.getService(INameService.class).merge(entity, true) ;
+               return CdmStore.getService(INameService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(INameService.class).saveOrUpdate(entity);
                return entity;
index e219a50..929379d 100644 (file)
@@ -138,7 +138,7 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
        @Override
     public SpecimenOrObservationBase<IIdentifiableEntityCacheStrategy> save(SpecimenOrObservationBase entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return CdmStore.getService(IOccurrenceService.class).merge(entity, true) ;
+               return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(IOccurrenceService.class).save(entity);
                return entity;
index 32df06a..8b8c113 100644 (file)
@@ -140,7 +140,7 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
        @Override
     public Reference save(Reference entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return CdmStore.getService(IReferenceService.class).merge(entity, true);
+               return CdmStore.getService(IReferenceService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(IReferenceService.class).saveOrUpdate(entity);
                return entity;
index 4f84735..aa6dd15 100644 (file)
@@ -72,7 +72,7 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
        @Override\r
        public TaxonBase save(TaxonBase entity) {\r
            if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
-               return CdmStore.getService(ITaxonService.class).merge(entity, true);\r
+               return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();\r
            } else {\r
                CdmStore.getService(ITaxonService.class).saveOrUpdate(entity);\r
                return entity;\r
index bcbff53..72dd138 100644 (file)
@@ -63,7 +63,7 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
        @Override
        public User save(User entity) {
            if(CdmStore.getCurrentSessionManager().isRemoting()) {
-               return CdmStore.getService(IUserService.class).merge(entity, true);
+               return CdmStore.getService(IUserService.class).merge(entity, true).getMergedEntity();
            } else {
                CdmStore.getService(IUserService.class).saveOrUpdate(entity);
                return entity;
index 8084eac..fa0a4f1 100644 (file)
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
 
 @Component
@@ -53,7 +54,13 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques
                 if("merge".equals(currentRemoteInvocation.getMethodName()) ||
                         "save".equals(currentRemoteInvocation.getMethodName()) ||
                         "findWithUpdate".equals(currentRemoteInvocation.getMethodName())) {
-                    rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
+                    if(rir.getValue() instanceof MergeResult) {
+                        MergeResult result = (MergeResult) rir.getValue();
+                        cdmEntitySessionManager.load(result.getMergedEntity(), true);
+                        cdmEntitySessionManager.load(result.getNewEntities(), true);
+                    } else {
+                        rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
+                    }
                 } else if(rir.getValue() instanceof UpdateResult){
                     UpdateResult result = (UpdateResult)rir.getValue();
                     if(result.isOk()){
index 85c7d33..5fdfafa 100644 (file)
@@ -247,7 +247,7 @@ public class CdmEntitySession implements ICdmEntitySession  {
      */
     @Override
     public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
-        T mergedCdmBase = service.merge(cdmBase, true);
+        T mergedCdmBase = service.merge(cdmBase, true).getMergedEntity();
         return mergedCdmBase;
     }
 
index 65b8e7c..615f32a 100644 (file)
@@ -177,7 +177,7 @@ public class NullSession implements ICdmEntitySession {
      */
     @Override
     public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
-        T mergedCdmBase = service.merge(cdmBase, true);
+        T mergedCdmBase = service.merge(cdmBase, true).getMergedEntity();
         return mergedCdmBase;
     }
 
index 59fa373..fa78b41 100644 (file)
@@ -158,7 +158,7 @@ public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IE
     @Override
     public void merge() {
         if(CdmStore.getCurrentSessionManager().isRemoting()) {
-            group = CdmStore.getService(IGroupService.class).merge(group, true);
+            group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
         }
     }
 }
index e76738f..7a190f4 100644 (file)
@@ -92,7 +92,7 @@ public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<
     @Override
     public void merge() {
         if(CdmStore.getCurrentSessionManager().isRemoting()) {
-            key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true);
+            key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
         }
     }
 
index c128ec4..e7b41f2 100644 (file)
@@ -44,6 +44,7 @@ import eu.etaxonomy.cdm.model.media.Rights;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -793,19 +794,21 @@ public class TransientAgentService implements IAgentService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public AgentBase merge(AgentBase arg0, boolean arg1) {
+    public List<MergeResult<AgentBase>> merge(List<AgentBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<AgentBase> merge(List<AgentBase> arg0, boolean arg1) {
-        return defaultService.merge(arg0, arg1);
+    public MergeResult<AgentBase> merge(AgentBase arg0, boolean arg1) {
+       return defaultService.merge(arg0, arg1);
     }
 
+
+
 }
index 426d05d..2a2f6f7 100644 (file)
@@ -46,6 +46,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -951,21 +952,20 @@ public class TransientClassificationService implements IClassificationService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public Classification merge(Classification arg0, boolean arg1) {
+    public List<MergeResult<Classification>> merge(List<Classification> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<Classification> merge(List<Classification> arg0, boolean arg1) {
+    public MergeResult<Classification> merge(Classification arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
 
-
 }
index 6ff6567..b1154d5 100644 (file)
@@ -38,6 +38,7 @@ import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -727,19 +728,20 @@ public class TransientCollectionService implements ICollectionService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public Collection merge(Collection arg0, boolean arg1) {
+    public List<MergeResult<Collection>> merge(List<Collection> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<Collection> merge(List<Collection> arg0, boolean arg1) {
+    public MergeResult<Collection> merge(Collection arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
+
 }
index 62291f3..3a7df7f 100644 (file)
@@ -54,6 +54,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.TermDto;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
@@ -1197,25 +1198,21 @@ public class TransientDescriptionService implements IDescriptionService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public DescriptionBase merge(DescriptionBase arg0, boolean arg1) {
+    public List<MergeResult<DescriptionBase>> merge(List<DescriptionBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
 
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<DescriptionBase> merge(List<DescriptionBase> arg0, boolean arg1) {
-
+    public MergeResult<DescriptionBase> merge(DescriptionBase arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
-
-
-
 }
index 6e112f5..731c43f 100644 (file)
@@ -63,6 +63,7 @@ import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -1199,18 +1200,19 @@ public class TransientNameService implements INameService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public TaxonNameBase merge(TaxonNameBase arg0, boolean arg1) {
+    public List<MergeResult<TaxonNameBase>> merge(List<TaxonNameBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<TaxonNameBase> merge(List<TaxonNameBase> arg0, boolean arg1) {
+    public MergeResult<TaxonNameBase> merge(TaxonNameBase arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
+
 }
index 6d2bdc0..64dded3 100644 (file)
@@ -70,6 +70,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -1053,27 +1054,26 @@ public class TransientOccurenceService implements IOccurrenceService {
         return defaultService.moveSequence(arg0, arg1, arg2);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
-     */
     @Override
-    public SpecimenOrObservationBase merge(SpecimenOrObservationBase arg0, boolean arg1) {
-        return defaultService.merge(arg0, arg1);
+    public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase arg0, Integer arg1, Integer arg2,
+            List<String> arg3) {
+        return defaultService.getMediainHierarchy(arg0, arg1, arg2, arg3);
     }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public List<SpecimenOrObservationBase> merge(List<SpecimenOrObservationBase> arg0, boolean arg1) {
+    public List<MergeResult<SpecimenOrObservationBase>> merge(List<SpecimenOrObservationBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     */
     @Override
-    public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase arg0, Integer arg1, Integer arg2,
-            List<String> arg3) {
-        // TODO Auto-generated method stub
-        return null;
+    public MergeResult<SpecimenOrObservationBase> merge(SpecimenOrObservationBase arg0, boolean arg1) {
+        return defaultService.merge(arg0, arg1);
     }
 
     /**
index 48192e4..cb5c3b8 100644 (file)
@@ -40,6 +40,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -735,18 +736,20 @@ public class TransientReferenceService implements IReferenceService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public Reference merge(Reference arg0, boolean arg1) {
+    public List<MergeResult<Reference>> merge(List<Reference> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<Reference> merge(List<Reference> arg0, boolean arg1) {
+    public MergeResult<Reference> merge(Reference arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
+
+
 }
index b79f17f..0ae7529 100644 (file)
@@ -79,6 +79,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
@@ -1526,19 +1527,20 @@ public class TransientTaxonService implements ITaxonService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public TaxonBase merge(TaxonBase arg0, boolean arg1) {
+    public List<MergeResult<TaxonBase>> merge(List<TaxonBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<TaxonBase> merge(List<TaxonBase> arg0, boolean arg1) {
+    public MergeResult<TaxonBase> merge(TaxonBase arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
+
 }
index 3df4f25..8e00b01 100644 (file)
@@ -52,6 +52,7 @@ import eu.etaxonomy.cdm.model.media.Rights;
 import eu.etaxonomy.cdm.model.view.AuditEvent;
 import eu.etaxonomy.cdm.model.view.AuditEventRecord;
 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
@@ -905,18 +906,19 @@ public class TransientTermService implements ITermService {
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
      */
     @Override
-    public DefinedTermBase merge(DefinedTermBase arg0, boolean arg1) {
+    public List<MergeResult<DefinedTermBase>> merge(List<DefinedTermBase> arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
 
     /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
      */
     @Override
-    public List<DefinedTermBase> merge(List<DefinedTermBase> arg0, boolean arg1) {
+    public MergeResult<DefinedTermBase> merge(DefinedTermBase arg0, boolean arg1) {
         return defaultService.merge(arg0, arg1);
     }
+
 }
index f0d3afe..198b15a 100644 (file)
@@ -238,7 +238,7 @@ public class DerivateViewEditorInput extends CdmEntitySessionInput implements IE
     @Override
     public void merge() {
         if(CdmStore.getCurrentSessionManager().isRemoting()) {
-            List<SpecimenOrObservationBase> mergedEntities = CdmApplicationState.getCurrentAppConfig().getOccurrenceService().merge(new ArrayList(getRootEntities()), true);
+            CdmApplicationState.getCurrentAppConfig().getOccurrenceService().merge(new ArrayList(getRootEntities()), true);
         }
 
     }
index 57aa4c4..baafa07 100644 (file)
@@ -193,11 +193,19 @@ public class TaxonNameEditorTest extends BaseOperationTest {
         Taxon grandChildTaxon = Taxon.NewInstance(null, null);
         TaxonNode grandChildTaxonNode = childTaxonNode.addChildTaxon(grandChildTaxon, null, null);
 
-        CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+
+        CdmStore.getService(ITaxonNodeService.class).merge(taxonNode,true);
 
         Assert.assertEquals(taxonNode.getChildNodes().get(0).getId(), childTaxonNode.getId());
+
+        Assert.assertTrue(childTaxonNode.treeIndex() != null);
+        Assert.assertEquals(taxonNode.getChildNodes().get(0).treeIndex(), childTaxonNode.treeIndex());
+        Assert.assertFalse(childTaxon.getId() == 0);
         Assert.assertEquals(taxonNode.getChildNodes().get(0).getTaxon().getId(), childTaxon.getId());
+
+        Assert.assertTrue(grandChildTaxonNode.treeIndex() != null);
         Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getId(), grandChildTaxonNode.getId());
+        Assert.assertFalse(grandChildTaxon.getId() == 0);
         Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getTaxon().getId(), grandChildTaxon.getId());
     }
 
index 82b9e94..842db31 100644 (file)
@@ -175,12 +175,12 @@ public class CdmEntitySessionAwareTest extends RemotingSessionAwareTest {
         PolytomousKeyNode grandChildNode = PolytomousKeyNode.NewInstance();
         rootChildNode.addChild(grandChildNode);
 
-        pKey = polytomousKeyService.merge(pKey, true);
+        polytomousKeyService.merge(pKey, true);
         grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
         Assert.assertTrue(0 != grandChildNode.getId());
         KeyStatement ks = KeyStatement.NewInstance("test");
         grandChildNode.setStatement(ks);
-        pKey = polytomousKeyService.merge(pKey, true);
+        polytomousKeyService.merge(pKey, true);
 
         //grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
         //KeyStatement ks = grandChildNode.getStatement();