use of com.unboundid.ldap.sdk.ModifyRequest in project zm-mailbox by Zimbra.
the class UBIDLdapContext method testAndModifyAttributes.
@Override
public boolean testAndModifyAttributes(String dn, ZModificationList modList, ZLdapFilter testFilter) throws LdapException {
try {
ModifyRequest modReq = new ModifyRequest(dn, ((UBIDModificationList) modList).getModList());
modReq.addControl(new AssertionRequestControl(((UBIDLdapFilter) testFilter).getNative()));
LDAPResult result = UBIDLdapOperation.TEST_AND_MODIFY_ATTRS.execute(this, modReq);
return true;
} catch (LDAPException e) {
if (e.getResultCode() == ResultCode.ASSERTION_FAILED) {
// The modification failed because the the filter does not match the target entry
return false;
} else {
// The modification failed for some other reason.
throw mapToLdapException("unable to test and modify attributes", e);
}
}
}
Aggregations