ref #10101 add the childNodes touche for TaxonNode and TermNode again in PostMergeEnt...
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 28 Jul 2022 18:09:10 +0000 (20:09 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 28 Jul 2022 18:36:29 +0000 (20:36 +0200)
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/PostMergeEntityListener.java

index 190a42c2827a4e0f27239bf4a71fa1abf5c3d649..f189425715a2adb10d1b020b50995e8916dad112 100644 (file)
@@ -51,7 +51,7 @@ public class PostMergeEntityListener implements MergeEventListener {
 
     @Override
     public void onMerge(MergeEvent event) throws HibernateException {
-        //Note AM: TODO is there a reason wyh we neglect onMerge in this case?
+        //Note AM: TODO is there a reason why we neglect onMerge in this case?
         //         Shouldn't we do something like "onMerge(event, new HashMap<>());"
 //        Object entity = event.getEntity();
     }
@@ -84,8 +84,8 @@ public class PostMergeEntityListener implements MergeEventListener {
             if (PolytomousKeyNode.class.isAssignableFrom(entityClazz)){
                 //For some reason the children list needs to be read once
                 //to guarantee that the sortindex starts with zero
-                PolytomousKeyNode resultPkn = (PolytomousKeyNode)result;
-                resultPkn.getChildren().size();
+                PolytomousKeyNode resultNode = (PolytomousKeyNode)result;
+                resultNode.getChildren().size();
 
                 // #10101 the following code tried to handle orphanRemoval for key nodes that were
                 // really removed from the graph. Generally the removal worked but it was not possible at this
@@ -100,15 +100,15 @@ public class PostMergeEntityListener implements MergeEventListener {
 
 //                EventSource session = event.getSession();
 //                PersistenceContext pc = session.getPersistenceContext();
-//                CollectionEntry childrenEntry = pc.getCollectionEntry((PersistentCollection)resultPkn.getChildren());
+//                CollectionEntry childrenEntry = pc.getCollectionEntry((PersistentCollection)resultNode.getChildren());
 //                List<PolytomousKeyNode> childrenEntrySnapshot = (List<PolytomousKeyNode>)childrenEntry.getSnapshot();
 //                if (childrenEntrySnapshot != null) {
 //                    for (PolytomousKeyNode snapshotChild: childrenEntrySnapshot){
-//                        if (!resultPkn.getChildren().contains(snapshotChild)) {
+//                        if (!resultNode.getChildren().contains(snapshotChild)) {
 //                            EntityEntry currentChild = pc.getEntry(snapshotChild);
 //                            Object parent = currentChild == null ? null :
 //                                currentChild.getLoadedValue("parent");
-//                            if (parent == null || parent == resultPkn) {
+//                            if (parent == null || parent == resultNode) {
 //                                session.delete(snapshotChild);
 //                            }
 //                        }
@@ -117,11 +117,8 @@ public class PostMergeEntityListener implements MergeEventListener {
             } else if (ITreeNode.class.isAssignableFrom(entityClazz)){ //TaxonNode or TermNode
                 //See PolytomousKeyNode above
                 //Not yet tested if necessary here, too.
-
-                //preliminary removed to test if related to LIE issues in TaxEditor test
-//                ITreeNode<?> resultNode = (ITreeNode<?>)result;
-//                resultNode.getChildNodes().size();
-
+                ITreeNode<?> resultNode = (ITreeNode<?>)result;
+                resultNode.getChildNodes().size();
             }
         }
     }