Search in sources :

Example 1 with AddRequest

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;
}
Also used : AddRequest(org.ldaptive.AddRequest) Connection(org.ldaptive.Connection) AddOperation(org.ldaptive.AddOperation) LdapException(org.ldaptive.LdapException)

Aggregations

AddOperation (org.ldaptive.AddOperation)1 AddRequest (org.ldaptive.AddRequest)1 Connection (org.ldaptive.Connection)1 LdapException (org.ldaptive.LdapException)1