/** * Executes a {@link MergeOperation} with the supplied entry. * * @param entry to merge * * @return response for the merge operation * * @throws LdapException if the operation fails */ @Nonnull private Response<Void> merge(@Nonnull final LdapEntry entry) throws LdapException { Connection conn = null; try { conn = connectionFactory.getConnection(); final MergeOperation merge = new MergeOperation(conn); final MergeRequest request = new MergeRequest(entry); request.setIncludeAttributes(entry.getAttributeNames()); return merge.execute(request); } finally { conn.close(); } }
@Override public Response<Void> merge(final T object) throws LdapException { final LdapEntry entry = new LdapEntry(); getLdapEntryMapper().map(object, entry); final MergeRequest request = new MergeRequest(entry); try (Connection conn = getConnectionFactory().getConnection()) { conn.open(); final MergeOperation merge = new MergeOperation(conn); return merge.execute(request); } }