org.opends.server.protocols.ldap
Class LDAPFilter

java.lang.Object
  extended by org.opends.server.types.RawFilter
      extended by org.opends.server.protocols.ldap.LDAPFilter

public class LDAPFilter
extends RawFilter

This class defines the data structures and methods to use when interacting with an LDAP search filter, which defines a set of criteria for locating entries in a search request.


Constructor Summary
LDAPFilter(FilterType filterType, java.util.ArrayList<RawFilter> filterComponents, RawFilter notComponent, java.lang.String attributeType, ByteString assertionValue, ByteString subInitialElement, java.util.ArrayList<ByteString> subAnyElements, ByteString subFinalElement, java.lang.String matchingRuleID, boolean dnAttributes)
          Creates a new LDAP filter with the provided information.
LDAPFilter(SearchFilter filter)
          Creates a new LDAP filter from the provided search filter.
 
Method Summary
static LDAPFilter decode(java.lang.String filterString)
          Decodes the provided string into an LDAP search filter.
 ByteString getAssertionValue()
          Retrieves the assertion value for this search filter.
 java.lang.String getAttributeType()
          Retrieves the attribute type for this search filter.
 boolean getDNAttributes()
          Retrieves the value of the DN attributes flag for this extensible match filter, which indicates whether to perform matching on the components of the DN.
 java.util.ArrayList<RawFilter> getFilterComponents()
          Retrieves the set of subordinate filter components for AND or OR searches.
 FilterType getFilterType()
          Retrieves the filter type for this search filter.
 java.lang.String getMatchingRuleID()
          Retrieves the matching rule ID for this extensible match filter.
 RawFilter getNOTComponent()
          Retrieves the subordinate filter component for NOT searches.
 java.util.ArrayList<ByteString> getSubAnyElements()
          Retrieves the set of subAny elements for this substring filter.
 ByteString getSubFinalElement()
          Retrieves the subFinal element for this substring filter.
 ByteString getSubInitialElement()
          Retrieves the subInitial component for this substring filter.
 void setAssertionValue(ByteString assertionValue)
          Specifies the assertion value for this search filter.
 void setAttributeType(java.lang.String attributeType)
          Specifies the attribute type for this search filter.
 void setDNAttributes(boolean dnAttributes)
          Specifies the value of the DN attributes flag for this extensible match filter.
 void setFilterComponents(java.util.ArrayList<RawFilter> filterComponents)
          Specifies the set of subordinate filter components for AND or OR searches.
 void setMatchingRuleID(java.lang.String matchingRuleID)
          Specifies the matching rule ID for this extensible match filter.
 void setNOTComponent(RawFilter notComponent)
          Specifies the subordinate filter component for NOT searches.
 void setSubAnyElements(java.util.ArrayList<ByteString> subAnyElements)
          Specifies the set of subAny values for this substring filter.
 void setSubFinalElement(ByteString subFinalElement)
          Specifies the subFinal element for this substring filter.
 void setSubInitialElement(ByteString subInitialElement)
          Specifies the subInitial element for this substring filter.
 SearchFilter toSearchFilter()
          Converts this LDAP filter to a search filter that may be used by the Directory Server's core processing.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this search filter to the provided buffer.
 
Methods inherited from class org.opends.server.types.RawFilter
create, create, createANDFilter, createApproximateFilter, createEqualityFilter, createExtensibleFilter, createGreaterOrEqualFilter, createLessOrEqualFilter, createNOTFilter, createORFilter, createPresenceFilter, createSubstringFilter, decode, encode, toString, valueToFilterString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPFilter

public LDAPFilter(FilterType filterType,
                  java.util.ArrayList<RawFilter> filterComponents,
                  RawFilter notComponent,
                  java.lang.String attributeType,
                  ByteString assertionValue,
                  ByteString subInitialElement,
                  java.util.ArrayList<ByteString> subAnyElements,
                  ByteString subFinalElement,
                  java.lang.String matchingRuleID,
                  boolean dnAttributes)
Creates a new LDAP filter with the provided information. Note that this constructor is only intended for use by the RawFilter class and any use of this constructor outside of that class must be very careful to ensure that all of the appropriate element types have been provided for the associated filter type.

Parameters:
filterType - The filter type for this filter.
filterComponents - The filter components for AND and OR filters.
notComponent - The filter component for NOT filters.
attributeType - The attribute type for this filter.
assertionValue - The assertion value for this filter.
subInitialElement - The subInitial element for substring filters.
subAnyElements - The subAny elements for substring filters.
subFinalElement - The subFinal element for substring filters.
matchingRuleID - The matching rule ID for extensible filters.
dnAttributes - The dnAttributes flag for extensible filters.

LDAPFilter

public LDAPFilter(SearchFilter filter)
Creates a new LDAP filter from the provided search filter.

Parameters:
filter - The search filter to use to create this LDAP filter.
Method Detail

decode

public static LDAPFilter decode(java.lang.String filterString)
                         throws LDAPException
Decodes the provided string into an LDAP search filter.

Parameters:
filterString - The string representation of the search filter to decode.
Returns:
The decoded LDAP search filter.
Throws:
LDAPException - If the provided string does not represent a valid LDAP search filter.

getFilterType

public FilterType getFilterType()
Retrieves the filter type for this search filter.

Specified by:
getFilterType in class RawFilter
Returns:
The filter type for this search filter.

getFilterComponents

public java.util.ArrayList<RawFilter> getFilterComponents()
Retrieves the set of subordinate filter components for AND or OR searches. The contents of the returned list may be altered by the caller.

Specified by:
getFilterComponents in class RawFilter
Returns:
The set of subordinate filter components for AND and OR searches, or null if this is not an AND or OR search.

setFilterComponents

public void setFilterComponents(java.util.ArrayList<RawFilter> filterComponents)
Specifies the set of subordinate filter components for AND or OR searches. This will be ignored for all other filter types.

Specified by:
setFilterComponents in class RawFilter
Parameters:
filterComponents - The set of subordinate filter components for AND or OR searches.

getNOTComponent

public RawFilter getNOTComponent()
Retrieves the subordinate filter component for NOT searches.

Specified by:
getNOTComponent in class RawFilter
Returns:
The subordinate filter component for NOT searches, or null if this is not a NOT search.

setNOTComponent

public void setNOTComponent(RawFilter notComponent)
Specifies the subordinate filter component for NOT searches. This will be ignored for any other type of search.

Specified by:
setNOTComponent in class RawFilter
Parameters:
notComponent - The subordinate filter component for NOT searches.

getAttributeType

public java.lang.String getAttributeType()
Retrieves the attribute type for this search filter. This will not be applicable for AND, OR, or NOT filters.

Specified by:
getAttributeType in class RawFilter
Returns:
The attribute type for this search filter, or null if there is none.

setAttributeType

public void setAttributeType(java.lang.String attributeType)
Specifies the attribute type for this search filter. This will be ignored for AND, OR, and NOT searches.

Specified by:
setAttributeType in class RawFilter
Parameters:
attributeType - The attribute type for this search filter.

getAssertionValue

public ByteString getAssertionValue()
Retrieves the assertion value for this search filter. This will only be applicable for equality, greater or equal, less or equal, approximate, or extensible matching filters.

Specified by:
getAssertionValue in class RawFilter
Returns:
The assertion value for this search filter, or null if there is none.

setAssertionValue

public void setAssertionValue(ByteString assertionValue)
Specifies the assertion value for this search filter. This will be ignored for types of filters that do not have an assertion value.

Specified by:
setAssertionValue in class RawFilter
Parameters:
assertionValue - The assertion value for this search filter.

getSubInitialElement

public ByteString getSubInitialElement()
Retrieves the subInitial component for this substring filter. This is only applicable for substring search filters, but even substring filters might not have a value for this component.

Specified by:
getSubInitialElement in class RawFilter
Returns:
The subInitial component for this substring filter, or null if there is none.

setSubInitialElement

public void setSubInitialElement(ByteString subInitialElement)
Specifies the subInitial element for this substring filter. This will be ignored for all other types of filters.

Specified by:
setSubInitialElement in class RawFilter
Parameters:
subInitialElement - The subInitial element for this substring filter.

getSubAnyElements

public java.util.ArrayList<ByteString> getSubAnyElements()
Retrieves the set of subAny elements for this substring filter. This is only applicable for substring search filters, and even then may be null or empty for some substring filters.

Specified by:
getSubAnyElements in class RawFilter
Returns:
The set of subAny elements for this substring filter, or null if there are none.

setSubAnyElements

public void setSubAnyElements(java.util.ArrayList<ByteString> subAnyElements)
Specifies the set of subAny values for this substring filter. This will be ignored for other filter types.

Specified by:
setSubAnyElements in class RawFilter
Parameters:
subAnyElements - The set of subAny elements for this substring filter.

getSubFinalElement

public ByteString getSubFinalElement()
Retrieves the subFinal element for this substring filter. This is not applicable for any other filter type, and may not be provided even for some substring filters.

Specified by:
getSubFinalElement in class RawFilter
Returns:
The subFinal element for this substring filter, or null if there is none.

setSubFinalElement

public void setSubFinalElement(ByteString subFinalElement)
Specifies the subFinal element for this substring filter. This will be ignored for all other filter types.

Specified by:
setSubFinalElement in class RawFilter
Parameters:
subFinalElement - The subFinal element for this substring filter.

getMatchingRuleID

public java.lang.String getMatchingRuleID()
Retrieves the matching rule ID for this extensible match filter. This is not applicable for any other type of filter and may not be included in some extensible matching filters.

Specified by:
getMatchingRuleID in class RawFilter
Returns:
The matching rule ID for this extensible match filter, or null if there is none.

setMatchingRuleID

public void setMatchingRuleID(java.lang.String matchingRuleID)
Specifies the matching rule ID for this extensible match filter. It will be ignored for all other filter types.

Specified by:
setMatchingRuleID in class RawFilter
Parameters:
matchingRuleID - The matching rule ID for this extensible match filter.

getDNAttributes

public boolean getDNAttributes()
Retrieves the value of the DN attributes flag for this extensible match filter, which indicates whether to perform matching on the components of the DN. This does not apply for any other type of filter.

Specified by:
getDNAttributes in class RawFilter
Returns:
The value of the DN attributes flag for this extensibleMatch filter.

setDNAttributes

public void setDNAttributes(boolean dnAttributes)
Specifies the value of the DN attributes flag for this extensible match filter. It will be ignored for all other filter types.

Specified by:
setDNAttributes in class RawFilter
Parameters:
dnAttributes - The value of the DN attributes flag for this extensible match filter.

toSearchFilter

public SearchFilter toSearchFilter()
                            throws DirectoryException
Converts this LDAP filter to a search filter that may be used by the Directory Server's core processing.

Specified by:
toSearchFilter in class RawFilter
Returns:
The generated search filter.
Throws:
DirectoryException - If a problem occurs while attempting to construct the search filter.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this search filter to the provided buffer.

Specified by:
toString in class RawFilter
Parameters:
buffer - The buffer to which the information should be appended.