Package org.opends.server.types
Class SubtreeSpecification
- java.lang.Object
-
- org.opends.server.types.SubtreeSpecification
-
@PublicAPI(stability=VOLATILE, mayExtend=true) 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
Refinementproduct has been extended as follows:Refinement = item / and / or / not / Filter Filter = dquote *SafeUTF8Character dquote
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubtreeSpecification.FilterRefinementA refinement which uses a search filter.static classSubtreeSpecification.RefinementAbstract interface for RFC3672 specification filter refinements.
-
Constructor Summary
Constructors Constructor Description SubtreeSpecification(Dn rootDN)Create a dummy subtree specification.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Indicates whether the provided object is logically equal to this subtree specification object.DngetBaseDN()Get the absolute base DN of the subtree specification.Collection<Dn>getChopAfter()Get the ChopAfter LocalNames from the specificExclusions.Collection<Dn>getChopBefore()Get the ChopBefore LocalNames from the specificExclusions.intgetMaximumDepth()Get the maximumDepth.intgetMinimumDepth()Get the minimumDepth.SubtreeSpecification.RefinementgetRefinements()Get the specification filter refinements.DngetRelativeBaseDN()Get the relative base LocalName, ie the "base" field.inthashCode()Retrieves the hash code for this subtree specification object.booleanisDNWithinScope(Dn dn)Determine if the specified DN is within the scope of the subtree specification.booleanisWithinScope(Entry entry, Schema schema)Determine if an entry is within the scope of the subtree specification.static voidtoRFC3641StringValue(StringBuilder builder, String string)Append a string to a string builder, escaping any double quotes according to the StringValue production in RFC 3641.StringtoString()Retrieves a string representation of this subtree specification object.StringBuildertoString(StringBuilder builder)Append the string representation of the subtree specification to the provided string builder.static SubtreeSpecificationvalueOf(Dn rootDN, String s)Parses the string argument as an RFC3672 subtree specification.
-
-
-
Constructor Detail
-
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 Detail
-
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.
-
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
nullif 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.
-
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
trueif the DN is within the scope of the subtree specification, orfalseotherwise.
-
isWithinScope
public boolean isWithinScope(Entry entry, Schema schema)
Determine if an entry is within the scope of the subtree specification.- Parameters:
entry- the entryschema- the schema- Returns:
trueif the entry is within the scope of the subtree specification, orfalseif not.
-
toString
public String toString()
Retrieves 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 characterThat 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.
-
-