Class SubtreeSpecification

java.lang.Object
org.forgerock.opendj.ldap.SubtreeSpecification

public final class SubtreeSpecification extends Object
An RFC 3672 subtree specification.

This implementation extends RFC 3672 by supporting search filters for specification filters. More specifically, the Refinement product has been extended as follows:

  Refinement = item / and / or / not / Filter

  Filter     = dquote *SafeUTF8Character dquote
 
See Also:
  • Constructor Details

    • SubtreeSpecification

      public SubtreeSpecification(Dn rootDN)
      Create a dummy subtree specification. To be used when no subtree specification exists, for example in the case of old Draft based ldapSubEntry (non RFC3672 compliant).
      Parameters:
      rootDN - The root DN of the subtree.
  • Method Details

    • valueOf

      public static SubtreeSpecification valueOf(Dn rootDN, String s) throws LdapException
      Parses the string argument as an RFC3672 subtree specification.
      Parameters:
      rootDN - The DN of the subtree specification's base entry.
      s - The string to be parsed.
      Returns:
      The RFC3672 subtree specification represented by the string argument.
      Throws:
      LdapException - If the string does not contain a parsable relative subtree specification.
    • equals

      public boolean equals(Object obj)
      Indicates whether the provided object is logically equal to this subtree specification object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object for which to make the determination.
      Returns:
      true if the provided object is logically equal to this subtree specification object, or false if not.
    • getBaseDN

      public Dn getBaseDN()
      Get the absolute base DN of the subtree specification.
      Returns:
      Returns the absolute base DN of the subtree specification.
    • getChopAfter

      public Collection<Dn> getChopAfter()
      Get the ChopAfter LocalNames from the specificExclusions.
      Returns:
      A collection of LocalNames (i.e. DNs but relative to the base parameter)
    • getChopBefore

      public Collection<Dn> getChopBefore()
      Get the ChopBefore LocalNames from the specificExclusions.
      Returns:
      A collection of LocalNames (i.e. DNs but relative to the base parameter)
    • getRefinements

      public SubtreeSpecification.Refinement getRefinements()
      Get the specification filter refinements.
      Returns:
      Returns the specification filter refinements, or null if none were specified.
    • getRelativeBaseDN

      public Dn getRelativeBaseDN()
      Get the relative base LocalName, ie the "base" field.
      Returns:
      The Dn
    • getMinimumDepth

      public int getMinimumDepth()
      Get the minimumDepth.
      Returns:
      The minimum depth.
    • getMaximumDepth

      public int getMaximumDepth()
      Get the maximumDepth.
      Returns:
      The maximum depth.
    • hashCode

      public int hashCode()
      Retrieves the hash code for this subtree specification object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for this subtree specification object.
    • isDNWithinScope

      public boolean isDNWithinScope(Dn dn)
      Determine if the specified DN is within the scope of the subtree specification.
      Parameters:
      dn - The distinguished name.
      Returns:
      Returns true if the DN is within the scope of the subtree specification, or false otherwise.
    • isWithinScope

      public boolean isWithinScope(Entry entry, Schema schema)
      Determine if an entry is within the scope of the subtree specification.
      Parameters:
      entry - the entry
      schema - the schema
      Returns:
      true if the entry is within the scope of the subtree specification, or false if not.
    • toString

      public String toString()
      Retrieves a string representation of this subtree specification object.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this subtree specification object.
    • toString

      public StringBuilder toString(StringBuilder builder)
      Append the string representation of the subtree specification to the provided string builder.
      Parameters:
      builder - The string builder.
      Returns:
      The string builder.
    • toRFC3641StringValue

      public static void toRFC3641StringValue(StringBuilder builder, String string)
      Append a string to a string builder, escaping any double quotes according to the StringValue production in RFC 3641.

      In RFC 3641 the StringValue production looks like this:

          StringValue       = dquote *SafeUTF8Character dquote
          dquote            = %x22 ; " (double quote)
          SafeUTF8Character = %x00-21 / %x23-7F /   ; ASCII minus dquote
                              dquote dquote /       ; escaped double quote
                              %xC0-DF %x80-BF /     ; 2 byte UTF-8 character
                              %xE0-EF 2(%x80-BF) /  ; 3 byte UTF-8 character
                              %xF0-F7 3(%x80-BF)    ; 4 byte UTF-8 character
       

      That is, strings are surrounded by double-quotes and any internal double-quotes are doubled up.

      Parameters:
      builder - The string builder.
      string - The string to escape and append.