mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
11.10.2015 34178bf3bd845eb943c247eb4c8f657284ccbf7a
IndexQuery*.java:
Overrode toString() for all sub classes of IndexQuery.
2 files modified
88 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQuery.java 59 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQueryFactoryImpl.java 29 ●●●●● patch | view | raw | blame | history
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) + ")";
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexQueryFactoryImpl.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.backends.pluggable;
import static org.opends.messages.JebMessages.*;
import java.util.Collection;
import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -34,8 +36,6 @@
import org.forgerock.opendj.ldap.spi.IndexingOptions;
import org.opends.server.backends.pluggable.spi.ReadableStorage;
import static org.opends.messages.JebMessages.*;
/**
 * This class is an implementation of IndexQueryFactory which creates
 * IndexQuery objects as part of the query of the JEB index.
@@ -91,6 +91,12 @@
          }
          return entrySet;
        }
        @Override
        public String toString()
        {
          return "ExactMatch(" + indexID + "=" + key + ")";
        }
      };
  }
@@ -124,6 +130,19 @@
          }
          return entrySet;
        }
        @Override
        public String toString()
        {
          final StringBuilder sb = new StringBuilder("RangeMatch(");
          sb.append(lowerBound).append(" ");
          sb.append(includeLowerBound ? "<=" : "<").append(" ");
          sb.append(indexID).append(" ");
          sb.append(includeUpperBound ? ">=" : ">").append(" ");
          sb.append(upperBound);
          sb.append(")");
          return sb.toString();
        }
      };
  }
@@ -173,6 +192,12 @@
          }
          return entrySet;
        }
        @Override
        public String toString()
        {
          return "MatchAll(" + PRESENCE_INDEX_KEY + ")";
        }
      };
  }