use of com.unboundid.ldap.sdk.unboundidds.controls.PermitUnindexedSearchRequestControl in project ldapsdk by pingidentity.
the class SubtreeDeleter method delete.
/**
* Attempts to delete the specified subtree using the current settings.
*
* @param connection
* The {@link LDAPInterface} instance to use to communicate with
* the directory server. While this may be an individual
* {@link LDAPConnection}, it may be better as a connection
* pool with automatic retry enabled so that it's more likely to
* succeed in the event that a connection becomes invalid or an
* operation experiences a transient failure. It must not be
* {@code null}.
* @param baseDN
* The base DN for the subtree to delete. It must not be
* {@code null}.
*
* @return An object with information about the results of the subtree
* delete processing.
*/
@NotNull()
public SubtreeDeleterResult delete(@NotNull final LDAPInterface connection, @NotNull final DN baseDN) {
final AtomicReference<RootDSE> rootDSE = new AtomicReference<>();
final boolean useSetSubtreeAccessibility = useSetSubtreeAccessibilityOperationIfAvailable && supportsExtendedRequest(connection, rootDSE, SetSubtreeAccessibilityExtendedRequest.SET_SUBTREE_ACCESSIBILITY_REQUEST_OID) && supportsExtendedRequest(connection, rootDSE, WhoAmIExtendedRequest.WHO_AM_I_REQUEST_OID);
final boolean usePagedResults = useSimplePagedResultsControlIfAvailable && supportsControl(connection, rootDSE, SimplePagedResultsControl.PAGED_RESULTS_OID);
final boolean useSubentries = useSubentriesControlIfAvailable && supportsControl(connection, rootDSE, DraftLDUPSubentriesRequestControl.SUBENTRIES_REQUEST_OID);
final List<Control> searchControls = new ArrayList<>(10);
searchControls.addAll(additionalSearchControls);
final List<Control> deleteControls = new ArrayList<>(10);
deleteControls.addAll(additionalDeleteControls);
if (useHardDeleteControlIfAvailable && supportsControl(connection, rootDSE, HardDeleteRequestControl.HARD_DELETE_REQUEST_OID)) {
deleteControls.add(new HardDeleteRequestControl(false));
}
if (useManageDSAITControlIfAvailable && supportsControl(connection, rootDSE, ManageDsaITRequestControl.MANAGE_DSA_IT_REQUEST_OID)) {
final ManageDsaITRequestControl c = new ManageDsaITRequestControl(false);
searchControls.add(c);
deleteControls.add(c);
}
if (usePermitUnindexedSearchControlIfAvailable && supportsControl(connection, rootDSE, PermitUnindexedSearchRequestControl.PERMIT_UNINDEXED_SEARCH_REQUEST_OID)) {
searchControls.add(new PermitUnindexedSearchRequestControl(false));
}
if (useReturnConflictEntriesRequestControlIfAvailable && supportsControl(connection, rootDSE, ReturnConflictEntriesRequestControl.RETURN_CONFLICT_ENTRIES_REQUEST_OID)) {
searchControls.add(new ReturnConflictEntriesRequestControl(false));
}
if (useSoftDeletedEntryAccessControlIfAvailable && supportsControl(connection, rootDSE, SoftDeletedEntryAccessRequestControl.SOFT_DELETED_ENTRY_ACCESS_REQUEST_OID)) {
searchControls.add(new SoftDeletedEntryAccessRequestControl(false, true, false));
}
return delete(connection, baseDN, deleteBaseEntry, useSetSubtreeAccessibility, usePagedResults, searchRequestSizeLimit, simplePagedResultsPageSize, useSubentries, searchControls, deleteControls, deleteRateLimiter);
}
use of com.unboundid.ldap.sdk.unboundidds.controls.PermitUnindexedSearchRequestControl in project ldapsdk by pingidentity.
the class LDAPSearch method getSearchControls.
/**
* Retrieves a list of the controls that should be used when processing search
* operations.
*
* @return A list of the controls that should be used when processing search
* operations.
*
* @throws LDAPException If a problem is encountered while generating the
* controls for a search request.
*/
@NotNull()
private List<Control> getSearchControls() {
final ArrayList<Control> controls = new ArrayList<>(10);
if (searchControl.isPresent()) {
controls.addAll(searchControl.getValues());
}
if (joinRequestControl != null) {
controls.add(joinRequestControl);
}
if (matchedValuesRequestControl != null) {
controls.add(matchedValuesRequestControl);
}
if (matchingEntryCountRequestControl != null) {
controls.add(matchingEntryCountRequestControl);
}
if (overrideSearchLimitsRequestControl != null) {
controls.add(overrideSearchLimitsRequestControl);
}
if (persistentSearchRequestControl != null) {
controls.add(persistentSearchRequestControl);
}
if (sortRequestControl != null) {
controls.add(sortRequestControl);
}
if (vlvRequestControl != null) {
controls.add(vlvRequestControl);
}
controls.addAll(routeToBackendSetRequestControls);
if (accountUsable.isPresent()) {
controls.add(new AccountUsableRequestControl(true));
}
if (getBackendSetID.isPresent()) {
controls.add(new GetBackendSetIDRequestControl(false));
}
if (getServerID.isPresent()) {
controls.add(new GetServerIDRequestControl(false));
}
if (includeReplicationConflictEntries.isPresent()) {
controls.add(new ReturnConflictEntriesRequestControl(true));
}
if (includeSoftDeletedEntries.isPresent()) {
final String valueStr = StaticUtils.toLowerCase(includeSoftDeletedEntries.getValue());
if (valueStr.equals("with-non-deleted-entries")) {
controls.add(new SoftDeletedEntryAccessRequestControl(true, true, false));
} else if (valueStr.equals("without-non-deleted-entries")) {
controls.add(new SoftDeletedEntryAccessRequestControl(true, false, false));
} else {
controls.add(new SoftDeletedEntryAccessRequestControl(true, false, true));
}
}
if (draftLDUPSubentries.isPresent()) {
controls.add(new DraftLDUPSubentriesRequestControl(true));
}
if (rfc3672Subentries.isPresent()) {
controls.add(new RFC3672SubentriesRequestControl(rfc3672Subentries.getValue()));
}
if (manageDsaIT.isPresent()) {
controls.add(new ManageDsaITRequestControl(true));
}
if (realAttributesOnly.isPresent()) {
controls.add(new RealAttributesOnlyRequestControl(true));
}
if (routeToServer.isPresent()) {
controls.add(new RouteToServerRequestControl(false, routeToServer.getValue(), false, false, false));
}
if (virtualAttributesOnly.isPresent()) {
controls.add(new VirtualAttributesOnlyRequestControl(true));
}
if (excludeBranch.isPresent()) {
final ArrayList<String> dns = new ArrayList<>(excludeBranch.getValues().size());
for (final DN dn : excludeBranch.getValues()) {
dns.add(dn.toString());
}
controls.add(new ExcludeBranchRequestControl(true, dns));
}
if (assertionFilter.isPresent()) {
controls.add(new AssertionRequestControl(assertionFilter.getValue(), true));
}
if (getEffectiveRightsAuthzID.isPresent()) {
final String[] attributes;
if (getEffectiveRightsAttribute.isPresent()) {
attributes = new String[getEffectiveRightsAttribute.getValues().size()];
for (int i = 0; i < attributes.length; i++) {
attributes[i] = getEffectiveRightsAttribute.getValues().get(i);
}
} else {
attributes = StaticUtils.NO_STRINGS;
}
controls.add(new GetEffectiveRightsRequestControl(true, getEffectiveRightsAuthzID.getValue(), attributes));
}
if (operationPurpose.isPresent()) {
controls.add(new OperationPurposeRequestControl(true, "ldapsearch", Version.NUMERIC_VERSION_STRING, "LDAPSearch.getSearchControls", operationPurpose.getValue()));
}
if (proxyAs.isPresent()) {
controls.add(new ProxiedAuthorizationV2RequestControl(proxyAs.getValue()));
}
if (proxyV1As.isPresent()) {
controls.add(new ProxiedAuthorizationV1RequestControl(proxyV1As.getValue()));
}
if (suppressOperationalAttributeUpdates.isPresent()) {
final EnumSet<SuppressType> suppressTypes = EnumSet.noneOf(SuppressType.class);
for (final String s : suppressOperationalAttributeUpdates.getValues()) {
if (s.equalsIgnoreCase("last-access-time")) {
suppressTypes.add(SuppressType.LAST_ACCESS_TIME);
} else if (s.equalsIgnoreCase("last-login-time")) {
suppressTypes.add(SuppressType.LAST_LOGIN_TIME);
} else if (s.equalsIgnoreCase("last-login-ip")) {
suppressTypes.add(SuppressType.LAST_LOGIN_IP);
}
}
controls.add(new SuppressOperationalAttributeUpdateRequestControl(suppressTypes));
}
if (rejectUnindexedSearch.isPresent()) {
controls.add(new RejectUnindexedSearchRequestControl());
}
if (permitUnindexedSearch.isPresent()) {
controls.add(new PermitUnindexedSearchRequestControl());
}
return controls;
}
Aggregations