| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | public class MatchedValuesControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.controls.MatchedValuesControl"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(OID_MATCHED_VALUES, isCritical, encodeValue(filters)); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(isCritical), |
| | | String.valueOf(filters)); |
| | | |
| | | this.filters = filters; |
| | | } |
| | |
| | | { |
| | | super(oid, isCritical, encodeValue(filters)); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(isCritical), |
| | | String.valueOf(filters)); |
| | | |
| | | this.filters = filters; |
| | | } |
| | |
| | | { |
| | | super(oid, isCritical, encodedValue); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(isCritical), |
| | | String.valueOf(filters)); |
| | | |
| | | this.filters = filters; |
| | | } |
| | |
| | | private static ASN1OctetString |
| | | encodeValue(ArrayList<MatchedValuesFilter> filters) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encodeValue", |
| | | String.valueOf(filters)); |
| | | |
| | | |
| | | ArrayList<ASN1Element> elements = |
| | |
| | | public static MatchedValuesControl decodeControl(Control control) |
| | | throws LDAPException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "decodeControl", String.valueOf(control)); |
| | | |
| | | |
| | | if (! control.hasValue()) |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decodeControl", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | */ |
| | | public ArrayList<MatchedValuesFilter> getFilters() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getFilters"); |
| | | |
| | | return filters; |
| | | } |
| | |
| | | */ |
| | | public boolean valueMatches(AttributeType type, AttributeValue value) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "valueMatches", String.valueOf(type), |
| | | String.valueOf(value)); |
| | | |
| | | for (MatchedValuesFilter f : filters) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "valueMatches", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public String toString() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString"); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | toString(buffer); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString", "java.lang.StringBuilder"); |
| | | |
| | | if (filters.size() == 1) |
| | | { |