/** * 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(); } }
/** * Executes a {@link DeleteOperation} for the supplied entry. * * @param request merge request * @param entry to delete from the LDAP * * @return response of the delete operation * * @throws LdapException if an error occurs executing the deleting operation */ protected Response<Void> delete(final MergeRequest request, final LdapEntry entry) throws LdapException { final Response<Void> response; final DeleteOperation delete = new DeleteOperation(getConnection()); response = delete.execute(new DeleteRequest(entry.getDn())); logger.info("delete entry {} for request {}", entry, request); return response; } }
final SearchOperation search = new SearchOperation(getConnection()); searchResponse = search.execute( SearchRequest.newObjectScopeSearchRequest(sourceEntry.getDn(), request.getSearchAttributes())); } else { response = add(request, sourceEntry); response = delete(request, sourceEntry); } else { response = modify(request, sourceEntry, searchResponse.getResult().getEntry());
final SearchOperation search = new SearchOperation(getConnection()); searchResponse = search.execute( SearchRequest.newObjectScopeSearchRequest(sourceEntry.getDn(), request.getSearchAttributes())); } else { response = add(request, sourceEntry); response = delete(request, sourceEntry); } else { response = modify(request, sourceEntry, searchResponse.getResult().getEntry());
final SearchOperation search = new SearchOperation(getConnection()); searchResponse = search.execute( SearchRequest.newObjectScopeSearchRequest(sourceEntry.getDn(), request.getSearchAttributes())); } else { response = add(request, sourceEntry); response = delete(request, sourceEntry); } else { response = modify(request, sourceEntry, searchResponse.getResult().getEntry());
/** * Executes a {@link DeleteOperation} for the supplied entry. * * @param request merge request * @param entry to delete from the LDAP * * @return response of the delete operation * * @throws LdapException if an error occurs executing the deleting operation */ protected Response<Void> delete(final MergeRequest request, final LdapEntry entry) throws LdapException { Response<Void> response; final DeleteOperation delete = new DeleteOperation(getConnection()); response = delete.execute(new DeleteRequest(entry.getDn())); logger.info("delete entry {} for request {}", entry, request); return response; } }
@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); } }
/** * Executes a {@link DeleteOperation} for the supplied entry. * * @param request merge request * @param entry to delete from the LDAP * * @return response of the delete operation * * @throws LdapException if an error occurs executing the deleting operation */ protected Response<Void> delete(final MergeRequest request, final LdapEntry entry) throws LdapException { final Response<Void> response; final DeleteOperation delete = new DeleteOperation(getConnection()); response = delete.execute(new DeleteRequest(entry.getDn())); logger.info("delete entry {} for request {}", entry, request); return response; } }
/** * Executes an {@link AddOperation} for the supplied entry. * * @param request merge request * @param entry to add to the LDAP * * @return response of the add operation * * @throws LdapException if an error occurs executing the add operation */ protected Response<Void> add(final MergeRequest request, final LdapEntry entry) throws LdapException { final Response<Void> response; final AddOperation add = new AddOperation(getConnection()); response = add.execute(new AddRequest(entry.getDn(), entry.getAttributes())); logger.info("added entry {} for request {}", entry, request); return response; }
/** * Executes an {@link AddOperation} for the supplied entry. * * @param request merge request * @param entry to add to the LDAP * * @return response of the add operation * * @throws LdapException if an error occurs executing the add operation */ protected Response<Void> add(final MergeRequest request, final LdapEntry entry) throws LdapException { Response<Void> response; final AddOperation add = new AddOperation(getConnection()); response = add.execute(new AddRequest(entry.getDn(), entry.getAttributes())); logger.info("added entry {} for request {}", entry, request); return response; }
request); final ModifyOperation modify = new ModifyOperation(getConnection()); response = modify.execute( new ModifyRequest(
/** * Executes an {@link AddOperation} for the supplied entry. * * @param request merge request * @param entry to add to the LDAP * * @return response of the add operation * * @throws LdapException if an error occurs executing the add operation */ protected Response<Void> add(final MergeRequest request, final LdapEntry entry) throws LdapException { final Response<Void> response; final AddOperation add = new AddOperation(getConnection()); response = add.execute(new AddRequest(entry.getDn(), entry.getAttributes())); logger.info("added entry {} for request {}", entry, request); return response; }
request); final ModifyOperation modify = new ModifyOperation(getConnection()); response = modify.execute( new ModifyRequest(
request); final ModifyOperation modify = new ModifyOperation(getConnection()); response = modify.execute( new ModifyRequest(