001/* 002 * Copyright 2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2018 Ping Identity Corporation 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk.unboundidds.controls; 022 023 024 025import com.unboundid.ldap.sdk.Control; 026import com.unboundid.ldap.sdk.LDAPException; 027import com.unboundid.ldap.sdk.ResultCode; 028import com.unboundid.util.NotMutable; 029import com.unboundid.util.ThreadSafety; 030import com.unboundid.util.ThreadSafetyLevel; 031 032import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*; 033 034 035 036/** 037 * This class provides an implementation of a request control that may be 038 * included in a search request to indicate that the server should process the 039 * search even if it cannot use its defined indexes to identify matching entries 040 * efficiently. This control will only have any effect if the requester has the 041 * unindexed-search-with-control privilege. If the user does not have that 042 * privilege, then an unindexed search request will either be accepted or 043 * rejected based on whether that user has the unindexed-search privilege (and 044 * it doesn't make any sense for the same user to have both the unindexed-search 045 * and unindexed-search-with-control privileges). 046 * <BR> 047 * <BLOCKQUOTE> 048 * <B>NOTE:</B> This class, and other classes within the 049 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 050 * supported for use against Ping Identity, UnboundID, and 051 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 052 * for proprietary functionality or for external specifications that are not 053 * considered stable or mature enough to be guaranteed to work in an 054 * interoperable way with other types of LDAP servers. 055 * </BLOCKQUOTE> 056 * <BR> 057 * This request control has an OID of "1.3.6.1.4.1.30221.2.5.55", may have a 058 * criticality of either true or false, and does not take a value. 059 * 060 * @see RejectUnindexedSearchRequestControl 061 */ 062@NotMutable() 063@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 064public final class PermitUnindexedSearchRequestControl 065 extends Control 066{ 067 /** 068 * The OID (1.3.6.1.4.1.30221.2.5.55) for the permit unindexed search request 069 * control. 070 */ 071 public static final String PERMIT_UNINDEXED_SEARCH_REQUEST_OID = 072 "1.3.6.1.4.1.30221.2.5.55"; 073 074 075 076 /** 077 * The serial version UID for this serializable class. 078 */ 079 private static final long serialVersionUID = 7192052212547454117L; 080 081 082 083 /** 084 * Creates a new permit unindexed search request control with a criticality of 085 * {@code false}. 086 */ 087 public PermitUnindexedSearchRequestControl() 088 { 089 this(false); 090 } 091 092 093 094 /** 095 * Creates a new permit unindexed search request control with the specified 096 * criticality. 097 * 098 * @param isCritical Indicates whether the control should be considered 099 * critical. 100 */ 101 public PermitUnindexedSearchRequestControl(final boolean isCritical) 102 { 103 super(PERMIT_UNINDEXED_SEARCH_REQUEST_OID, isCritical); 104 } 105 106 107 108 /** 109 * Creates a new permit unindexed search request control that is decoded from 110 * the provided generic control. 111 * 112 * @param control The generic control to be decoded as a permit unindexed 113 * search request control. 114 * 115 * @throws LDAPException If the provided control cannot be decoded as a 116 * permit unindexed search request control. 117 */ 118 public PermitUnindexedSearchRequestControl(final Control control) 119 throws LDAPException 120 { 121 super(control); 122 123 if (control.hasValue()) 124 { 125 throw new LDAPException(ResultCode.DECODING_ERROR, 126 ERR_PERMIT_UNINDEXED_SEARCH_REQUEST_HAS_VALUE.get()); 127 } 128 } 129 130 131 132 /** 133 * {@inheritDoc} 134 */ 135 @Override() 136 public String getControlName() 137 { 138 return INFO_CONTROL_NAME_PERMIT_UNINDEXED_SEARCH_REQUEST.get(); 139 } 140 141 142 143 /** 144 * {@inheritDoc} 145 */ 146 @Override() 147 public void toString(final StringBuilder buffer) 148 { 149 buffer.append("PermitUnindexedSearchRequestControl(isCritical="); 150 buffer.append(isCritical()); 151 buffer.append(')'); 152 } 153}