From cec880d908a0dab559f4c55e4a0a1aa607594617 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Wed, 30 Jan 2008 13:16:55 +0000
Subject: [PATCH] - fix out of order workflow node insertion to cater for cases when a node being inserted has both child and parent nodes already registered in the workflow topology.  

---
 opends/src/server/org/opends/server/core/WorkflowTopologyNode.java |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/WorkflowTopologyNode.java b/opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
index e86bac5..2d06901 100644
--- a/opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
+++ b/opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
@@ -299,6 +299,12 @@
       WorkflowTopologyNode newWorkflow
       )
   {
+    // Dont try to add the workflow to itself.
+    if (newWorkflow == this)
+    {
+      return;
+    }
+
     // Check whether subordinates of current workflow should move to the
     // new workflow subordinate list.
     ArrayList<WorkflowTopologyNode> curSubordinateList =
@@ -308,10 +314,17 @@
     {
       DN newDN = newWorkflow.getBaseDN();
       DN subordinateDN = curSubordinate.getBaseDN();
+
+      // Dont try to add workflow when baseDNs are
+      // the same on both workflows.
+      if (newDN.equals(subordinateDN)) {
+        return;
+      }
+
       if (subordinateDN.isDescendantOf(newDN))
       {
         removeSubordinate(curSubordinate);
-        newWorkflow.addSubordinateNoCheck(curSubordinate, newWorkflow);
+        newWorkflow.addSubordinate(curSubordinate);
       }
     }
 

--
Gitblit v1.10.0