org.springframework.ldap.filter.Filter.encode()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中org.springframework.ldap.filter.Filter.encode()方法的一些代码示例,展示了Filter.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.encode()方法的具体详情如下:
包路径:org.springframework.ldap.filter.Filter
类名称:Filter
方法名:encode

Filter.encode介绍

[英]Encodes the filter to a String.
[中]将筛选器编码为字符串。

代码示例

代码示例来源:origin: org.springframework.ldap/spring-ldap-core

public StringBuffer encode(StringBuffer buff) {
  buff.append("(!");
  filter.encode(buff);
  buff.append(')');
  return buff;
}

代码示例来源:origin: org.springframework.ldap/spring-ldap-core

/**
 * {@inheritDoc}
 */
@Override
public void search(LdapQuery query, NameClassPairCallbackHandler callbackHandler) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  search(query.base(),
      query.filter().encode(),
      searchControls,
      callbackHandler);
}

代码示例来源:origin: spring-projects/spring-ldap

/**
 * {@inheritDoc}
 */
@Override
public <T> List<T> search(LdapQuery query, AttributesMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  return search(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: org.springframework.ldap/spring-ldap-core

/**
 * {@inheritDoc}
 */
@Override
public <T> List<T> search(LdapQuery query, AttributesMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  return search(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: org.springframework.ldap/spring-ldap-core

/**
 * {@inheritDoc}
 */
@Override
public <T> T searchForObject(LdapQuery query, ContextMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  return searchForObject(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * {@inheritDoc}
 */
@Override
public <T> T searchForObject(LdapQuery query, ContextMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  return searchForObject(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: omero/server

@SuppressWarnings("unchecked")
@RolesAllowed("system")
public List<Experimenter> searchAll() {
  return ldap.search(DistinguishedName.EMPTY_PATH, config.getUserFilter()
      .encode(), getPersonContextMapper());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-ldap

/**
 * {@inheritDoc}
 */
@Override
public void search(LdapQuery query, NameClassPairCallbackHandler callbackHandler) {
  SearchControls searchControls = searchControlsForQuery(query, DONT_RETURN_OBJ_FLAG);
  search(query.base(),
      query.filter().encode(),
      searchControls,
      callbackHandler);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-ldap

/**
 * {@inheritDoc}
 */
@Override
public <T> List<T> search(LdapQuery query, ContextMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, RETURN_OBJ_FLAG);
  return search(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: spring-projects/spring-ldap

/**
 * {@inheritDoc}
 */
@Override
public <T> List<T> search(LdapQuery query, ContextMapper<T> mapper) {
  SearchControls searchControls = searchControlsForQuery(query, RETURN_OBJ_FLAG);
  return search(query.base(),
      query.filter().encode(),
      searchControls,
      mapper);
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildFilterFormat() {
  LdapQuery result = query().filter("(|(cn={0})(cn={1}))", "Person*", "Parson*");
  assertThat(result.filter().encode()).isEqualTo("(|(cn=Person\\2a)(cn=Parson\\2a))");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildHardcodedFilter() {
  LdapQuery result = query().filter("(cn=Person*)");
  assertThat(result.filter().encode()).isEqualTo("(cn=Person*)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildWhitespaceWildcards() {
  LdapQuery result = query().where("cn").whitespaceWildcardsLike("John Doe");
  assertThat(result.filter().encode()).isEqualTo("(cn=*John*Doe*)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildGreaterThanOrEquals() {
  LdapQuery result = query().where("cn").gte("John Doe");
  assertThat(result.filter().encode()).isEqualTo("(cn>=John Doe)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildLike() {
  LdapQuery result = query().where("cn").like("J*hn Doe");
  assertThat(result.filter().encode()).isEqualTo("(cn=J*hn Doe)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildPresent() {
  LdapQuery result = query().where("cn").isPresent();
  assertThat(result.filter().encode()).isEqualTo("(cn=*)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildSimpleWithDefaults() {
  LdapQuery result = query().where("cn").is("John Doe");
  assertThat(result.base()).isEqualTo(LdapUtils.emptyLdapName());
  assertThat(result.searchScope()).isNull();
  assertThat(result.timeLimit()).isNull();
  assertThat(result.countLimit()).isNull();
  assertThat(result.filter().encode()).isEqualTo("(cn=John Doe)");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildOrNegatedSubQueries() {
  LdapQuery result = query().where("objectclass").not().is("person").or("sn").not().is("Doe");
  assertThat(result.filter().encode()).isEqualTo("(|(!(objectclass=person))(!(sn=Doe)))");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildAndOrPrecedence() {
  LdapQuery result = query().where("objectclass").is("person")
      .and("cn").is("John Doe")
      .or(query().where("sn").is("Doe"));
  assertThat(result.filter().encode()).isEqualTo("(|(&(objectclass=person)(cn=John Doe))(sn=Doe))");
}

代码示例来源:origin: spring-projects/spring-ldap

@Test
public void buildNestedAnd() {
  LdapQuery result = query()
      .where("objectclass").is("person")
      .and(query()
          .where("sn").is("Doe")
          .or("sn").like("Die"));
  assertThat(result.filter().encode()).isEqualTo("(&(objectclass=person)(|(sn=Doe)(sn=Die)))");
}

相关文章