本文整理汇总了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;
}
示例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;
}
示例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() );
}