001 /*
002 * Copyright 2012-2015 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2015 UnboundID Corp.
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 */
021 package com.unboundid.ldap.sdk.unboundidds.extensions;
022
023
024
025 import com.unboundid.ldap.sdk.Control;
026 import com.unboundid.ldap.sdk.ExtendedRequest;
027 import com.unboundid.ldap.sdk.ExtendedResult;
028 import com.unboundid.ldap.sdk.LDAPConnection;
029 import com.unboundid.ldap.sdk.LDAPException;
030 import com.unboundid.ldap.sdk.ResultCode;
031 import com.unboundid.util.NotMutable;
032 import com.unboundid.util.ThreadSafety;
033 import com.unboundid.util.ThreadSafetyLevel;
034
035 import static com.unboundid.ldap.sdk.unboundidds.extensions.ExtOpMessages.*;
036
037
038
039 /**
040 * <BLOCKQUOTE>
041 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
042 * LDAP SDK for Java. It is not available for use in applications that
043 * include only the Standard Edition of the LDAP SDK, and is not supported for
044 * use in conjunction with non-UnboundID products.
045 * </BLOCKQUOTE>
046 * This class provides an implementation of the get subtree accessibility
047 * extended request, which may be used to request information about all subtree
048 * accessibility restrictions currently defined in the server, including for
049 * subtrees that are hidden or read-only. Subtree accessibility may be altered
050 * using the {@link SetSubtreeAccessibilityExtendedRequest}.
051 * <BR><BR>
052 * This extended request has an OID of 1.3.6.1.4.1.30221.1.6.20 and does not
053 * have a value.
054 *
055 * @see GetSubtreeAccessibilityExtendedResult
056 */
057 @NotMutable()
058 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
059 public final class GetSubtreeAccessibilityExtendedRequest
060 extends ExtendedRequest
061 {
062 /**
063 * The OID (1.3.6.1.4.1.30221.1.6.20) for the get subtree accessibility
064 * extended request.
065 */
066 public static final String GET_SUBTREE_ACCESSIBILITY_REQUEST_OID =
067 "1.3.6.1.4.1.30221.1.6.20";
068
069
070
071 /**
072 * The serial version UID for this serializable class.
073 */
074 private static final long serialVersionUID = 6519976409372387402L;
075
076
077
078 /**
079 * Creates a new get subtree accessibility extended request.
080 *
081 * @param controls The set of controls to include in the request. It may be
082 * {@code null} or empty if no controls are needed.
083 */
084 public GetSubtreeAccessibilityExtendedRequest(final Control... controls)
085 {
086 super(GET_SUBTREE_ACCESSIBILITY_REQUEST_OID, null, controls);
087 }
088
089
090
091 /**
092 * Creates a new get subtree accessibility extended request from the provided
093 * generic extended request.
094 *
095 * @param extendedRequest The generic extended request to use to create this
096 * get subtree accessibility extended request.
097 *
098 * @throws LDAPException If a problem occurs while decoding the request.
099 */
100 public GetSubtreeAccessibilityExtendedRequest(
101 final ExtendedRequest extendedRequest)
102 throws LDAPException
103 {
104 super(extendedRequest);
105
106 if (extendedRequest.hasValue())
107 {
108 throw new LDAPException(ResultCode.DECODING_ERROR,
109 ERR_GET_SUBTREE_ACCESSIBILITY_REQUEST_HAS_VALUE.get());
110 }
111 }
112
113
114
115 /**
116 * {@inheritDoc}
117 */
118 @Override()
119 public GetSubtreeAccessibilityExtendedResult process(
120 final LDAPConnection connection, final int depth)
121 throws LDAPException
122 {
123 final ExtendedResult extendedResponse = super.process(connection, depth);
124 return new GetSubtreeAccessibilityExtendedResult(extendedResponse);
125 }
126
127
128
129 /**
130 * {@inheritDoc}
131 */
132 @Override()
133 public GetSubtreeAccessibilityExtendedRequest duplicate()
134 {
135 return duplicate(getControls());
136 }
137
138
139
140 /**
141 * {@inheritDoc}
142 */
143 @Override()
144 public GetSubtreeAccessibilityExtendedRequest duplicate(
145 final Control[] controls)
146 {
147 final GetSubtreeAccessibilityExtendedRequest r =
148 new GetSubtreeAccessibilityExtendedRequest(controls);
149 r.setResponseTimeoutMillis(getResponseTimeoutMillis(null));
150 return r;
151 }
152
153
154
155 /**
156 * {@inheritDoc}
157 */
158 @Override()
159 public String getExtendedRequestName()
160 {
161 return INFO_EXTENDED_REQUEST_NAME_GET_SUBTREE_ACCESSIBILITY.get();
162 }
163
164
165
166 /**
167 * {@inheritDoc}
168 */
169 @Override()
170 public void toString(final StringBuilder buffer)
171 {
172 buffer.append("GetSubtreeAccessibilityExtendedRequest(");
173
174 final Control[] controls = getControls();
175 if (controls.length > 0)
176 {
177 buffer.append("controls={");
178 for (int i=0; i < controls.length; i++)
179 {
180 if (i > 0)
181 {
182 buffer.append(", ");
183 }
184
185 buffer.append(controls[i]);
186 }
187 buffer.append('}');
188 }
189
190 buffer.append(')');
191 }
192 }