本文整理汇总了Java中org.apache.directory.api.ldap.model.name.Dn.getNormName方法的典型用法代码示例。如果您正苦于以下问题:Java Dn.getNormName方法的具体用法?Java Dn.getNormName怎么用?Java Dn.getNormName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.name.Dn
的用法示例。
在下文中一共展示了Dn.getNormName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
import org.apache.directory.api.ldap.model.name.Dn; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String normalize( String value ) throws LdapException
{
Dn dn = new Dn( schemaManager, value );
return dn.getNormName();
}
示例2: normalize
import org.apache.directory.api.ldap.model.name.Dn; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
{
if ( Strings.isEmpty( value ) )
{
return null;
}
// Let's see if we have an UID part
int sharpPos = value.lastIndexOf( '#' );
if ( sharpPos != -1 )
{
// Now, check that we don't have another '#'
if ( value.indexOf( '#' ) != sharpPos )
{
// Yes, we have one : this is not allowed, it should have been
// escaped.
return null;
}
// This is an UID if the '#' is immediately
// followed by a BitString, except if the '#' is
// on the last position
String uid = value.substring( sharpPos + 1 );
if ( sharpPos > 0 )
{
Dn dn = new Dn( schemaManager, value.substring( 0, sharpPos ) );
return dn.getNormName() + '#' + uid;
}
else
{
throw new IllegalStateException( I18n.err( I18n.ERR_04226, value.getClass() ) );
}
}
else
{
// No UID, the strValue is a Dn
// Return the normalized Dn
return new Dn( schemaManager, value ).getNormName();
}
}