Code example for SearchControls

Methods: setReturningAttributessetSearchScope

0
     * @return the subschemaSubentry distinguished name 
     * @throws NamingException if there are problems accessing the RootDSE 
     */ 
    private String getSubschemaSubentryDN() throws ExceptionSearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
        controls.setReturningAttributes( new String[]
            { SUBSCHEMA_SUBENTRY } );
 
        NamingEnumeration<SearchResult> results = getRootContext( getService() ).search( "", "(objectClass=*)",
            controls );
        SearchResult result = results.next();
        results.close();
        Attribute subschemaSubentry = result.getAttributes().get( SUBSCHEMA_SUBENTRY );
        return ( String ) subschemaSubentry.get();
    } 
 
 
    /** 
Contextual code suggestions in your IDE  Get Codota for Java