MatchedValuesFilter.java revision ef63838ee61a8a7345e4caf06c2c90009cbce807
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * CDDL HEADER START
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * The contents of this file are subject to the terms of the
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * Common Development and Distribution License, Version 1.0 only
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * (the "License"). You may not use this file except in compliance
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * with the License.
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * See the License for the specific language governing permissions
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * and limitations under the License.
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * When distributing Covered Code, include this CDDL HEADER in each
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * file and include the License file at legal-notices/CDDLv1_0.txt.
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * If applicable, add the following below this CDDL HEADER, with the
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * fields enclosed by brackets "[]" replaced with your own identifying
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * information:
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * Portions Copyright [yyyy] [name of copyright owner]
a1c093ec8cc9057e8506d31302b6374304f21072vboxsync * CDDL HEADER END
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * Copyright 2006-2010 Sun Microsystems, Inc.
a1c093ec8cc9057e8506d31302b6374304f21072vboxsync * Portions Copyright 2013-2014 Manuel Gaupp
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * Portions Copyright 2014-2015 ForgeRock AS
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsyncimport org.forgerock.opendj.ldap.schema.MatchingRule;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsyncimport org.opends.server.protocols.ldap.LDAPResultCode;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsyncimport static org.opends.messages.ProtocolMessages.*;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsyncimport static org.opends.server.protocols.ldap.LDAPConstants.*;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * This class defines a filter that may be used in conjunction with the matched
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * values control to indicate which particular values of a multivalued attribute
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * should be returned. The matched values filter is essentially a subset of an
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * LDAP search filter, lacking support for AND, OR, and NOT components, and
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync * lacking support for the dnAttributes component of extensible matching
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the equalityMatch filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte EQUALITY_MATCH_TYPE = (byte) 0xA3;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the substrings filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte SUBSTRINGS_TYPE = (byte) 0xA4;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the greaterOrEqual filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte GREATER_OR_EQUAL_TYPE = (byte) 0xA5;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the lessOrEqual filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte LESS_OR_EQUAL_TYPE = (byte) 0xA6;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the present filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte PRESENT_TYPE = (byte) 0x87;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the approxMatch filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte APPROXIMATE_MATCH_TYPE = (byte) 0xA8;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The BER type associated with the extensibleMatch filter type. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync public static final byte EXTENSIBLE_MATCH_TYPE = (byte) 0xA9;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The matching rule ID for this matched values filter. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** Indicates whether the elements of this matched values filter have been fully decoded. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync private boolean decoded;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The match type for this matched values filter. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync private final byte matchType;
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The raw, unprocessed attribute type for this matched values filter. */
da34f66f1d7f32c00dcccd9164bc10435de15952vboxsync /** The processed attribute type for this matched values filter. */
return filter;
return filter;
return filter;
return filter;
return filter;
return filter;
return filter;
throws LDAPException
case AND:
case OR:
case NOT:
case EQUALITY:
case SUBSTRING:
case GREATER_OR_EQUAL:
case LESS_OR_EQUAL:
case PRESENT:
case APPROXIMATE_MATCH:
case EXTENSIBLE_MATCH:
switch (matchType)
case EQUALITY_MATCH_TYPE:
case GREATER_OR_EQUAL_TYPE:
case LESS_OR_EQUAL_TYPE:
case APPROXIMATE_MATCH_TYPE:
case SUBSTRINGS_TYPE:
case PRESENT_TYPE:
case EXTENSIBLE_MATCH_TYPE:
throws LDAPException
byte type;
catch(Exception e)
switch (type)
case EQUALITY_MATCH_TYPE:
case GREATER_OR_EQUAL_TYPE:
case LESS_OR_EQUAL_TYPE:
case APPROXIMATE_MATCH_TYPE:
catch (Exception e)
case SUBSTRINGS_TYPE:
throw le;
catch (Exception e)
case PRESENT_TYPE:
catch (Exception e)
getExceptionMessage(e));
case EXTENSIBLE_MATCH_TYPE:
catch (Exception e)
getExceptionMessage(e));
public byte getMatchType()
return matchType;
return rawAttributeType;
return attributeType;
return rawAssertionValue;
return assertionValue;
return subInitial;
catch (DecodeException e)
return substringAssertion;
return subAny;
return subFinal;
return matchingRuleID;
return matchingRule;
return approximateMatchingRule;
return equalityMatchingRule;
return orderingMatchingRule;
return substringMatchingRule;
private void fullyDecode()
if (! decoded)
decoded = true;
fullyDecode();
switch (matchType)
case EQUALITY_MATCH_TYPE:
case SUBSTRINGS_TYPE:
return substringAssertion.matches(substringMatchingRule.normalizeAttributeValue(value)).toBoolean();
catch (Exception e)
case GREATER_OR_EQUAL_TYPE:
catch (DecodeException e)
case LESS_OR_EQUAL_TYPE:
catch (DecodeException e)
case PRESENT_TYPE:
case APPROXIMATE_MATCH_TYPE:
case EXTENSIBLE_MATCH_TYPE:
catch (DecodeException e)
switch (matchType)
case EQUALITY_MATCH_TYPE:
case SUBSTRINGS_TYPE:
case GREATER_OR_EQUAL_TYPE:
case LESS_OR_EQUAL_TYPE:
case PRESENT_TYPE:
case APPROXIMATE_MATCH_TYPE:
case EXTENSIBLE_MATCH_TYPE: