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


Java Entry.getDn方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:42,代码来源:LdifRevertor.java

示例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();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:LdifUtils.java

示例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;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:16,代码来源:LdifEntry.java

示例4: map

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
@Override
public Dn map( Entry entry ) throws LdapException
{
    return entry.getDn();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:6,代码来源:LdapConnectionTemplate.java


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