fix #5692: adapt delete algorithm to annotatedLineEditor mechanisms
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / UserEditorInput.java
index c80733b1e807b558638e0ae860322e959e22f87b..06bd812f7e98ac99755ca05adfac25cf3bcbb233 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.
 */
@@ -15,6 +15,7 @@ import java.util.List;
 import java.util.UUID;
 
 import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
 import eu.etaxonomy.cdm.model.common.User;
@@ -30,9 +31,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class UserEditorInput extends AbstractBulkEditorInput<User> {
 
        public static final String ID = "bulkeditor.input.user";
-       
+
        private static UserEditorInput instance;
-       
+
        /**
         * @return the instance
         */
@@ -42,7 +43,7 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
                }
                return instance;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.IEditorInput#getName()
         */
@@ -63,15 +64,15 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
         */
        @Override
-       public boolean save(User entity) {
-               return CdmStore.getService(IUserService.class).saveOrUpdate(entity) != null;
+       public User save(User entity) {
+           return CdmStore.getService(IUserService.class).merge(entity, true).getMergedEntity();
        }
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
         */
        @Override
-       public boolean delete(User entity) throws ReferencedObjectUndeletableException {
+       public boolean delete(User entity, DeleteConfiguratorBase config) throws ReferencedObjectUndeletableException {
                return CdmStore.getService(IUserService.class).delete(entity) != null;
        }
 
@@ -84,13 +85,13 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
                return CdmStore.getSearchManager().findUsers(configurator);
        }
 
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
-       
+
        @Override
        protected User loadEntity(UUID entityUuid) {
-               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               List<String> propertyPaths = Arrays.asList(new String[]{});
                return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
        }
  */
@@ -101,7 +102,7 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
        protected IEntityCreator<User> createEntityCreator() {
                return new UserCreator();
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
         */
@@ -110,5 +111,21 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
                return String.format("%s, %s", entity.getUsername(), entity.getPerson());
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+     */
+    @Override
+    public void merge() {
+
+    }
+    
+
+       @Override
+       protected User loadEntity(UUID entityUuid) {
+               List<String> propertyPaths = Arrays.asList(new String[]{});
+               return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
+       }
+
+
 
 }