Code example for SearchControls

Methods: setCountLimitsetReturningAttributessetReturningObjFlagsetSearchScopesetTimeLimit

0
    @Override 
    public List<?> call() throws Exception {
 
        ContextMapperCallbackHandler cmCallback =
                new NotNullContextMapperCallbackHandler(queryExecution.getContextMapper());
        SearchControls controls = new SearchControls();
 
        if (queryExecution.getReturningAttributes() != null) {
            controls.setReturningAttributes(queryExecution.getReturningAttributes());
        } 
        controls.setSearchScope(queryExecution.getSearchScope());
        controls.setCountLimit(resultcount);
        // Added this in order to prevent a warning saying: "the returning obj flag wasn't set, setting it to true" 
        controls.setReturningObjFlag(true);
        controls.setTimeLimit(Integer.parseInt(configuration.getProperty("config.LDAPQueryTimeout")) * 1000);
 
        ldapTemplate.search("",
                queryExecution.getFilter(),
                queryExecution.getDisplayFilter(),
                controls,
Experience pair programming with AI  Get Codota for Java