@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ searchFilter: '").append(searchFilter).append("', "); sb.append("searchBase: '").append(searchBase).append("'"); sb.append(", scope: ") .append(searchControls.getSearchScope() == SearchControls.SUBTREE_SCOPE ? "subtree" : "single-level, "); sb.append(", searchTimeLimit: ").append(searchControls.getTimeLimit()); sb.append(", derefLinkFlag: ").append(searchControls.getDerefLinkFlag()) .append(" ]"); return sb.toString(); } }
/** * We need to make sure the search controls has the return object flag set to true, in * order for the search to return DirContextAdapter instances. * @param originalControls * @return */ private static SearchControls buildControls(SearchControls originalControls) { return new SearchControls(originalControls.getSearchScope(), originalControls.getCountLimit(), originalControls.getTimeLimit(), originalControls.getReturningAttributes(), RETURN_OBJECT, originalControls.getDerefLinkFlag()); }
/** * We need to make sure the search controls has the return object flag set to true, in order for * the search to return DirContextAdapter instances. * @param originalControls * @return */ private static SearchControls buildControls(SearchControls originalControls) { return new SearchControls(originalControls.getSearchScope(), originalControls.getCountLimit(), originalControls.getTimeLimit(), originalControls.getReturningAttributes(), RETURN_OBJECT, originalControls.getDerefLinkFlag()); }
/** * @see javax.naming.directory.SearchControls#getTimeLimit() * @deprecated Set the property on the {@link SearchControls} and set that via {@link #setSearchControls(SearchControls)} */ @Deprecated public int getTimeLimit() { return this.searchControls.getTimeLimit(); }
/** * @see javax.naming.directory.SearchControls#getTimeLimit() * @return time limit * @deprecated Set the property on the {@link SearchControls} and set that via {@link #setSearchControls(SearchControls)} */ @Deprecated public int getTimeLimit() { return this.searchControls.getTimeLimit(); }
/** * @see javax.naming.directory.SearchControls#getTimeLimit() * @deprecated Set the property on the {@link SearchControls} and set that via {@link #setSearchControls(SearchControls)} */ @Deprecated public int getTimeLimit() { return this.searchControls.getTimeLimit(); }
/** * @see javax.naming.directory.SearchControls#getTimeLimit() * @return time limit * @deprecated Set the property on the {@link SearchControls} and set that via {@link #setSearchControls(SearchControls)} */ @Deprecated public int getTimeLimit() { return this.searchControls.getTimeLimit(); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("[ searchFilter: '").append(searchFilter).append("', "); sb.append("searchBase: '").append(searchBase).append("'"); sb.append(", scope: ") .append(searchControls.getSearchScope() == SearchControls.SUBTREE_SCOPE ? "subtree" : "single-level, "); sb.append("searchTimeLimit: ").append(searchControls.getTimeLimit()); sb.append("derefLinkFlag: ").append(searchControls.getDerefLinkFlag()).append(" ]"); return sb.toString(); } }
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ searchFilter: '").append(searchFilter).append("', "); sb.append("searchBase: '").append(searchBase).append("'"); sb.append(", scope: ") .append(searchControls.getSearchScope() == SearchControls.SUBTREE_SCOPE ? "subtree" : "single-level, "); sb.append(", searchTimeLimit: ").append(searchControls.getTimeLimit()); sb.append(", derefLinkFlag: ").append(searchControls.getDerefLinkFlag()).append(" ]"); return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ searchFilter: '").append(searchFilter).append("', "); sb.append("searchBase: '").append(searchBase).append("'"); sb.append(", scope: ") .append(searchControls.getSearchScope() == SearchControls.SUBTREE_SCOPE ? "subtree" : "single-level, "); sb.append(", searchTimeLimit: ").append(searchControls.getTimeLimit()); sb.append(", derefLinkFlag: ").append(searchControls.getDerefLinkFlag()) .append(" ]"); return sb.toString(); } }
public boolean accept( Invocation invocation, SearchResult result, SearchControls controls ) throws NamingException { if ( controls.getTimeLimit() > 0 ) { long runtime = System.currentTimeMillis() - startTime; if ( runtime > controls.getTimeLimit() ) { throw new LdapTimeLimitExceededException(); } } if ( controls.getCountLimit() > 0 ) { if ( count > controls.getCountLimit() ) { throw new LdapSizeLimitExceededException(); } } count++; return true; } } );
/** * We need to make sure the search controls has the return object flag set to true, in * order for the search to return DirContextAdapter instances. * @param originalControls * @return */ private static SearchControls buildControls(SearchControls originalControls) { return new SearchControls(originalControls.getSearchScope(), originalControls.getCountLimit(), originalControls.getTimeLimit(), originalControls.getReturningAttributes(), RETURN_OBJECT, originalControls.getDerefLinkFlag()); }
/** * Creates a search request from a search filter. * * @param filter LDAP search filter. * @return ldaptive search request. */ private SearchRequest createRequest(final SearchFilter filter) { final SearchRequest request = new SearchRequest(); request.setBaseDn(this.baseDN); request.setSearchFilter(filter); /** LDAP attributes to fetch from search results. */ if (getResultAttributeMapping() != null && !getResultAttributeMapping().isEmpty()) { final String[] attributes = getResultAttributeMapping().keySet().toArray(new String[getResultAttributeMapping().size()]); request.setReturnAttributes(attributes); } else if (searchControls.getReturningAttributes() != null && searchControls.getReturningAttributes().length > 0) { request.setReturnAttributes(searchControls.getReturningAttributes()); } else { request.setReturnAttributes(ReturnAttributes.ALL_USER.value()); } request.setSearchScope(this.searchScope); request.setSizeLimit(this.searchControls.getCountLimit()); request.setTimeLimit(Duration.ofSeconds(searchControls.getTimeLimit())); return request; }
/** * Creates a search request from a search filter. * * @param filter LDAP search filter. * * @return ldaptive search request. */ private SearchRequest createRequest(final SearchFilter filter) { final SearchRequest request = new SearchRequest(); request.setBaseDn(this.baseDN); request.setSearchFilter(filter); request.setReturnAttributes(this.attributes); request.setSearchScope(this.searchScope); request.setSizeLimit(this.searchControls.getCountLimit()); request.setTimeLimit(this.searchControls.getTimeLimit()); return request; }
/** * Creates a new instance of SearchOperationContext. * * @param session The session to use * @param dn the dn of the search base * @param filter the filter AST to use for the search * @param searchControls the search controls */ public SearchOperationContext( CoreSession session, Dn dn, ExprNode filter, SearchControls searchControls ) { super( session, dn, searchControls.getReturningAttributes() ); this.filter = filter; scope = SearchScope.getSearchScope( searchControls.getSearchScope() ); timeLimit = searchControls.getTimeLimit(); sizeLimit = searchControls.getCountLimit(); typesOnly = searchControls.getReturningObjFlag(); if ( session != null ) { setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) ); } }
@Override public boolean matches(Object item) { if (item instanceof SearchControls) { SearchControls s1 = (SearchControls) item; return controls.getSearchScope() == s1.getSearchScope() && controls.getReturningObjFlag() == s1.getReturningObjFlag() && controls.getDerefLinkFlag() == s1.getDerefLinkFlag() && controls.getCountLimit() == s1.getCountLimit() && controls.getTimeLimit() == s1.getTimeLimit() && controls.getReturningAttributes() == s1.getReturningAttributes(); } else { throw new IllegalArgumentException(); } }
public static SearchParams toSearchParams( SearchControls searchControls, AliasDerefMode aliasDerefMode ) { SearchParams searchParams = new SearchParams(); searchParams.setAliasDerefMode( aliasDerefMode ); searchParams.setTimeLimit( searchControls.getTimeLimit() ); searchParams.setSizeLimit( searchControls.getCountLimit() ); searchParams.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) ); searchParams.setTypesOnly( searchControls.getReturningObjFlag() ); if ( searchControls.getReturningAttributes() != null ) { for ( String returningAttribute : searchControls.getReturningAttributes() ) { searchParams.addReturningAttributes( returningAttribute ); } } searchParams.searchControls = searchControls; return searchParams; }
/** * Creates a {@link SearchParams} from JNDI search controls. * * @param searchControls the search controls * @param aliasDerefMode the alias deref mode * @return the search params */ public static SearchParams toSearchParams( SearchControls searchControls, AliasDerefMode aliasDerefMode ) { SearchParams searchParams = new SearchParams(); searchParams.setAliasDerefMode( aliasDerefMode ); searchParams.setTimeLimit( searchControls.getTimeLimit() ); searchParams.setSizeLimit( searchControls.getCountLimit() ); searchParams.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) ); searchParams.setTypesOnly( searchControls.getReturningObjFlag() ); if ( searchControls.getReturningAttributes() != null ) { for ( String returningAttribute : searchControls.getReturningAttributes() ) { searchParams.addReturningAttributes( returningAttribute ); } } return searchParams; }
/** * Creates a {@link SearchParams} from JNDI search controls. * * @param searchControls the search controls * @param aliasDerefMode the alias deref mode * @return the search params */ public static SearchParams toSearchParams( SearchControls searchControls, AliasDerefMode aliasDerefMode ) { SearchParams searchParams = new SearchParams(); searchParams.setAliasDerefMode( aliasDerefMode ); searchParams.setTimeLimit( searchControls.getTimeLimit() ); searchParams.setSizeLimit( searchControls.getCountLimit() ); searchParams.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) ); searchParams.setTypesOnly( searchControls.getReturningObjFlag() ); if ( searchControls.getReturningAttributes() != null ) { for ( String returningAttribute : searchControls.getReturningAttributes() ) { searchParams.addReturningAttributes( returningAttribute ); } } return searchParams; }
/** * Creates a {@link SearchParams} from JNDI search controls. * * @param searchControls the search controls * @param aliasDerefMode the alias deref mode * @return the search params */ public static SearchParams toSearchParams( SearchControls searchControls, AliasDerefMode aliasDerefMode ) { SearchParams searchParams = new SearchParams(); searchParams.setAliasDerefMode( aliasDerefMode ); searchParams.setTimeLimit( searchControls.getTimeLimit() ); searchParams.setSizeLimit( searchControls.getCountLimit() ); searchParams.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) ); searchParams.setTypesOnly( searchControls.getReturningObjFlag() ); if ( searchControls.getReturningAttributes() != null ) { for ( String returningAttribute : searchControls.getReturningAttributes() ) { searchParams.addReturningAttributes( returningAttribute ); } } return searchParams; }