adaptions for polytomous key editing to avoid null values in children list
authorKatja Luther <k.luther@bgbm.org>
Mon, 19 Dec 2016 15:14:51 +0000 (16:14 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 19 Dec 2016 15:14:51 +0000 (16:14 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java

index 1c04482378fcbb933e95e7c9781aad81dfdbd58c..2ff2fe1dafb8d65f2b28af29cd4f1854fed36d6c 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.
  */
@@ -21,7 +21,7 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
 
 /**
- * 
+ *
  * @author n.hoffmann
  * @created Mar 30, 2011
  * @version 1.0
@@ -55,6 +55,7 @@ class PolytomousKeyGraphContentProvider implements IGraphContentProvider {
                List<PolytomousKeyNode> children;
 
                if (parent instanceof PolytomousKeyNode) {
+                       ((PolytomousKeyNode) parent).removeNullValueFromChildren();
                        children = ((PolytomousKeyNode) parent).getChildren();
                } else if (parent instanceof PolytomousKey) {
                        children = new ArrayList<PolytomousKeyNode>();
index e4a406696629e64b63e13891af174446c06b3478..92803c8d4e533d83eb3857c14d5f6b8746fd6f86 100644 (file)
@@ -13,6 +13,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
@@ -33,6 +34,7 @@ public class DeleteNodeOperation extends AbstractPostOperation<PolytomousKeyNode
        public DeleteNodeOperation(String label, IUndoContext undoContext,
                        PolytomousKeyNode node, IPostOperationEnabled postOperationEnabled) {
            super(label, undoContext, node, postOperationEnabled);
+           HibernateProxyHelper.deproxy(node, PolytomousKeyNode.class);
                this.node = node;
                this.parent = node.getParent();
        }
@@ -55,6 +57,7 @@ public class DeleteNodeOperation extends AbstractPostOperation<PolytomousKeyNode
 
                IPolytomousKeyNodeService service = controller.getPolytomousKeyNodeService();
                DeleteResult result;
+
                if (node.getChildren().size()>0){
                        if(! MessageDialog.openQuestion(null, "Confirm deletion of children", "The selected node has children, do you want to delete them, too?")) {
                                result = service.delete(node.getUuid(), false);