@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class AssertionRequestControl extends Control
ResultCode.ASSERTION_FAILED
result.
Modification mod = new Modification(ModificationType.REPLACE, "accountBalance", "543.21"); ModifyRequest modifyRequest = new ModifyRequest("uid=john.doe,ou=People,dc=example,dc=com", mod); modifyRequest.addControl( new AssertionRequestControl("(accountBalance=1234.56)")); LDAPResult modifyResult; try { modifyResult = connection.modify(modifyRequest); // If we've gotten here, then the modification was successful. } catch (LDAPException le) { modifyResult = le.toLDAPResult(); ResultCode resultCode = le.getResultCode(); String errorMessageFromServer = le.getDiagnosticMessage(); if (resultCode == ResultCode.ASSERTION_FAILED) { // The modification failed because the account balance value wasn't // what we thought it was. } else { // The modification failed for some other reason. } }
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASSERTION_REQUEST_OID
The OID (1.3.6.1.1.12) for the assertion request control.
|
Constructor and Description |
---|
AssertionRequestControl(Control control)
Creates a new assertion request control which is decoded from the provided
generic control.
|
AssertionRequestControl(Filter filter)
Creates a new assertion request control with the provided filter.
|
AssertionRequestControl(Filter filter,
boolean isCritical)
Creates a new assertion request control with the provided filter.
|
AssertionRequestControl(java.lang.String filter)
Creates a new assertion request control with the provided filter.
|
AssertionRequestControl(java.lang.String filter,
boolean isCritical)
Creates a new assertion request control with the provided filter.
|
Modifier and Type | Method and Description |
---|---|
static AssertionRequestControl |
generate(Entry sourceEntry,
java.lang.String... attributes)
Generates an assertion request control that may be used to help ensure
that some or all of the attributes in the specified entry have not changed
since it was read from the server.
|
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available.
|
Filter |
getFilter()
Retrieves the filter for this assertion control.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided
buffer.
|
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toString, writeTo
@NotNull public static final java.lang.String ASSERTION_REQUEST_OID
public AssertionRequestControl(@NotNull java.lang.String filter) throws LDAPException
filter
- The string representation of the filter for this assertion
control. It must not be null
.LDAPException
- If the provided filter string cannot be decoded as
a search filter.public AssertionRequestControl(@NotNull Filter filter)
filter
- The filter for this assertion control. It must not be
null
.public AssertionRequestControl(@NotNull java.lang.String filter, boolean isCritical) throws LDAPException
filter
- The string representation of the filter for this
assertion control. It must not be null
.isCritical
- Indicates whether this control should be marked
critical.LDAPException
- If the provided filter string cannot be decoded as
a search filter.public AssertionRequestControl(@NotNull Filter filter, boolean isCritical)
filter
- The filter for this assertion control. It must not be
null
.isCritical
- Indicates whether this control should be marked
critical.public AssertionRequestControl(@NotNull Control control) throws LDAPException
control
- The generic control to be decoded as an assertion request
control.LDAPException
- If the provided control cannot be decoded as an
assertion request control.@NotNull public static AssertionRequestControl generate(@NotNull Entry sourceEntry, @Nullable java.lang.String... attributes)
sourceEntry
- The entry from which to take the attributes to include
in the assertion request control. It must not be
null
and should have at least one attribute to
be included in the generated filter.attributes
- The names of the attributes to include in the
assertion request control. If this is empty or
null
, then all attributes in the provided
entry will be used.@NotNull public Filter getFilter()
@NotNull public java.lang.String getControlName()
getControlName
in class Control