本文整理汇总了Java中org.apache.directory.api.ldap.model.message.SearchScope类的典型用法代码示例。如果您正苦于以下问题:Java SearchScope类的具体用法?Java SearchScope怎么用?Java SearchScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SearchScope类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了SearchScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRequestWithScopeBaseObject
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Test parsing of a request with scope attribute to BaseObject value
* @throws NamingException
*/
@Test
public void testRequestWithScopeBaseObject()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( SearchRequestTest.class.getResource( "request_with_scope_baseObject.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
assertEquals( SearchScope.OBJECT, searchRequest.getScope() );
}
示例2: testRequestWithScopeSingleLevel
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Test parsing of a request with scope attribute to SingleLevel value
* @throws NamingException
*/
@Test
public void testRequestWithScopeSingleLevel()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( SearchRequestTest.class.getResource( "request_with_scope_singleLevel.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
assertEquals( SearchScope.ONELEVEL, searchRequest.getScope() );
}
示例3: testRequestWithScopeWholeSubtree
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Test parsing of a request with scope attribute to WholeSubtree value
* @throws NamingException
*/
@Test
public void testRequestWithScopeWholeSubtree()
{
Dsmlv2Parser parser = null;
try
{
parser = newParser();
parser.setInput( SearchRequestTest.class.getResource( "request_with_scope_wholeSubtree.xml" ).openStream(),
"UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();
assertEquals( SearchScope.SUBTREE, searchRequest.getScope() );
}
示例4: testDnSetScope
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* test the setScope() method
*/
@Test
public void testDnSetScope() throws LdapURLEncodingException, LdapInvalidDnException
{
LdapUrl url = new LdapUrl();
assertEquals( SearchScope.OBJECT, url.getScope() );
url.setDn( new Dn( "dc=example,dc=com" ) );
url.setScope( SearchScope.ONELEVEL );
assertEquals( SearchScope.ONELEVEL, url.getScope() );
assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );
url.setScope( SearchScope.SUBTREE );
assertEquals( SearchScope.SUBTREE, url.getScope() );
assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );
url.setScope( -1 );
assertEquals( SearchScope.OBJECT, url.getScope() );
assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
示例5: search
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public EntryCursor search( Dn baseDn, String filter, SearchScope scope, String... attributes )
throws LdapException
{
if ( baseDn == null )
{
LOG.debug( "received a null dn for a search" );
throw new IllegalArgumentException( "The base Dn cannot be null" );
}
// Create a new SearchRequest object
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( baseDn );
searchRequest.setFilter( filter );
searchRequest.setScope( scope );
searchRequest.addAttributes( attributes );
searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );
// Process the request in blocking mode
return new EntryCursorImpl( search( searchRequest ) );
}
示例6: searchAsync
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public SearchFuture searchAsync( Dn baseDn, String filter, SearchScope scope, String... attributes )
throws LdapException
{
// Create a new SearchRequest object
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( baseDn );
searchRequest.setFilter( filter );
searchRequest.setScope( scope );
searchRequest.addAttributes( attributes );
searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );
// Process the request in blocking mode
return searchAsync( searchRequest );
}
示例7: newSearchRequest
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public SearchRequest newSearchRequest( Dn baseDn, String filter,
SearchScope scope, String... attributes )
{
SearchRequest searchRequest = null;
try
{
searchRequest = new SearchRequestImpl()
.setBase( baseDn )
.setFilter( filter )
.setScope( scope == null ? SearchScope.OBJECT : scope );
if ( attributes != null && attributes.length > 0 )
{
searchRequest.addAttributes( attributes );
}
}
catch ( LdapException e )
{
throw new LdapRuntimeException( e );
}
return searchRequest;
}
示例8: queryEntrys
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* 查询条目。
*
* 只用于用 @Ldap 注解的Java对象。
*
* @author ZhengWei(HY)
* @createDate 2017-02-17
* @version v1.0
*
* @param i_DN 条目标识
* @param i_SearchScope 查询范围
* 搜索范围01:SearchScope.OBJECT 返回输入给定DN,如果它存在的话。
* 搜索范围02:SearchScope.ONELEVEL 返回低于目前DN的所有子元素,不包括当前DN,也不包括与当前DN无直接关系的DN,即树目录深度为1。
* 搜索范围03:SearchScope.SUBTREE 返回所有元素从给出的DN,包括与DN相关的元素,无论树的深度。
* @return
*/
private List<?> queryEntrys(Object i_Values ,SearchScope i_SearchScope)
{
LdapEntry v_LdapEntry = getLdapEntry(i_Values.getClass());
if ( v_LdapEntry == null )
{
return new ArrayList<Object>();
}
try
{
return this.queryEntrys(v_LdapEntry.getDNValue(i_Values) ,i_SearchScope);
}
catch (Exception exce)
{
exce.printStackTrace();
}
return new ArrayList<Object>();
}
示例9: setScope
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public SearchRequest setScope( SearchScope scope )
{
getDecorated().setScope( scope );
return this;
}
示例10: LdapUrl
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Construct an empty LdapUrl
*/
public LdapUrl()
{
scheme = LDAP_SCHEME;
host = null;
port = -1;
dn = null;
attributes = new ArrayList<>();
scope = SearchScope.OBJECT;
filter = null;
extensionList = new ArrayList<>( 2 );
}
示例11: setScope
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Sets the scope. Must be one of {@link SearchScope#OBJECT},
* {@link SearchScope#ONELEVEL} or {@link SearchScope#SUBTREE},
* otherwise {@link SearchScope#OBJECT} is assumed as default.
*
* @param scope the new scope
*/
public void setScope( int scope )
{
try
{
this.scope = SearchScope.getSearchScope( scope );
}
catch ( IllegalArgumentException iae )
{
this.scope = SearchScope.OBJECT;
}
}
示例12: ScopeNode
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* Creates a new ScopeNode object.
*
* @param aliasDerefAliases the alias dereferencing mode
* @param baseDn the search base
* @param baseId the search ID
* @param scope the search scope
*/
public ScopeNode( AliasDerefMode aliasDerefAliases, Dn baseDn, String baseId, SearchScope scope )
{
super( AssertionType.SCOPE );
this.scope = scope;
this.baseDn = baseDn;
this.aliasDerefAliases = aliasDerefAliases;
this.baseId = baseId;
}
示例13: search
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public EntryCursor search( Dn baseDn, String filter, SearchScope scope, String... attributes )
throws LdapException
{
return connection.search( baseDn, filter, scope, attributes );
}
示例14: authenticate
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public PasswordWarning authenticate( String baseDn, String filter, SearchScope scope, char[] password )
throws PasswordException
{
return authenticate( newSearchRequest( baseDn, filter, scope ), password );
}
示例15: search
import org.apache.directory.api.ldap.model.message.SearchScope; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public <T> List<T> search( String baseDn, FilterBuilder filter, SearchScope scope,
EntryMapper<T> entryMapper )
{
return search(
modelFactory.newSearchRequest( baseDn, filter, scope ),
entryMapper );
}