use of com.novell.ldap.LDAPModification in project ldapchai by ldapchai.
the class JLDAPProviderImpl method writeBinaryAttribute.
@ChaiProvider.LdapOperation
@ChaiProvider.ModifyOperation
public void writeBinaryAttribute(final String entryDN, final String attribute, final byte[][] values, final boolean overwrite, final ChaiRequestControl[] controls) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException {
activityPreCheck();
getInputValidator().writeBinaryAttribute(entryDN, attribute, values, overwrite);
final LDAPAttribute ldapAttr = new LDAPAttribute(attribute);
for (final byte[] value : values) {
ldapAttr.addValue(value);
}
final LDAPModification mod = new LDAPModification(overwrite ? LDAPModification.REPLACE : LDAPModification.ADD, ldapAttr);
try {
if (controls != null && controls.length > 0) {
final LDAPConstraints constraints = new LDAPConstraints();
constraints.setControls(convertControls(controls));
ldapConnection.modify(entryDN, mod, constraints);
} else {
ldapConnection.modify(entryDN, mod);
}
} catch (LDAPException e) {
throw ChaiOperationException.forErrorMessage(e.getLDAPErrorMessage());
}
}
Aggregations