use of org.ldaptive.AddRequest in project cas by apereo.
the class LdapUtils method executeAddOperation.
/**
* Execute add operation boolean.
*
* @param connectionFactory the connection factory
* @param entry the entry
* @return true/false
* @throws LdapException the ldap exception
*/
public static boolean executeAddOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) throws LdapException {
try (Connection connection = createConnection(connectionFactory)) {
final AddOperation operation = new AddOperation(connection);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
return true;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
}
Aggregations