BBjLDAPSearchResult

Description

In BBj 11.00 and higher, BBjLDAPSearchResult provides a data structure for holding information about the result of processing a search request. This includes the list of BBjLDAPEntry objects, one for each matching result.

Creation

BBjAPI > BBjLDAPConnection > BBjLDAPSearchResult

Obtain a BBjLDAPSearchResult object through the following BBjLDAPConnection method:

Return Value Method
BBjLDAPSearchResult search(string baseDN, int scope, int sizeLimit, int timeLimit, string filter)

Methods of BBjLDAPSearchResult

Return Value Method
int getEntryCount()
BBjVector getSearchEntries()

Constants

Constant Description
SCOPE_ONE Indicates that only entries that are immediate subordinates of the entry specified by the base DN (but not the base entry itself) should be considered.
SCOPE_BASE Indicates that only the entry specified by the base DN should be considered.
SCOPE_SUB Indicates that the base entry itself and any subordinate entries (to any depth) should be considered.
SCOPE_SUBORDINATE_SUBTREE Indicates that any subordinate entries (to any depth) below the entry specified by the base DN should be considered, but the base entry itself should not be considered, as described in draft-sermersheim-ldap-subordinate-scope

Example

rem ' getLDAPConnection sample 1

use com.basis.bbj.proxies.ldap.BBjLDAPSearchResult
use com.basis.bbj.proxies.ldap.BBjLDAPConnection
declare BBjLDAPConnection ldapCon!
declare BBjLDAPSearchResult searchResults!
declare BBjVector entries!
declare BBjVector attrs!

rem 'Get a connection to a specific LDAP server
host$ = "localhost"
port = 10389
authDN$ = "uid=admin,ou=system"
pwd$ = "secret"
ldapCon! = BBjAPI().getLDAPConnection(host$, port, authDN$, pwd$)

rem 'return a list of all immediate children of the ou=system object
searchResults! = ldapCon!.search("ou=system",BBjLDAPSearchResult.SCOPE_ONE, 100, 100, "(objectClass=*)")
entries! = searchResults!.getSearchEntries()
for e = 0 to entries!.size() - 1
    entry! = entries!.getItem(e)
    print "ENTRY - dn: " + entry!.getDN()
    attrs! = entry!.getAttributeNames()
    for i = 0 to attrs!.size() - 1
        attr$ = attrs!.getItem(i)
        print " " + attr$
    next i
next e

rem 'Unbind and close the connection
ldapCon!.close()

See Also

Using LDAP and Active Directory User Authentication in BBj 15.00 and Higher

Object Variables

BBj Object Creation and Assignment

BBj Object Error Handling

BBj Object Operators

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.