Code example for SearchControls

0
     * @param searchFilter 
     *            filter this value from the base 
     */ 
    public boolean searchTest(String searchBase, String searchFilter) throws NamingException {
        // System.out.println("Base="+searchBase+" Filter="+searchFilter); 
        SearchControls searchcontrols = new SearchControls(SearchControls.SUBTREE_SCOPE,
                1L, // count limit 
                0, // time limit 
                null,// attributes (null = all) 
                false,// return object ? 
                false);// dereference links? 
        NamingEnumeration<?> ne = dirContext.search(searchBase, searchFilter, searchcontrols);
        // System.out.println("Loop "+ne.toString()+" "+ne.hasMore()); 
        // while (ne.hasMore()){ 
        // Object tmp = ne.next(); 
        // System.out.println(tmp.getClass().getName()); 
        // SearchResult sr = (SearchResult) tmp; 
        // Attributes at = sr.getAttributes(); 
        // System.out.println(at.get("cn")); 
        // }