本文整理汇总了Java中org.apache.directory.api.ldap.model.entry.Entry.getDn方法的典型用法代码示例。如果您正苦于以下问题:Java Entry.getDn方法的具体用法?Java Entry.getDn怎么用?Java Entry.getDn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.entry.Entry
的用法示例。
在下文中一共展示了Entry.getDn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revertEntry
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* A small helper class to compute the simple revert.
*/
private static LdifEntry revertEntry( Entry entry, Dn newDn, Dn newSuperior, Rdn oldRdn, Rdn newRdn )
throws LdapInvalidDnException
{
LdifEntry reverted = new LdifEntry();
// We have a composite old Rdn, something like A=a+B=b
// It does not matter if the RDNs overlap
reverted.setChangeType( ChangeType.ModRdn );
if ( newSuperior != null )
{
Dn restoredDn = newSuperior.add( newRdn );
reverted.setDn( restoredDn );
}
else
{
reverted.setDn( newDn );
}
reverted.setNewRdn( oldRdn.getName() );
// Is the newRdn's value present in the entry ?
// ( case 3, 4 and 5)
// If keepOldRdn = true, we cover case 4 and 5
boolean keepOldRdn = entry.contains( newRdn.getNormType(), newRdn.getValue() );
reverted.setDeleteOldRdn( !keepOldRdn );
if ( newSuperior != null )
{
Dn oldSuperior = entry.getDn();
oldSuperior = oldSuperior.getParent();
reverted.setNewSuperior( oldSuperior.getName() );
}
return reverted;
}
示例2: convertToLdif
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Convert an Entry as LDIF
*
* @param entry the Entry to convert
* @param length the expected line length
* @return the corresponding LDIF code as a String
* @throws LdapException If a naming exception is encountered.
*/
public static String convertToLdif( Entry entry, int length ) throws LdapException
{
StringBuilder sb = new StringBuilder();
if ( entry.getDn() != null )
{
// First, dump the Dn
if ( isLDIFSafe( entry.getDn().getName() ) )
{
sb.append( stripLineToNChars( "dn: " + entry.getDn().getName(), length ) );
}
else
{
sb.append( stripLineToNChars( "dn:: " + encodeBase64( entry.getDn().getName() ), length ) );
}
sb.append( '\n' );
}
// Then all the attributes
for ( Attribute attribute : entry )
{
sb.append( convertToLdif( attribute, length ) );
}
return sb.toString();
}
示例3: LdifEntry
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Creates a new LdifEntry object, storing an Entry
*
* @param entry The entry to encapsulate
*/
public LdifEntry( Entry entry )
{
// Default LDIF content
changeType = ChangeType.None;
modificationList = new LinkedList<>();
modifications = new HashMap<>();
this.entry = entry;
entryDn = entry.getDn();
controls = null;
}
示例4: map
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
@Override
public Dn map( Entry entry ) throws LdapException
{
return entry.getDn();
}