com.unboundid.ldap.sdk.controls
Class PostReadRequestControl

java.lang.Object
  extended by com.unboundid.ldap.sdk.Control
      extended by com.unboundid.ldap.sdk.controls.PostReadRequestControl
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class PostReadRequestControl
extends Control

This class provides an implementation of the LDAP post-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 after processing an add, modify, or modify DN operation.

If this control is included in an add, modify, or modify DN request, then the corresponding response may include a PostReadResponseControl containing a version of the entry as it appeared 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.

Example

The following example demonstrates the use of the post-read controls. It will modify an entry to increment the value of the testCounter attribute by one, and will use the post-read controls to determine what the new value is:
   Modification mod =
        new Modification(ModificationType.INCREMENT, "testCounter", "1");
   ModifyRequest modifyRequest =
        new ModifyRequest("uid=john.doe,ou=People,dc=example,dc=com", mod);
   modifyRequest.addControl(new PostReadRequestControl("testCounter"));
   LDAPResult modifyResult = connection.modify(modifyRequest);

   Integer newValue = null;
   PostReadResponseControl c = PostReadResponseControl.get(modifyResult);
   if (c != null)
   {
     newValue = c.getEntry().getAttributeValueAsInteger("testCounter");
   }
 

See Also:
Serialized Form

Field Summary
static java.lang.String POST_READ_REQUEST_OID
          The OID (1.3.6.1.1.13.2) for the post-read request control.
 
Constructor Summary
PostReadRequestControl(boolean isCritical, java.lang.String... attributes)
          Creates a new post-read request control that will retrieve the specified set of attributes from the target entry.
PostReadRequestControl(Control control)
          Creates a new post-read request control which is decoded from the provided generic control.
PostReadRequestControl(java.lang.String... attributes)
          Creates a new post-read request control that will retrieve the specified set of attributes from the target entry.
 
Method Summary
 java.lang.String[] getAttributes()
          Retrieves the set of attributes that will be requested for inclusion in the entry returned in the response control.
 java.lang.String getControlName()
          Retrieves the user-friendly name for this control, if available.
 void toString(java.lang.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, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

POST_READ_REQUEST_OID

public static final java.lang.String POST_READ_REQUEST_OID
The OID (1.3.6.1.1.13.2) for the post-read request control.

See Also:
Constant Field Values
Constructor Detail

PostReadRequestControl

public PostReadRequestControl(java.lang.String... attributes)
Creates a new post-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 or null, then all user attributes will be returned.

PostReadRequestControl

public PostReadRequestControl(boolean isCritical,
                              java.lang.String... attributes)
Creates a new post-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 or null, then all user attributes will be returned.

PostReadRequestControl

public PostReadRequestControl(Control control)
                       throws LDAPException
Creates a new post-read request control which is decoded from the provided generic control.

Parameters:
control - The generic control to be decoded as a post-read request control.
Throws:
LDAPException - If the provided control cannot be decoded as a post-read request control.
Method Detail

getAttributes

public java.lang.String[] 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

public java.lang.String 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:
getControlName in class Control
Returns:
The user-friendly name for this control, or the OID if no user-friendly name is available.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer.

Overrides:
toString in class Control
Parameters:
buffer - The buffer to which to append the string representation of this buffer.