Package com.unboundid.ldap.sdk.controls
Class PreReadRequestControl
java.lang.Object
com.unboundid.ldap.sdk.Control
com.unboundid.ldap.sdk.controls.PreReadRequestControl
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class PreReadRequestControl
extends Control
This class provides an implementation of the LDAP pre-read request control
as defined in RFC 4527. It
may be used to request that the server retrieve a copy of the target entry as
it appeared immediately before processing a delete, modify, or modify DN
operation.
If this control is included in a delete, modify, or modify DN request, then the corresponding response may include a
The value of this control should contain a set of requested attributes to include in the entry that is returned. The server should treat this set of requested attributes exactly as it treats the requested attributes from a
The use of the LDAP pre-read request control is virtually identical to the use of the LDAP post-read request control. See the documentation for the
If this control is included in a delete, modify, or modify DN request, then the corresponding response may include a
PreReadResponseControl
containing a version of the entry as it before after applying that change.
Note that this response control will only be included if the operation was
successful, so it will not be provided if the operation failed for some
reason (e.g., if the change would have violated the server schema, or if the
requester did not have sufficient permission to perform that operation).
The value of this control should contain a set of requested attributes to include in the entry that is returned. The server should treat this set of requested attributes exactly as it treats the requested attributes from a
SearchRequest. As is the case with a search
request, if no attributes are specified, then all user attributes will be
included.
The use of the LDAP pre-read request control is virtually identical to the use of the LDAP post-read request control. See the documentation for the
PostReadRequestControl for an example that illustrates its use.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe OID (1.3.6.1.1.13.1) for the pre-read request control. -
Constructor Summary
ConstructorsConstructorDescriptionPreReadRequestControl(boolean isCritical, String... attributes) Creates a new pre-read request control that will retrieve the specified set of attributes from the target entry.PreReadRequestControl(Control control) Creates a new pre-read request control which is decoded from the provided generic control.PreReadRequestControl(String... attributes) Creates a new pre-read request control that will retrieve the specified set of attributes from the target entry. -
Method Summary
Modifier and TypeMethodDescriptionstatic PreReadRequestControldecodeJSONControl(JSONObject controlObject, boolean strict) Attempts to decode the provided object as a JSON representation of a pre-read request control.String[]Retrieves the set of attributes that will be requested for inclusion in the entry returned in the response control.Retrieves the user-friendly name for this control, if available.Retrieves a representation of this pre-read request control as a JSON object.voidtoString(StringBuilder buffer) Appends a string representation of this LDAP control to the provided buffer.Methods inherited from class com.unboundid.ldap.sdk.Control
decode, decode, decodeControls, decodeJSONControl, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toString, writeTo
-
Field Details
-
PRE_READ_REQUEST_OID
The OID (1.3.6.1.1.13.1) for the pre-read request control.- See Also:
-
-
Constructor Details
-
PreReadRequestControl
Creates a new pre-read request control that will retrieve the specified set of attributes from the target entry. It will be marked critical.- Parameters:
attributes- The set of attributes to retrieve from the target entry. It behaves in the same way as the set of requested attributes for a search operation. If this is empty ornull, then all user attributes will be returned.
-
PreReadRequestControl
Creates a new pre-read request control that will retrieve the specified set of attributes from the target entry.- Parameters:
isCritical- Indicates whether this control should be marked critical.attributes- The set of attributes to retrieve from the target entry. It behaves in the same way as the set of requested attributes for a search operation. If this is empty ornull, then all user attributes will be returned.
-
PreReadRequestControl
Creates a new pre-read request control which is decoded from the provided generic control.- Parameters:
control- The generic control to be decoded as a pre-read request control.- Throws:
LDAPException- If the provided control cannot be decoded as a pre-read request control.
-
-
Method Details
-
getAttributes
Retrieves the set of attributes that will be requested for inclusion in the entry returned in the response control.- Returns:
- The set of attributes that will be requested for inclusion in the entry returned in the response control, or an empty array if all user attributes should be returned.
-
getControlName
Retrieves the user-friendly name for this control, if available. If no user-friendly name has been defined, then the OID will be returned.- Overrides:
getControlNamein classControl- Returns:
- The user-friendly name for this control, or the OID if no user-friendly name is available.
-
toJSONControl
Retrieves a representation of this pre-read request control as a JSON object. The JSON object uses the following fields:-
oid-- A mandatory string field whose value is the object identifier for this control. For the pre-read request control, the OID is "1.3.6.1.1.13.1". -
control-name-- An optional string field whose value is a human-readable name for this control. This field is only intended for descriptive purposes, and when decoding a control, theoidfield should be used to identify the type of control. -
criticality-- A mandatory Boolean field used to indicate whether this control is considered critical. -
value-base64-- An optional string field whose value is a base64-encoded representation of the raw value for this pre-read request control. Exactly one of thevalue-base64andvalue-jsonfields must be present. -
value-json-- An optional JSON object field whose value is a user-friendly representation of the value for this pre-read request control. Exactly one of thevalue-base64andvalue-jsonfields must be present, and if thevalue-jsonfield is used, then it will use the following fields:-
attributes-- An optional array field whose values are strings that represent the names of the attributes to include in the entry returned in the response control.
-
- Overrides:
toJSONControlin classControl- Returns:
- A JSON object that contains a representation of this control.
-
-
decodeJSONControl
@NotNull public static PreReadRequestControl decodeJSONControl(@NotNull JSONObject controlObject, boolean strict) throws LDAPException Attempts to decode the provided object as a JSON representation of a pre-read request control.- Parameters:
controlObject- The JSON object to be decoded. It must not benull.strict- Indicates whether to use strict mode when decoding the provided JSON object. If this istrue, then this method will throw an exception if the provided JSON object contains any unrecognized fields. If this isfalse, then unrecognized fields will be ignored.- Returns:
- The pre-read request control that was decoded from the provided JSON object.
- Throws:
LDAPException- If the provided JSON object cannot be parsed as a valid pre-read request control.
-
toString
Appends a string representation of this LDAP control to the provided buffer.
-