当前位置: 首页>>代码示例>>Java>>正文


Java ExprNode类代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.filter.ExprNode的典型用法代码示例。如果您正苦于以下问题:Java ExprNode类的具体用法?Java ExprNode怎么用?Java ExprNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExprNode类属于org.apache.directory.api.ldap.model.filter包,在下文中一共展示了ExprNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: action

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    // Adding the filter to the Search Filter
    SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
        container.getBatchRequest().getCurrentRequest();
    SearchRequest searchRequest = searchRequestDecorator.getDecorated();

    try
    {
        ExprNode exprNode = searchRequestDecorator.getFilterNode();
        
        if ( exprNode == null )
        {
            throw new IllegalStateException( "No filter element present in the DSML search request" );
        }
        
        searchRequest.setFilter( exprNode );
    }
    catch ( LdapSchemaException lse )
    {
        
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:Dsmlv2Grammar.java

示例2: testRequestWithAndFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an And Filter
 */
@Test
public void testRequestWithAndFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_and.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof AndNode );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:SearchRequestTest.java

示例3: testRequestWithOrFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an Or Filter
 */
@Test
public void testRequestWithOrFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser
            .setInput( SearchRequestTest.class.getResource( "filters/request_with_or.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof OrNode );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:SearchRequestTest.java

示例4: testRequestWithNotFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an Or Filter
 */
@Test
public void testRequestWithNotFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_not.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof NotNode );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:SearchRequestTest.java

示例5: BaseSubtreeSpecification

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Creates a subtree which may be a refinement filter where all aspects of
 * the specification can be set. If the refinement filter is null this
 * defaults to {@link #BaseSubtreeSpecification(org.apache.directory.api.ldap.model.name.Dn, int, int, Set, Set)}.
 *
 * @param base the base of the subtree relative to the administrative point
 * @param minBaseDistance the minimum distance below base to start including entries
 * @param maxBaseDistance the maximum distance from base past which entries are excluded
 * @param chopAfter the set of subordinates entries whose subordinates are to be
 * excluded
 * @param chopBefore the set of subordinates entries and their subordinates to
 * exclude
 * @param refinement the filter expression only composed of objectClass attribute
 * value assertions
 */
public BaseSubtreeSpecification( Dn base, int minBaseDistance, int maxBaseDistance,
    Set<Dn> chopAfter, Set<Dn> chopBefore, ExprNode refinement )
{
    this.base = base;
    this.minBaseDistance = minBaseDistance;

    if ( maxBaseDistance < 0 )
    {
        this.maxBaseDistance = UNBOUNDED_MAX;
    }
    else
    {
        this.maxBaseDistance = maxBaseDistance;
    }

    this.chopAfter = chopAfter;
    this.chopBefore = chopBefore;
    this.refinement = refinement;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:BaseSubtreeSpecification.java

示例6: search

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public EntryFilteringCursor search( Dn dn, String filter, boolean ignoreReferrals ) throws LdapException
{
    OperationManager operationManager = directoryService.getOperationManager();
    ExprNode filterNode = null;

    try
    {
        filterNode = FilterParser.parse( directoryService.getSchemaManager(), filter );
    }
    catch ( ParseException pe )
    {
        throw new LdapInvalidSearchFilterException( pe.getMessage() );
    }

    SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
        ( String ) null );
    searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
    setReferralHandling( searchContext, ignoreReferrals );

    return operationManager.search( searchContext );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:DefaultCoreSession.java

示例7: search

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Cursor<Entry> search( Dn dn, String filter, boolean ignoreReferrals ) throws LdapException
{
    OperationManager operationManager = directoryService.getOperationManager();
    ExprNode filterNode = null;

    try
    {
        filterNode = FilterParser.parse( directoryService.getSchemaManager(), filter );
    }
    catch ( ParseException pe )
    {
        throw new LdapInvalidSearchFilterException( pe.getMessage() );
    }

    SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
        ( String ) null );
    searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
    setReferralHandling( searchContext, ignoreReferrals );

    return operationManager.search( searchContext );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:DefaultCoreSession.java

示例8: searchByUid

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Returns a complete object based on ICF UID.
 * 
 * This is different from resolveDn() method in that it returns a complete object.
 * The resolveDn() method is supposed to be optimized to only return DN.
 */
protected SearchStrategy<C> searchByUid(Uid uid, ObjectClass objectClass, org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
		ResultsHandler handler, OperationOptions options) {
	String uidValue = SchemaUtil.getSingleStringNonBlankValue(uid);
	if (LdapUtil.isDnAttribute(configuration.getUidAttribute())) {
		return searchByDn(schemaTranslator.toDn(uidValue), objectClass, ldapObjectClass, handler, options);
	} else {
		// We know that this can return at most one object. Therefore always use simple search.
		SearchStrategy<C> searchStrategy = getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
		String[] attributesToGet = getAttributesToGet(ldapObjectClass, options);
		SearchScope scope = getScope(options);			
		ExprNode filterNode = LdapUtil.createUidSearchFilter(uidValue, ldapObjectClass, getSchemaTranslator());
		Dn baseDn = getBaseDn(options);
		checkBaseDnPresent(baseDn);
		try {
			searchStrategy.search(baseDn, filterNode, scope, attributesToGet);
		} catch (LdapException e) {
			throw processLdapException("Error searching for UID '"+uidValue+"'", e);
		}
		
		return searchStrategy;
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:29,代码来源:AbstractLdapConnector.java

示例9: translate

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Translate filter, also add AND statement for objectClass.
 */
public ScopedFilter translate(Filter icfFilter, ObjectClass ldapObjectClass) {
	ScopedFilter plainScopedFilter = translate(icfFilter);
	EqualityNode<String> objectClassEqFilter = createObjectClassEqFilter(ldapObjectClass);
	if (plainScopedFilter == null) {
		return new ScopedFilter(objectClassEqFilter);
	}
	ExprNode plainFilter = plainScopedFilter.getFilter();
	if (plainFilter == null) {
		return new ScopedFilter(objectClassEqFilter, plainScopedFilter.getBaseDn());
	}
	if (plainFilter instanceof AndNode) {
		((AndNode)plainFilter).addNode(objectClassEqFilter);
		return plainScopedFilter;
	} else {
		return new ScopedFilter(new AndNode(objectClassEqFilter, plainFilter), plainScopedFilter.getBaseDn()); 
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:21,代码来源:LdapFilterTranslator.java

示例10: setFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public SearchRequest setFilter( ExprNode filter )
{
    getDecorated().setFilter( filter );

    return this;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:SearchRequestDsml.java

示例11: testRequestWithApproxMatchFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an approxMatch Filter
 */
@Test
public void testRequestWithApproxMatchFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput(
            SearchRequestTest.class.getResource( "filters/request_with_approxMatch.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof ApproximateNode );

    ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;

    assertEquals( "sn", approxMatchFilter.getAttribute() );

    assertEquals( "foobar", approxMatchFilter.getValue().getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:SearchRequestTest.java

示例12: testRequestWithApproxMatchFilterBase64Value

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an approxMatch Filter with base64 value
 */
@Test
public void testRequestWithApproxMatchFilterBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_approxMatch_base64_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof ApproximateNode );

    ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;

    assertEquals( "sn", approxMatchFilter.getAttribute() );

    assertEquals( "DSMLv2.0 rocks!!", approxMatchFilter.getValue().getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:SearchRequestTest.java

示例13: testRequestWithApproxMatchFilterEmptyValue

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an approxMatch Filter with empty value
 */
@Test
public void testRequestWithApproxMatchFilterEmptyValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource(
            "filters/request_with_approxMatch_with_empty_value.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof ApproximateNode );

    ApproximateNode<?> approxMatchFilter = ( ApproximateNode<?> ) filter;

    assertEquals( "sn", approxMatchFilter.getAttribute() );

    assertEquals( "", approxMatchFilter.getValue().getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:SearchRequestTest.java

示例14: testRequestWithGreaterOrEqualFilter

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an greaterOrEqual Filter
 */
@Test
public void testRequestWithGreaterOrEqualFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_greaterOrEqual.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof GreaterEqNode );

    GreaterEqNode<?> greaterEqFilter = ( GreaterEqNode<?> ) filter;

    assertEquals( "sn", greaterEqFilter.getAttribute() );

    assertEquals( "foobar", greaterEqFilter.getValue().getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:SearchRequestTest.java

示例15: testRequestWithGreaterOrEqualFilterBase64Value

import org.apache.directory.api.ldap.model.filter.ExprNode; //导入依赖的package包/类
/**
 * Test parsing of a request with an greaterOrEqual Filter with base64 value
 */
@Test
public void testRequestWithGreaterOrEqualFilterBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource(
            "filters/request_with_greaterOrEqual_base64_value.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof GreaterEqNode );

    GreaterEqNode<?> greaterEqFilter = ( GreaterEqNode<?> ) filter;

    assertEquals( "sn", greaterEqFilter.getAttribute() );

    assertEquals( "DSMLv2.0 rocks!!", greaterEqFilter.getValue().getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:SearchRequestTest.java


注:本文中的org.apache.directory.api.ldap.model.filter.ExprNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。