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


Java LikeFilter类代码示例

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


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

示例1: getTagLogBySwissEduPersonCardUID

import org.springframework.ldap.filter.LikeFilter; //导入依赖的package包/类
public TagLog getTagLogBySwissEduPersonCardUID(String cardUID, String cardUidType) {
	AndFilter filter = new AndFilter();
	filter.and(new EqualsFilter("objectclass", "person"));
	filter.and(new LikeFilter("swissEduPersonCardUID", cardUID + "@" + cardUidType));
	List<TagLog> tagLogs = ldapTemplate.search("", filter.encode(),
			new TagLogLdapAttributMapper(cardUidType));
	if(!tagLogs.isEmpty()) {
		log.info("Got ldap entry from : " + ((LdapContextSource)ldapTemplate.getContextSource()).getUrls() + "for this swissEduPersonCardUID " + cardUID + "@" + cardUidType);
		return tagLogs.get(0);
	} else {
		log.warn("Got NO ldap entry from : " + ((LdapContextSource)ldapTemplate.getContextSource()).getUrls() + "for this swissEduPersonCardUID " + cardUID + "@" + cardUidType);
		return null;
	}
}
 
开发者ID:EsupPortail,项目名称:esup-nfc-tag-server,代码行数:15,代码来源:LdapService.java

示例2: search

import org.springframework.ldap.filter.LikeFilter; //导入依赖的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

示例3: like

import org.springframework.ldap.filter.LikeFilter; //导入依赖的package包/类
@Override
public ContainerCriteria like(String value) {
    return appendToParent(new LikeFilter(attribute, value));
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:5,代码来源:DefaultConditionCriteria.java


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