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

boli
20.27.2007 fceec4773fdc91fa7e11334a56f0403fd69292ed
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java
@@ -28,14 +28,9 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import com.sleepycat.je.Transaction;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeValue;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import org.opends.server.types.*;
import java.util.Comparator;
import java.util.HashSet;
@@ -62,19 +57,26 @@
       new AttributeIndex.KeyComparator();
  /**
   * The attribute index configuration for which this instance will
   * The attribute type for which this instance will
   * generate index keys.
   */
  private IndexConfig indexConfig;
  private AttributeType attributeType;
  /**
   * The substring length.
   */
  private int substrLength;
  /**
   * Create a new attribute substring indexer for the given index configuration.
   * @param indexConfig The index configuration for which an indexer is
   * @param attributeType The attribute type for which an indexer is
   * required.
   * @param substringLength The decomposed substring length.
   */
  public SubstringIndexer(IndexConfig indexConfig)
  public SubstringIndexer(AttributeType attributeType, int substringLength)
  {
    this.indexConfig = indexConfig;
    this.attributeType = attributeType;
    this.substrLength = substringLength;
  }
  /**
@@ -84,7 +86,7 @@
   */
  public String toString()
  {
    return indexConfig.getAttributeType().getNameOrOID() + ".substring";
    return attributeType.getNameOrOID() + ".substring";
  }
  /**
@@ -110,7 +112,7 @@
                       Set<ASN1OctetString> keys)
  {
    List<Attribute> attrList =
         entry.getAttribute(indexConfig.getAttributeType());
         entry.getAttribute(attributeType);
    if (attrList != null)
    {
      indexAttribute(attrList, keys);
@@ -135,11 +137,11 @@
  {
    List<Attribute> attrList;
    attrList = oldEntry.getAttribute(indexConfig.getAttributeType());
    attrList = oldEntry.getAttribute(attributeType);
    Set<ASN1OctetString> oldSet = new HashSet<ASN1OctetString>();
    indexAttribute(attrList, oldSet);
    attrList = newEntry.getAttribute(indexConfig.getAttributeType());
    attrList = newEntry.getAttribute(attributeType);
    Set<ASN1OctetString> newSet = new HashSet<ASN1OctetString>();
    indexAttribute(attrList, newSet);
@@ -224,7 +226,6 @@
   */
  private void substringKeys(byte[] value, Set<ASN1OctetString> set)
  {
    int substrLength = indexConfig.getSubstringLength();
    byte[] keyBytes;
    // Example: The value is ABCDE and the substring length is 3.