Search in sources :

Example 11 with InternalSearchOperation

use of org.opends.server.protocols.internal.InternalSearchOperation in project midpoint by Evolveum.

the class OpenDJController method dumpTreeLevel.

private void dumpTreeLevel(StringBuilder sb, String dn, int indent) throws DirectoryException {
    InternalSearchOperation op = getInternalConnection().processSearch(dn, SearchScope.SINGLE_LEVEL, DereferencePolicy.NEVER_DEREF_ALIASES, 100, 100, false, "(objectclass=*)", getSearchAttributes());
    for (SearchResultEntry searchEntry : op.getSearchEntries()) {
        ident(sb, indent);
        sb.append(searchEntry.getDN().getRDN());
        sb.append("\n");
        dumpTreeLevel(sb, searchEntry.getDN().toString(), indent + 1);
    }
}
Also used : InternalSearchOperation(org.opends.server.protocols.internal.InternalSearchOperation)

Example 12 with InternalSearchOperation

use of org.opends.server.protocols.internal.InternalSearchOperation in project midpoint by Evolveum.

the class OpenDJController method fetchEntry.

public Entry fetchEntry(String dn) throws DirectoryException {
    Validate.notNull(dn);
    InternalSearchOperation op = getInternalConnection().processSearch(dn, SearchScope.BASE_OBJECT, DereferencePolicy.NEVER_DEREF_ALIASES, 100, 100, false, "(objectclass=*)", getSearchAttributes());
    if (op.getEntriesSent() == 0) {
        return null;
    } else if (op.getEntriesSent() > 1) {
        AssertJUnit.fail("Found too many entries (" + op.getEntriesSent() + ") for dn " + dn);
    }
    return op.getSearchEntries().get(0);
}
Also used : InternalSearchOperation(org.opends.server.protocols.internal.InternalSearchOperation)

Example 13 with InternalSearchOperation

use of org.opends.server.protocols.internal.InternalSearchOperation in project midpoint by Evolveum.

the class OpenDJController method searchByEntryUuid.

// Generic utility methods
public Entry searchByEntryUuid(String entryUuid) throws DirectoryException {
    InternalSearchOperation op = getInternalConnection().processSearch("dc=example,dc=com", SearchScope.WHOLE_SUBTREE, DereferencePolicy.NEVER_DEREF_ALIASES, 100, 100, false, "(entryUUID=" + entryUuid + ")", getSearchAttributes());
    LinkedList<SearchResultEntry> searchEntries = op.getSearchEntries();
    if (searchEntries == null || searchEntries.isEmpty()) {
        return null;
    }
    if (searchEntries.size() > 1) {
        AssertJUnit.fail("Multiple matches for Entry UUID " + entryUuid + ": " + searchEntries);
    }
    return searchEntries.get(0);
}
Also used : InternalSearchOperation(org.opends.server.protocols.internal.InternalSearchOperation)

Aggregations

InternalSearchOperation (org.opends.server.protocols.internal.InternalSearchOperation)13 SMSException (com.sun.identity.sm.SMSException)7 ResultCode (org.forgerock.opendj.ldap.ResultCode)6 SearchRequest (org.opends.server.protocols.internal.SearchRequest)4 DirectoryException (org.opends.server.types.DirectoryException)4 SearchResultEntry (org.opends.server.types.SearchResultEntry)4 LinkedHashSet (java.util.LinkedHashSet)3 LinkedList (java.util.LinkedList)3 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)2 Test (org.testng.annotations.Test)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 SearchScope (org.forgerock.opendj.ldap.SearchScope)1