From f8f7bf5c46f0e0153c3cb34d40e3acd4a07ca6c7 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 16 Oct 2009 12:47:40 +0000
Subject: [PATCH] Fix for issue 4292 (control panel browse entries should not use the ManageDSAIT control systematically)

---
 opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java b/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
index ff0eb1e..a80ee90 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -159,7 +159,7 @@
     tree.setCellRenderer(new BrowserCellRenderer());
     displayFlags = DISPLAY_ACI_COUNT;
     displayAttribute = RDN_ATTRIBUTE;
-    followReferrals = true;
+    followReferrals = false;
     sorted = false;
     showContainerOnly = true;
     containerClasses = new String[0];
@@ -457,10 +457,18 @@
    * Enable/display the following of referrals.
    * This routine starts a refresh on each referral node.
    * @param followReferrals whether to follow referrals or not.
+   * @throws NamingException if there is an error updating the request controls
+   * of the internal connections.
    */
-  public void setFollowReferrals(boolean followReferrals) {
+  public void setFollowReferrals(boolean followReferrals) throws NamingException
+  {
     this.followReferrals = followReferrals;
-    startRefreshReferralNodes(rootNode);
+    stopRefresh();
+    removeAllChildNodes(rootNode, true /* Keep suffixes */);
+    ctxConfiguration.setRequestControls(getConfigurationRequestControls());
+    ctxUserData.setRequestControls(getRequestControls());
+    connectionPool.setRequestControls(getRequestControls());
+    startRefresh(null);
   }
 
 
@@ -1324,16 +1332,24 @@
    */
   Control[] getRequestControls()
   {
-    Control ctls[] = new Control[sorted ? 2 : 1];
-    ctls[0] = new ManageReferralControl(true);
-    if (sorted) {
+    Control ctls[];
+    if (followReferrals)
+    {
+      ctls = new Control[sorted ? 2 : 1];
+    }
+    else
+    {
+      ctls = new Control[sorted ? 1 : 0];
+    }
+    if (sorted)
+    {
       SortKey[] keys = new SortKey[SORT_ATTRIBUTES.length];
       for (int i=0; i<keys.length; i++) {
         keys[i] = new SortKey(SORT_ATTRIBUTES[i]);
       }
       try
       {
-        ctls[1] = new SortControl(keys, true);
+        ctls[0] = new SortControl(keys, false);
       }
       catch (IOException ioe)
       {
@@ -1342,6 +1358,10 @@
             ioe);
       }
     }
+    if (followReferrals)
+    {
+      ctls[ctls.length - 1] = new ManageReferralControl(false);
+    }
     return ctls;
   }
 
@@ -1351,8 +1371,7 @@
    */
   Control[] getConfigurationRequestControls()
   {
-    Control ctls[] = new Control[0];
-    return ctls;
+    return getRequestControls();
   }
 
 

--
Gitblit v1.10.0