org.opends.server.controls
Class MatchedValuesFilter

java.lang.Object
  extended by org.opends.server.controls.MatchedValuesFilter

public class MatchedValuesFilter
extends java.lang.Object

This class defines a filter that may be used in conjunction with the matched values control to indicate which particular values of a multivalued attribute should be returned. The matched values filter is essentially a subset of an LDAP search filter, lacking support for AND, OR, and NOT components, and lacking support for the dnAttributes component of extensible matching filters.


Field Summary
static byte APPROXIMATE_MATCH_TYPE
          The BER type associated with the approxMatch filter type.
static byte EQUALITY_MATCH_TYPE
          The BER type associated with the equalityMatch filter type.
static byte EXTENSIBLE_MATCH_TYPE
          The BER type associated with the extensibleMatch filter type.
static byte GREATER_OR_EQUAL_TYPE
          The BER type associated with the greaterOrEqual filter type.
static byte LESS_OR_EQUAL_TYPE
          The BER type associated with the lessOrEqual filter type.
static byte PRESENT_TYPE
          The BER type associated with the present filter type.
static byte SUBSTRINGS_TYPE
          The BER type associated with the substrings filter type.
 
Method Summary
static MatchedValuesFilter createApproximateFilter(AttributeType attributeType, AttributeValue assertionValue)
          Creates a new approxMatch filter with the provided information.
static MatchedValuesFilter createApproximateFilter(java.lang.String rawAttributeType, ByteString rawAssertionValue)
          Creates a new approxMatch filter with the provided information.
static MatchedValuesFilter createEqualityFilter(AttributeType attributeType, AttributeValue assertionValue)
          Creates a new equalityMatch filter with the provided information.
static MatchedValuesFilter createEqualityFilter(java.lang.String rawAttributeType, ByteString rawAssertionValue)
          Creates a new equalityMatch filter with the provided information.
static MatchedValuesFilter createExtensibleMatchFilter(AttributeType attributeType, MatchingRule matchingRule, AttributeValue assertionValue)
          Creates a new extensibleMatch filter with the provided information.
static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String rawAttributeType, java.lang.String matchingRuleID, ByteString rawAssertionValue)
          Creates a new extensibleMatch filter with the provided information.
static MatchedValuesFilter createFromLDAPFilter(RawFilter filter)
          Creates a new matched values filter from the provided LDAP filter.
static MatchedValuesFilter createGreaterOrEqualFilter(AttributeType attributeType, AttributeValue assertionValue)
          Creates a new greaterOrEqual filter with the provided information.
static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String rawAttributeType, ByteString rawAssertionValue)
          Creates a new greaterOrEqual filter with the provided information.
static MatchedValuesFilter createLessOrEqualFilter(AttributeType attributeType, AttributeValue assertionValue)
          Creates a new lessOrEqual filter with the provided information.
static MatchedValuesFilter createLessOrEqualFilter(java.lang.String rawAttributeType, ByteString rawAssertionValue)
          Creates a new lessOrEqual filter with the provided information.
static MatchedValuesFilter createPresentFilter(AttributeType attributeType)
          Creates a new present filter with the provided information.
static MatchedValuesFilter createPresentFilter(java.lang.String rawAttributeType)
          Creates a new present filter with the provided information.
static MatchedValuesFilter createSubstringsFilter(AttributeType attributeType, ByteString subInitial, java.util.List<ByteString> subAny, ByteString subFinal)
          Creates a new substrings filter with the provided information.
static MatchedValuesFilter createSubstringsFilter(java.lang.String rawAttributeType, ByteString subInitial, java.util.List<ByteString> subAny, ByteString subFinal)
          Creates a new substrings filter with the provided information.
static MatchedValuesFilter decode(ASN1Element element)
          Decodes the provided ASN.1 element as a matched values filter item.
 ASN1Element encode()
          Encodes this matched values filter as an ASN.1 element.
 ApproximateMatchingRule getApproximateMatchingRule()
          Retrieves the approximate matching rule that should be used for this matched values filter.
 AttributeValue getAssertionValue()
          Retrieves the assertion value for this matched values filter.
 AttributeType getAttributeType()
          Retrieves the attribute type for this matched values filter.
 EqualityMatchingRule getEqualityMatchingRule()
          Retrieves the equality matching rule that should be used for this matched values filter.
 MatchingRule getMatchingRule()
          Retrieves the matching rule for this matched values filter.
 java.lang.String getMatchingRuleID()
          Retrieves the matching rule ID for this matched values filter.
 byte getMatchType()
          Retrieves the match type for this matched values filter.
 java.util.List<ASN1OctetString> getNormalizedSubAnyElements()
          Retrieves the set of normalized subAny elements for this matched values filter.
 ASN1OctetString getNormalizedSubFinalElement()
          Retrieves the normalized form of the subFinal element.
 ASN1OctetString getNormalizedSubInitialElement()
          Retrieves the normalized form of the subInitial element.
 OrderingMatchingRule getOrderingMatchingRule()
          Retrieves the ordering matching rule that should be used for this matched values filter.
 ByteString getRawAssertionValue()
          Retrieves the raw, unprocessed assertion value for this matched values filter.
 java.lang.String getRawAttributeType()
          Retrieves the raw, unprocessed attribute type for this matched values filter.
 java.util.List<ByteString> getSubAnyElements()
          Retrieves the set of subAny elements for this matched values filter.
 ByteString getSubFinalElement()
          Retrieves the subFinal element for this matched values filter.
 ByteString getSubInitialElement()
          Retrieves the subInitial element for this matched values filter.
 SubstringMatchingRule getSubstringMatchingRule()
          Retrieves the substring matching rule that should be used for this matched values filter.
 void setAssertionValue(AttributeValue assertionValue)
          Specifies the assertion value for this matched values filter.
 void setAttributeType(AttributeType attributeType)
          Specifies the attribute type for this matched values filter.
 void setMatchingRule(MatchingRule matchingRule)
          Specifies the matching rule for this matched values filter.
 void setMatchingRuleID(java.lang.String matchingRuleID)
          Specifies the matching rule ID for this matched values filter.
 void setRawAssertionValue(ByteString rawAssertionValue)
          Specifies the raw, unprocessed assertion value for this matched values filter.
 void setRawAttributeType(java.lang.String rawAttributeType)
          Specifies the raw, unprocessed attribute type for this matched values filter.
 void setSubAnyElements(java.util.List<ByteString> subAny)
          Specifies the set of subAny elements for this matched values filter.
 void setSubFinalElement(ByteString subFinal)
          Specifies the subFinal element for this matched values filter.
 void setSubInitialElement(ByteString subInitial)
          Specifies the subInitial element for this matched values filter.
 java.lang.String toString()
          Retrieves a string representation of this matched values filter, as an RFC 2254-compliant filter string.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this matched values filter, as an RFC 2254-compliant filter string, to the provided buffer.
 boolean valueMatches(AttributeType type, AttributeValue value)
          Indicates whether the specified attribute value matches the criteria defined in this matched values filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUALITY_MATCH_TYPE

public static final byte EQUALITY_MATCH_TYPE
The BER type associated with the equalityMatch filter type.

See Also:
Constant Field Values

SUBSTRINGS_TYPE

public static final byte SUBSTRINGS_TYPE
The BER type associated with the substrings filter type.

See Also:
Constant Field Values

GREATER_OR_EQUAL_TYPE

public static final byte GREATER_OR_EQUAL_TYPE
The BER type associated with the greaterOrEqual filter type.

See Also:
Constant Field Values

LESS_OR_EQUAL_TYPE

public static final byte LESS_OR_EQUAL_TYPE
The BER type associated with the lessOrEqual filter type.

See Also:
Constant Field Values

PRESENT_TYPE

public static final byte PRESENT_TYPE
The BER type associated with the present filter type.

See Also:
Constant Field Values

APPROXIMATE_MATCH_TYPE

public static final byte APPROXIMATE_MATCH_TYPE
The BER type associated with the approxMatch filter type.

See Also:
Constant Field Values

EXTENSIBLE_MATCH_TYPE

public static final byte EXTENSIBLE_MATCH_TYPE
The BER type associated with the extensibleMatch filter type.

See Also:
Constant Field Values
Method Detail

createEqualityFilter

public static MatchedValuesFilter createEqualityFilter(java.lang.String rawAttributeType,
                                                       ByteString rawAssertionValue)
Creates a new equalityMatch filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
rawAssertionValue - The raw, unprocessed assertion value.
Returns:
The created equalityMatch filter.

createEqualityFilter

public static MatchedValuesFilter createEqualityFilter(AttributeType attributeType,
                                                       AttributeValue assertionValue)
Creates a new equalityMatch filter with the provided information.

Parameters:
attributeType - The attribute type.
assertionValue - The assertion value.
Returns:
The created equalityMatch filter.

createSubstringsFilter

public static MatchedValuesFilter createSubstringsFilter(java.lang.String rawAttributeType,
                                                         ByteString subInitial,
                                                         java.util.List<ByteString> subAny,
                                                         ByteString subFinal)
Creates a new substrings filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
subInitial - The subInitial element.
subAny - The set of subAny elements.
subFinal - The subFinal element.
Returns:
The created substrings filter.

createSubstringsFilter

public static MatchedValuesFilter createSubstringsFilter(AttributeType attributeType,
                                                         ByteString subInitial,
                                                         java.util.List<ByteString> subAny,
                                                         ByteString subFinal)
Creates a new substrings filter with the provided information.

Parameters:
attributeType - The raw, unprocessed attribute type.
subInitial - The subInitial element.
subAny - The set of subAny elements.
subFinal - The subFinal element.
Returns:
The created substrings filter.

createGreaterOrEqualFilter

public static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String rawAttributeType,
                                                             ByteString rawAssertionValue)
Creates a new greaterOrEqual filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
rawAssertionValue - The raw, unprocessed assertion value.
Returns:
The created greaterOrEqual filter.

createGreaterOrEqualFilter

public static MatchedValuesFilter createGreaterOrEqualFilter(AttributeType attributeType,
                                                             AttributeValue assertionValue)
Creates a new greaterOrEqual filter with the provided information.

Parameters:
attributeType - The attribute type.
assertionValue - The assertion value.
Returns:
The created greaterOrEqual filter.

createLessOrEqualFilter

public static MatchedValuesFilter createLessOrEqualFilter(java.lang.String rawAttributeType,
                                                          ByteString rawAssertionValue)
Creates a new lessOrEqual filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
rawAssertionValue - The raw, unprocessed assertion value.
Returns:
The created lessOrEqual filter.

createLessOrEqualFilter

public static MatchedValuesFilter createLessOrEqualFilter(AttributeType attributeType,
                                                          AttributeValue assertionValue)
Creates a new lessOrEqual filter with the provided information.

Parameters:
attributeType - The attribute type.
assertionValue - The assertion value.
Returns:
The created lessOrEqual filter.

createPresentFilter

public static MatchedValuesFilter createPresentFilter(java.lang.String rawAttributeType)
Creates a new present filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
Returns:
The created present filter.

createPresentFilter

public static MatchedValuesFilter createPresentFilter(AttributeType attributeType)
Creates a new present filter with the provided information.

Parameters:
attributeType - The attribute type.
Returns:
The created present filter.

createApproximateFilter

public static MatchedValuesFilter createApproximateFilter(java.lang.String rawAttributeType,
                                                          ByteString rawAssertionValue)
Creates a new approxMatch filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
rawAssertionValue - The raw, unprocessed assertion value.
Returns:
The created approxMatch filter.

createApproximateFilter

public static MatchedValuesFilter createApproximateFilter(AttributeType attributeType,
                                                          AttributeValue assertionValue)
Creates a new approxMatch filter with the provided information.

Parameters:
attributeType - The attribute type.
assertionValue - The assertion value.
Returns:
The created approxMatch filter.

createExtensibleMatchFilter

public static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String rawAttributeType,
                                                              java.lang.String matchingRuleID,
                                                              ByteString rawAssertionValue)
Creates a new extensibleMatch filter with the provided information.

Parameters:
rawAttributeType - The raw, unprocessed attribute type.
matchingRuleID - The matching rule ID.
rawAssertionValue - The raw, unprocessed assertion value.
Returns:
The created extensibleMatch filter.

createExtensibleMatchFilter

public static MatchedValuesFilter createExtensibleMatchFilter(AttributeType attributeType,
                                                              MatchingRule matchingRule,
                                                              AttributeValue assertionValue)
Creates a new extensibleMatch filter with the provided information.

Parameters:
attributeType - The attribute type.
matchingRule - The matching rule.
assertionValue - The assertion value.
Returns:
The created extensibleMatch filter.

createFromLDAPFilter

public static MatchedValuesFilter createFromLDAPFilter(RawFilter filter)
                                                throws LDAPException
Creates a new matched values filter from the provided LDAP filter.

Parameters:
filter - The LDAP filter to use for this matched values filter.
Returns:
The corresponding matched values filter.
Throws:
LDAPException - If the provided LDAP filter cannot be treated as a matched values filter.

encode

public ASN1Element encode()
Encodes this matched values filter as an ASN.1 element.

Returns:
The ASN.1 element containing the encoded matched values filter.

decode

public static MatchedValuesFilter decode(ASN1Element element)
                                  throws LDAPException
Decodes the provided ASN.1 element as a matched values filter item.

Parameters:
element - The ASN.1 element to be decoded.
Returns:
The decoded matched values filter.
Throws:
LDAPException - If a problem occurs while attempting to decode the filter item.

getMatchType

public byte getMatchType()
Retrieves the match type for this matched values filter.

Returns:
The match type for this matched values filter.

getRawAttributeType

public java.lang.String getRawAttributeType()
Retrieves the raw, unprocessed attribute type for this matched values filter.

Returns:
The raw, unprocessed attribute type for this matched values filter, or null if there is none.

setRawAttributeType

public void setRawAttributeType(java.lang.String rawAttributeType)
Specifies the raw, unprocessed attribute type for this matched values filter.

Parameters:
rawAttributeType - The raw, unprocessed attribute type for this matched values filter.

getAttributeType

public AttributeType getAttributeType()
Retrieves the attribute type for this matched values filter.

Returns:
The attribute type for this matched values filter, or null if there is none.

setAttributeType

public void setAttributeType(AttributeType attributeType)
Specifies the attribute type for this matched values filter.

Parameters:
attributeType - The attribute type for this matched values filter.

getRawAssertionValue

public ByteString getRawAssertionValue()
Retrieves the raw, unprocessed assertion value for this matched values filter.

Returns:
The raw, unprocessed assertion value for this matched values filter, or null if there is none.

setRawAssertionValue

public void setRawAssertionValue(ByteString rawAssertionValue)
Specifies the raw, unprocessed assertion value for this matched values filter.

Parameters:
rawAssertionValue - The raw, unprocessed assertion value for this matched values filter.

getAssertionValue

public AttributeValue getAssertionValue()
Retrieves the assertion value for this matched values filter.

Returns:
The assertion value for this matched values filter, or null if there is none.

setAssertionValue

public void setAssertionValue(AttributeValue assertionValue)
Specifies the assertion value for this matched values filter.

Parameters:
assertionValue - The assertion value for this matched values filter.

getSubInitialElement

public ByteString getSubInitialElement()
Retrieves the subInitial element for this matched values filter.

Returns:
The subInitial element for this matched values filter, or null if there is none.

setSubInitialElement

public void setSubInitialElement(ByteString subInitial)
Specifies the subInitial element for this matched values filter.

Parameters:
subInitial - The subInitial element for this matched values filter.

getNormalizedSubInitialElement

public ASN1OctetString getNormalizedSubInitialElement()
Retrieves the normalized form of the subInitial element.

Returns:
The normalized form of the subInitial element, or null if there is none.

getSubAnyElements

public java.util.List<ByteString> getSubAnyElements()
Retrieves the set of subAny elements for this matched values filter.

Returns:
The set of subAny elements for this matched values filter. If there are none, then the return value may be either null or an empty list.

setSubAnyElements

public void setSubAnyElements(java.util.List<ByteString> subAny)
Specifies the set of subAny elements for this matched values filter.

Parameters:
subAny - The set of subAny elements for this matched values filter.

getNormalizedSubAnyElements

public java.util.List<ASN1OctetString> getNormalizedSubAnyElements()
Retrieves the set of normalized subAny elements for this matched values filter.

Returns:
The set of subAny elements for this matched values filter. If there are none, then an empty list will be returned. If a problem occurs while attempting to perform the normalization, then null will be returned.

getSubFinalElement

public ByteString getSubFinalElement()
Retrieves the subFinal element for this matched values filter.

Returns:
The subFinal element for this matched values filter, or null if there is none.

setSubFinalElement

public void setSubFinalElement(ByteString subFinal)
Specifies the subFinal element for this matched values filter.

Parameters:
subFinal - The subFinal element for this matched values filter.

getNormalizedSubFinalElement

public ASN1OctetString getNormalizedSubFinalElement()
Retrieves the normalized form of the subFinal element.

Returns:
The normalized form of the subFinal element, or null if there is none.

getMatchingRuleID

public java.lang.String getMatchingRuleID()
Retrieves the matching rule ID for this matched values filter.

Returns:
The matching rule ID for this matched values filter, or null if there is none.

setMatchingRuleID

public void setMatchingRuleID(java.lang.String matchingRuleID)
Specifies the matching rule ID for this matched values filter.

Parameters:
matchingRuleID - The matching rule ID for this matched values filter.

getMatchingRule

public MatchingRule getMatchingRule()
Retrieves the matching rule for this matched values filter.

Returns:
The matching rule for this matched values filter, or null if there is none.

setMatchingRule

public void setMatchingRule(MatchingRule matchingRule)
Specifies the matching rule for this matched values filter.

Parameters:
matchingRule - The matching rule for this matched values filter.

getApproximateMatchingRule

public ApproximateMatchingRule getApproximateMatchingRule()
Retrieves the approximate matching rule that should be used for this matched values filter.

Returns:
The approximate matching rule that should be used for this matched values filter, or null if there is none.

getEqualityMatchingRule

public EqualityMatchingRule getEqualityMatchingRule()
Retrieves the equality matching rule that should be used for this matched values filter.

Returns:
The equality matching rule that should be used for this matched values filter, or null if there is none.

getOrderingMatchingRule

public OrderingMatchingRule getOrderingMatchingRule()
Retrieves the ordering matching rule that should be used for this matched values filter.

Returns:
The ordering matching rule that should be used for this matched values filter, or null if there is none.

getSubstringMatchingRule

public SubstringMatchingRule getSubstringMatchingRule()
Retrieves the substring matching rule that should be used for this matched values filter.

Returns:
The substring matching rule that should be used for this matched values filter, or null if there is none.

valueMatches

public boolean valueMatches(AttributeType type,
                            AttributeValue value)
Indicates whether the specified attribute value matches the criteria defined in this matched values filter.

Parameters:
type - The attribute type with which the provided value is associated.
value - The attribute value for which to make the determination.
Returns:
true if the specified attribute value matches the criteria defined in this matched values filter, or false if not.

toString

public java.lang.String toString()
Retrieves a string representation of this matched values filter, as an RFC 2254-compliant filter string.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this matched values filter.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this matched values filter, as an RFC 2254-compliant filter string, to the provided buffer.

Parameters:
buffer - The buffer to which the filter string should be appended.