Merge branch 'release/4.4.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / GroupEditorInput.java
index eb5fb3695de01942d23500117fbb0bbdb4e08f1c..9b46b570defdc3a8d81578a44c472bcf73470936 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.
 */
@@ -14,9 +14,12 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
+import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
+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.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
@@ -30,9 +33,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
 
        public static final String ID = "bulkeditor.input.group";
-       
+
        private static GroupEditorInput instance;
-       
+
        /**
         * @return the instance
         */
@@ -42,7 +45,7 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
                }
                return instance;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.IEditorInput#getName()
         */
@@ -63,16 +66,17 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
         */
        @Override
-       public boolean save(Group entity) {
-               return CdmStore.getService(IGroupService.class).saveOrUpdate(entity) != null;
+       public Group save(Group entity) {
+           return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
+           
        }
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
         */
        @Override
-       public boolean delete(Group entity) throws ReferencedObjectUndeletableException {
-               return CdmStore.getService(IGroupService.class).delete(entity) != null;
+       public boolean delete(Group entity, DeleteConfiguratorBase config) throws ReferencedObjectUndeletableException {
+               return CdmStore.getService(IGroupService.class).delete(entity.getUuid()) != null;
        }
 
        /* (non-Javadoc)
@@ -86,13 +90,13 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
-        */
+
        @Override
        protected Group loadEntity(UUID entityUuid) {
-               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               List<String> propertyPaths = Arrays.asList(new String[]{});
                return CdmStore.getService(IGroupService.class).load(entityUuid, propertyPaths);
        }
-
+*/
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
         */
@@ -100,7 +104,7 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
        protected IEntityCreator<Group> createEntityCreator() {
                return new GroupCreator();
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
         */
@@ -109,6 +113,20 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
                return entity.getName();
        }
 
-       
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+     */
+    @Override
+    public void merge() {
+
+    }
+
+       @Override
+       protected Group loadEntity(UUID entityUuid) {
+               List<String> propertyPaths = Arrays.asList(new String[]{});
+               return HibernateProxyHelper.deproxy(CdmStore.getService(IAgentService.class).load(entityUuid, propertyPaths), Group.class);
+       }
+
+
 
 }