code: private List<LdapEntry> getDescendants(String DN, int level) throws WIMException {
          int scope = SearchControls.ONELEVEL_SCOPE;
          if (level == 0) {
              scope = SearchControls.SUBTREE_SCOPE;
          }
  
          List<LdapEntry> descendants = new ArrayList<LdapEntry>();
  
          Set<LdapEntry> ldapEntries = iLdapConn.searchEntities(DN, "objectClass=*", null, scope, null, null, false, false);
          for (Iterator<LdapEntry> iter = ldapEntries.iterator(); iter.hasNext();) {
              LdapEntry entry = iter.next();
              descendants.add(entry);
          }
          return descendants;
      }
docs: Get all the descendants of the given DN.
  
  @param DN
  @param level
  @return
  @throws WIMException