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


Java Dn.isNullOrEmpty方法代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.name.Dn.isNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Dn.isNullOrEmpty方法的具体用法?Java Dn.isNullOrEmpty怎么用?Java Dn.isNullOrEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.api.ldap.model.name.Dn的用法示例。


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

示例1: toDsml

import org.apache.directory.api.ldap.model.name.Dn; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Element toDsml( Element root )
{
    Element element = super.toDsml( root );

    BindRequest request = getDecorated();

    // Principal
    Dn dn = request.getDn();

    if ( !Dn.isNullOrEmpty( dn ) )
    {
        // A DN has been provided

        element.addAttribute( "principal", dn.getName() );
    }
    else
    {
        // No DN has been provided, let's use the name as a string instead

        String name = request.getName();

        element.addAttribute( "principal", name );
    }

    return element;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:31,代码来源:BindRequestDsml.java

示例2: toDsml

import org.apache.directory.api.ldap.model.name.Dn; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Element toDsml( Element root )
{

    // RequestID
    int requestID = message.getMessageId();
    if ( requestID > 0 )
    {
        root.addAttribute( "requestID", Integer.toString( requestID ) );
    }

    // Matched Dn
    Dn matchedDn = result.getMatchedDn();

    if ( !Dn.isNullOrEmpty( matchedDn ) )
    {
        root.addAttribute( "matchedDn", matchedDn.getName() );
    }

    // Controls
    ParserUtils.addControls( codec, root, message.getControls().values() );

    // ResultCode
    Element resultCodeElement = root.addElement( "resultCode" );
    resultCodeElement.addAttribute( "code", Integer.toString( result.getResultCode().getResultCode() ) );
    resultCodeElement.addAttribute( "descr", result.getResultCode().getMessage() );

    // ErrorMessage
    String errorMessage = result.getDiagnosticMessage();
    
    if ( ( errorMessage != null ) && ( errorMessage.length() != 0 ) )
    {
        Element errorMessageElement = root.addElement( "errorMessage" );
        errorMessageElement.addText( errorMessage );
    }

    // Referrals
    Referral referral = result.getReferral();
    if ( referral != null )
    {
        Collection<String> ldapUrls = referral.getLdapUrls();
        if ( ldapUrls != null )
        {
            for ( String ldapUrl : ldapUrls )
            {
                Element referalElement = root.addElement( "referal" );
                referalElement.addText( ldapUrl );
            }
        }
    }

    return root;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:57,代码来源:LdapResultDsml.java

示例3: equals

import org.apache.directory.api.ldap.model.name.Dn; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean equals( Object obj )
{
    if ( obj == this )
    {
        return true;
    }

    if ( ( obj == null ) || !( obj instanceof BindRequest ) )
    {
        return false;
    }

    if ( !super.equals( obj ) )
    {
        return false;
    }

    BindRequest req = ( BindRequest ) obj;

    if ( req.isSimple() != isSimple() )
    {
        return false;
    }

    if ( req.isVersion3() != isVersion3() )
    {
        return false;
    }

    String name1 = req.getName();
    String name2 = getName();

    if ( Strings.isEmpty( name1 ) )
    {
        if ( !Strings.isEmpty( name2 ) )
        {
            return false;
        }
    }
    else
    {
        if ( Strings.isEmpty( name2 ) )
        {
            return false;
        }
        else if ( !name2.equals( name1 ) )
        {
            return false;
        }
    }

    Dn dn1 = req.getDn();
    Dn dn2 = getDn();

    if ( Dn.isNullOrEmpty( dn1 ) )
    {
        if ( !Dn.isNullOrEmpty( dn2 ) )
        {
            return false;
        }
    }
    else
    {
        if ( Dn.isNullOrEmpty( dn2 ) )
        {
            return false;
        }
        else if ( !dn1.equals( dn2 ) )
        {
            return false;
        }
    }

    return Arrays.equals( req.getCredentials(), getCredentials() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:80,代码来源:BindRequestImpl.java


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