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


Java NotFilter类代码示例

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


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

示例1: negateIfApplicable

import org.springframework.ldap.filter.NotFilter; //导入依赖的package包/类
private Filter negateIfApplicable(Filter myFilter) {
    if (negated) {
        return new NotFilter(myFilter);
    }

    return myFilter;
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:8,代码来源:DefaultConditionCriteria.java

示例2: search

import org.springframework.ldap.filter.NotFilter; //导入依赖的package包/类
public <T> List<T> search(Class<T> type, Map<String, Object> criteria) {
    AndFilter filter = new AndFilter();
    
    for (Map.Entry<String, Object> entry : criteria.entrySet()) {
        //attempting to handle null values to prevent NPEs in this code.
        if (entry.getValue() == null) {
            entry.setValue("null");
        }
        if (entry.getValue() instanceof Iterable) {
            OrFilter orFilter = new OrFilter();
            for (String value : (Iterable<String>) entry.getValue()) {
                if (value.startsWith("!")) {
                    orFilter.or(new NotFilter(new LikeFilter(entry.getKey(), value.substring(1))));
                } else {
                    orFilter.or(new LikeFilter(entry.getKey(), value));
                }
            }
            filter.and(orFilter);
        }
        else {
            if (((String)entry.getValue()).startsWith("!")) {
                filter.and(new NotFilter(new LikeFilter(entry.getKey(), ((String)entry.getValue()).substring(1))));
            } else {
                filter.and(new LikeFilter(entry.getKey(), (String) entry.getValue()));
            }
        }
    };
    
    info("Using filter ", filter);

    debug("Looking up mapper for ", type.getSimpleName());
    final ContextMapper customMapper = contextMappers.get(type.getSimpleName());

    ContextMapperCallbackHandler callbackHandler = new CustomContextMapperCallbackHandler(customMapper);
    
    try {
        getLdapTemplate().search(DistinguishedName.EMPTY_PATH, 
                                 filter.encode(), 
                                 getSearchControls(), callbackHandler);
    }
    catch (SizeLimitExceededException e) {
        // Ignore this. We want to limit our results.
    }

    return callbackHandler.getList();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:47,代码来源:LdapPrincipalDaoImpl.java


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