#5225 Replace saveOrUpdate with merge for new entity wizards
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 9 Sep 2015 15:47:02 +0000 (17:47 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 9 Sep 2015 15:47:02 +0000 (17:47 +0200)
15 files changed:
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewAmplificationWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCollectionWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewFieldUnitWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGrantedAuthorityWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewInstitutionWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewNonViralNameWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPersonWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPolytomousKeyWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPrimerWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewReferenceWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewUserWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java

index e9f2eef6a52108b91be1330c83c9d92e2de35e4a..02012cdbb023b2670ad4cc66e5cf982ded21293f 100644 (file)
@@ -38,7 +38,7 @@ public class NewAmplificationWizard  extends AbstractNewEntityWizard<Amplificati
     /** {@inheritDoc} */
     @Override
     protected void saveEntity() {
-        CdmStore.getService(IAmplificationService.class).saveOrUpdate(getEntity());
+        CdmStore.getService(IAmplificationService.class).merge(getEntity());
     }
 
     /** {@inheritDoc} */
index d28f0ec5d6ddf22aebde5d18e77193ed517b6ba5..e81a0e50b70b331b31d21fbadbdb773dfdbce9b4 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -29,14 +29,14 @@ public class NewCollectionWizard extends AbstractNewEntityWizard<Collection> {
        public void addPages() {
                addPage(new CollectionWizardPage(formFactory, getConversationHolder(), getEntity()));
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
         */
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(ICollectionService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(ICollectionService.class).merge(getEntity());
        }
 
        /* (non-Javadoc)
@@ -52,5 +52,5 @@ public class NewCollectionWizard extends AbstractNewEntityWizard<Collection> {
        protected String getEntityName() {
                return "Collection";
        }
-       
+
 }
index 6849014316f3ee9d65d1590c5769ca6c7eacdb61..5e32239b79b6a7bf6208453f1c8af9ea372356e6 100644 (file)
@@ -102,7 +102,7 @@ public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOr
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IOccurrenceService.class).merge(getEntity());
        }
 
        @Override
index a93e8f18541aa099c634f4d0492858ca5375eef6..48bff08362a3577ea85f75b404616fbbb147e29a 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -38,7 +38,7 @@ public class NewFieldUnitWizard extends AbstractNewEntityWizard<FieldUnit> {
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IOccurrenceService.class).merge(getEntity());
        }
 
        @Override
index d14e60819095bb07201120674d8c3be2daae0fe1..4a3fb425ce38408e5695e3b8c0bb06b5a3c4422a 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -20,9 +20,9 @@ import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetail
  * @created Sept 13 2012
  */
 public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
-       
+
        private GrantedAuthorityDetailWizardPage authorityPage;
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.wizard.Wizard#addPages()
         */
@@ -38,7 +38,7 @@ public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAu
         */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IGrantedAuthorityService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity());
        }
 
        /* (non-Javadoc)
index ad6c3ac255de9a5d835726ce5b3b8ef04734a295..54758d1fac71bbe74fc701bb26c699e04d4ce692 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -23,7 +23,7 @@ import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailWizardPage;
 public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
 
        private GroupDetailWizardPage groupPage;
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.wizard.Wizard#addPages()
         */
@@ -32,13 +32,13 @@ public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
                groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
                super.addPage(groupPage);
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
         */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IGroupService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IGroupService.class).merge(getEntity());
        }
 
        /* (non-Javadoc)
index 1eba0be640dbf9de4c056c80c32d23bdedc40e47..c14d13ab09867d7f12096a1af40f2d4ec8b1c804 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -29,13 +29,13 @@ public class NewInstitutionWizard extends AbstractNewEntityWizard<Institution> {
        public void addPages() {
                addPage(new InstitutionWizardPage(formFactory, getConversationHolder(), getEntity()));
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
         */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IAgentService.class).merge(getEntity());
        }
 
        /* (non-Javadoc)
index 6e6ec088643f8ea272f1983d83a6d03f7ecac373..575f6a7ee615cba3e3ef3ccf1719095b48568534 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -33,7 +33,7 @@ public class NewNonViralNameWizard extends AbstractNewEntityWizard<NonViralName>
        public void addPages() {
                addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected NonViralName createNewEntity() {
@@ -49,7 +49,7 @@ public class NewNonViralNameWizard extends AbstractNewEntityWizard<NonViralName>
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(INameService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(INameService.class).merge(getEntity());
        }
 
        @Override
index da18787665f6b06ea4ce61095da79e6055b150b8..abb03bd1cbc80543739685411758b2d742c55344 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -29,7 +29,7 @@ public class NewPersonWizard extends AbstractNewEntityWizard<Person> {
        public void addPages() {
                addPage(new PersonWizardPage(formFactory, getConversationHolder(), getEntity()));
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected Person createNewEntity() {
@@ -39,7 +39,7 @@ public class NewPersonWizard extends AbstractNewEntityWizard<Person> {
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IAgentService.class).merge(getEntity());
        }
 
        @Override
index 8a9d17db502c78cf2855e2d135dcd6602f9abd05..9333780ac38c754dc66e000de69a81ceacd63563 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.newWizard;
 
@@ -14,24 +14,24 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class NewPolytomousKeyWizard extends AbstractNewEntityWizard<PolytomousKey> {
 
     private PolytomousKeyWizardPage polytomousKeyPage;
-    
+
        @Override
        public void addPages() {
                polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
                super.addPage(polytomousKeyPage);
        }
-       
+
        public String getPolytomousKeyName() {
            return polytomousKeyPage.getPolytomousKeyName();
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
         */
        @Override
        protected void saveEntity() {
            if(!polytomousKeyPage.getPolytomousKeyName().equals("")) {
-               CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IPolytomousKeyService.class).merge(getEntity());
            }
        }
 
index dbe73be468f3f4702022d9291b67347bc3286f61..1e31797d6e9ba9905dd5bbf588c17272fdf01928 100644 (file)
@@ -38,7 +38,7 @@ public class NewPrimerWizard  extends AbstractNewEntityWizard<Primer> {
     /** {@inheritDoc} */
     @Override
     protected void saveEntity() {
-        CdmStore.getService(IPrimerService.class).saveOrUpdate(getEntity());
+        CdmStore.getService(IPrimerService.class).merge(getEntity());
     }
 
     /** {@inheritDoc} */
index f1b19c94a5dac2417fac4d26252401f63d027f98..f89d0458e18d054efac1cf7cf3b4a140a5b775ca 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -24,9 +24,9 @@ import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceWizardPage;
  * @version 1.0
  */
 public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
-       
+
        private ReferenceWizardPage referencePage;
-       
+
        /** {@inheritDoc} */
        @Override
        public void addPages() {
@@ -45,7 +45,7 @@ public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IReferenceService.class).saveOrUpdate(getEntity());
+           CdmStore.getService(IReferenceService.class).save(getEntity());
        }
 
        /** {@inheritDoc} */
index 050b5984334b77d838c98d2b54b95715fcd87b6c..faf7cb34069f5be98e870b5f8b565ba0c431af7c 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -29,7 +29,7 @@ public class NewTeamWizard extends AbstractNewEntityWizard<Team> {
        public void addPages() {
                addPage(new TeamWizardPage(formFactory, getConversationHolder(), getEntity()));
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
         */
@@ -42,7 +42,7 @@ public class NewTeamWizard extends AbstractNewEntityWizard<Team> {
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IAgentService.class).merge(getEntity());
        }
 
        @Override
index aa3cd19dd733d2ae274bbc270091134c2b05eb6c..322b798dca2084d9669f4a86177d43e6782deae4 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.newWizard;
 
@@ -15,16 +15,16 @@ import eu.etaxonomy.taxeditor.ui.section.user.UserDetailWizardPage;
 public class NewUserWizard extends AbstractNewEntityWizard<User> {
 
        private UserDetailWizardPage userPage;
-       
+
        @Override
        public void addPages() {
                userPage = new UserDetailWizardPage(formFactory, getConversationHolder(), getEntity());
                addPage(userPage);
        }
-       
+
        @Override
        protected void saveEntity() {
-               CdmStore.getService(IUserService.class).saveOrUpdate(getEntity());
+               CdmStore.getService(IUserService.class).merge(getEntity());
        }
 
        @Override
index 4d91945150187597654e47cfea72dc99a9328180..e48ae2775f883112a5040c1a3c6a1496c08d3355 100644 (file)
@@ -71,6 +71,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
 
        protected T cdmBaseToBeFiltered;
 
+
        /**
         * <p>Constructor for AbstractFilteredCdmResourceSelectionDialog.</p>
         *
@@ -484,6 +485,9 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
                                        if (status == IStatus.OK) {
 
                                                T entity = (T) wizard.getEntity();
+                                               model.add(new UuidAndTitleCache<T>(entity.getUuid(),
+                                                       entity.getId(),
+                                                       getTitle(entity)));
                                                refresh();
                                                setPattern(entity);
                                                getConversationHolder().bind();