From 34178bf3bd845eb943c247eb4c8f657284ccbf7a Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 11 Mar 2015 13:10:45 +0000
Subject: [PATCH] IndexQuery*.java: Overrode toString() for all sub classes of IndexQuery.

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java |   59 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java
index 0e0a60f..ac34069 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java
@@ -26,14 +26,15 @@
  */
 package org.opends.server.backends.pluggable;
 
+import static org.opends.server.backends.pluggable.IndexFilter.*;
+
 import java.util.Collection;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
-
-import static org.opends.server.backends.jeb.IndexFilter.*;
+import org.forgerock.util.Utils;
 
 /**
- * This class represents a JE Backend Query.
+ * This class represents a Backend Query.
  */
 @org.opends.server.types.PublicAPI(
     stability = org.opends.server.types.StabilityLevel.VOLATILE,
@@ -42,6 +43,8 @@
     mayInvoke = false)
 abstract class IndexQuery
 {
+  private static final String SEPARATOR = "\n  ";
+
   /**
    * Evaluates the index query and returns the EntryIDSet.
    *
@@ -52,8 +55,6 @@
    */
   public abstract EntryIDSet evaluate(LocalizableMessageBuilder debugMessage);
 
-
-
   /**
    * Creates an IntersectionIndexQuery object from a collection of
    * IndexQuery objects.
@@ -62,14 +63,11 @@
    *          A collection of IndexQuery objects.
    * @return An IntersectionIndexQuery object.
    */
-  static IndexQuery createIntersectionIndexQuery(
-      Collection<IndexQuery> subIndexQueries)
+  static IndexQuery createIntersectionIndexQuery(Collection<IndexQuery> subIndexQueries)
   {
     return new IntersectionIndexQuery(subIndexQueries);
   }
 
-
-
   /**
    * Creates a union IndexQuery object from a collection of IndexQuery
    * objects.
@@ -78,14 +76,11 @@
    *          Collection of IndexQuery objects.
    * @return A UnionIndexQuery object.
    */
-  static IndexQuery createUnionIndexQuery(
-      Collection<IndexQuery> subIndexQueries)
+  static IndexQuery createUnionIndexQuery(Collection<IndexQuery> subIndexQueries)
   {
     return new UnionIndexQuery(subIndexQueries);
   }
 
-
-
   /**
    * Creates an empty IndexQuery object.
    *
@@ -97,7 +92,6 @@
   }
 
 
-
   /**
    * This class creates a Null IndexQuery. It is used when there is no
    * record in the index. It may also be used when the index contains
@@ -106,12 +100,17 @@
    */
   private static final class NullIndexQuery extends IndexQuery
   {
-    /** {@inheritDoc} */
     @Override
     public EntryIDSet evaluate(LocalizableMessageBuilder debugMessage)
     {
       return new EntryIDSet();
     }
+
+    @Override
+    public String toString()
+    {
+      return "Null";
+    }
   }
 
   /**
@@ -120,13 +119,9 @@
    */
   private static final class IntersectionIndexQuery extends IndexQuery
   {
-    /**
-     * Collection of IndexQuery objects.
-     */
+    /** Collection of IndexQuery objects. */
     private final Collection<IndexQuery> subIndexQueries;
 
-
-
     /**
      * Creates an instance of IntersectionIndexQuery.
      *
@@ -138,7 +133,6 @@
       this.subIndexQueries = subIndexQueries;
     }
 
-    /** {@inheritDoc} */
     @Override
     public EntryIDSet evaluate(LocalizableMessageBuilder debugMessage)
     {
@@ -161,20 +155,20 @@
       }
       return entryIDs;
     }
+
+    @Override
+    public String toString()
+    {
+      return "Intersection(" + SEPARATOR + Utils.joinAsString(SEPARATOR, subIndexQueries) + ")";
+    }
   }
 
-  /**
-   * This class creates a union of IndexQuery objects.
-   */
+  /** This class creates a union of IndexQuery objects. */
   private static final class UnionIndexQuery extends IndexQuery
   {
-    /**
-     * Collection containing IndexQuery objects.
-     */
+    /** Collection containing IndexQuery objects. */
     private final Collection<IndexQuery> subIndexQueries;
 
-
-
     /**
      * Creates an instance of UnionIndexQuery.
      *
@@ -186,7 +180,6 @@
       this.subIndexQueries = subIndexQueries;
     }
 
-    /** {@inheritDoc} */
     @Override
     public EntryIDSet evaluate(LocalizableMessageBuilder debugMessage)
     {
@@ -209,5 +202,11 @@
       }
       return entryIDs;
     }
+
+    @Override
+    public String toString()
+    {
+      return "Union(" + SEPARATOR + Utils.joinAsString(SEPARATOR, subIndexQueries) + ")";
+    }
   }
 }

--
Gitblit v1.10.0