org.apache.directory.ldap.client.api.LdapConnection.exists()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(91)

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

LdapConnection.exists介绍

[英]Tells if an entry exists in the server.
[中]告知服务器中是否存在条目。

代码示例

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( Dn dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( String dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( String dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( Dn dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( String dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@inheritDoc}
 */
@Override
public boolean exists( Dn dn ) throws LdapException
{
  return connection.exists( dn );
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

/**
 * Returns true if dn exists, false otherwise.
 * */
public boolean exists(Dn dn) {
  try {
    return connection.exists(dn);
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

/**
 * Throws appropriate exceptions for connection.exists(dn).
 * */
private void existsCheck(Dn dn) throws NoSuchNodeException, MissingParentException {
  try {
    if (!connection.exists(dn.getParent())) {
      throw new MissingParentException(lastMatch(dn));
    } else if (!connection.exists(dn)) {
      throw new NoSuchNodeException(dn);
    }
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

private Dn lastMatch(final Dn dn) throws MissingParentException {
  if (dn == null) {
    throw new MissingParentException((Dn) null);
  }
  try {
    if (connection.exists(dn)) {
      return dn;
    } else {
      return lastMatch(dn.getParent());
    }
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

/**
 * Returns a SearchCursor over the direct children of Dn parent. Throws {@link NoSuchNodeException} if resolving the
 * argument Dn fails at its leaf. Throws {@link MissingParentException} if resolving fails earlier.
 * */
private SearchCursor searchOneLevel(Dn parent) throws NoSuchNodeException, MissingParentException {
  try {
    if (!connection.exists(parent.getParent())) {
      throw new MissingParentException(lastMatch(parent));
    } else if (!connection.exists(parent)) {
      throw new NoSuchNodeException(parent);
    }
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
  SearchRequest searchRequest = new SearchRequestImpl();
  searchRequest.setBase(parent);
  searchRequest.setScope(SearchScope.ONELEVEL);
  try {
    searchRequest.setFilter("(objectclass=*)");
    return connection.search(searchRequest);
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
}

相关文章