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


Java OrFilter类代码示例

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


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

示例1: getConditionFriendlyLdapUsersFromUidRaw

import org.springframework.ldap.filter.OrFilter; //导入依赖的package包/类
private List<LdapUser> getConditionFriendlyLdapUsersFromUidRaw(final List<String> uids,
		final String cgKeyName, final String service) {
	final OrFilter orFilter = orFilterOnUids(uids);
	if (orFilter == null) return new LinkedList<>();

       return getConditionFriendlyLdapUsers(orFilter, cgKeyName, service);
}
 
开发者ID:EsupPortail,项目名称:esup-smsu,代码行数:8,代码来源:LdapUtilsHelpers.java

示例2: orFilterOnUids

import org.springframework.ldap.filter.OrFilter; //导入依赖的package包/类
OrFilter orFilterOnUids(final Iterable<String> uids) {
	// needed since empty OrFilter() is true instead of false (https://jira.springsource.org/browse/LDAP-226)
	if (isEmpty(uids)) return null;

	final OrFilter filter = new OrFilter();
	for (String uid : uids) {
		filter.or(new EqualsFilter(userIdAttribute, uid));
	}
	return filter;
}
 
开发者ID:EsupPortail,项目名称:esup-smsu,代码行数:11,代码来源:LdapUtilsHelpers.java

示例3: getUsersByUids

import org.springframework.ldap.filter.OrFilter; //导入依赖的package包/类
/**
 * @param uids
 * @return a list of mails
 */
public List<LdapUser> getUsersByUids(final Iterable<String> uids) {
	final OrFilter filter = orFilterOnUids(uids);
	if (filter == null) 
	    return new LinkedList<>();
	else
	    return searchWithFilter(filter);
}
 
开发者ID:EsupPortail,项目名称:esup-smsu,代码行数:12,代码来源:LdapUtilsHelpers.java

示例4: search

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