Package org.apache.directory.shared.ldap.ldif

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry


    @Test
    public void testListUsersAsAdmin() throws Exception
    {
        LdapContext sysRoot = getSystemContext( service );
        HashSet<String> set = new HashSet<String>();
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
               

        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );
       
        while ( list.hasMore() )
View Full Code Here


    public static LdifEntry getUserAddLdif( String dnstr, byte[] password, String cn, String sn )
            throws InvalidNameException, NamingException
    {
        LdapDN dn = new LdapDN( dnstr );
        LdifEntry ldif = new LdifEntry();
        ldif.setDn( dnstr );
        ldif.setChangeType( ChangeType.Add );

        EntryAttribute attr = new DefaultClientAttribute( "objectClass",
            "top", "person", "organizationalPerson", "inetOrgPerson" );
        ldif.addAttribute( attr );

        attr = new DefaultClientAttribute( "ou", "Engineering", "People" );
        ldif.addAttribute( attr );

        String uid = ( String ) dn.getRdn().getValue();
        ldif.putAttribute( "uid", uid );

        ldif.putAttribute( "l", "Bogusville" );
        ldif.putAttribute( "cn", cn );
        ldif.putAttribute( "sn", sn );
        ldif.putAttribute( "mail", uid + "@apache.org" );
        ldif.putAttribute( "telephoneNumber", "+1 408 555 4798" );
        ldif.putAttribute( "facsimileTelephoneNumber", "+1 408 555 9751" );
        ldif.putAttribute( "roomnumber", "4612" );
        ldif.putAttribute( "userPassword", password );

        String givenName = cn.split( " " )[0];
        ldif.putAttribute( "givenName", givenName );
        return ldif;
    }
View Full Code Here

            opRevision = revision.incrementAndGet();
           
            // Store the added entry
            ServerEntry addEntry = opContext.getEntry();

            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.Add );
            ldif.setDn( opContext.getDn() );

            Set<AttributeType> list = addEntry.getAttributeTypes();
           
            for ( AttributeType attributeType:list )
            {
                ldif.addAttribute( ((ServerAttribute)addEntry.get( attributeType) ).toClientAttribute() );
            }
           
            log( opRevision, ldif );
        }
View Full Code Here

        if ( journalEnabled )
        {
            opRevision = revision.incrementAndGet();
           
            // Store the deleted entry
            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.Delete );
            ldif.setDn( opContext.getDn() );
           
            journal.log( getPrincipal(), opRevision, ldif );
        }

        try
View Full Code Here

        if ( journalEnabled )
        {
            opRevision = revision.incrementAndGet();
           
            // Store the modified entry
            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.Modify );
            ldif.setDn( opContext.getDn() );
           
            // Store the modifications
            for ( Modification modification:opContext.getModItems() )
            {
                ldif.addModificationItem( modification );
            }
           
            journal.log( getPrincipal(), opRevision, ldif );
        }
       
View Full Code Here

        if ( journalEnabled )
        {
            opRevision = revision.incrementAndGet();
           
            // Store the renamed entry
            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.ModRdn );
            ldif.setDn( opContext.getDn() );
            ldif.setNewRdn( opContext.getNewRdn().toString() );
            ldif.setDeleteOldRdn( opContext.getDelOldDn() );
           
            journal.log( getPrincipal(), opRevision, ldif );
        }
       
        try
View Full Code Here

        if ( journalEnabled )
        {
            opRevision = revision.incrementAndGet();
           
            // Store the renamed entry
            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.ModDn );
            ldif.setDn( opContext.getDn() );
            ldif.setNewRdn( opContext.getNewRdn().toString() );
            ldif.setDeleteOldRdn( opContext.getDelOldDn() );
            ldif.setNewSuperior( opContext.getNewDn().toString() );
           
            journal.log( getPrincipal(), opRevision, ldif );
        }
       
        try
View Full Code Here

        if ( journalEnabled )
        {
            opRevision = revision.incrementAndGet();
           
            // Store the moved entry
            LdifEntry ldif = new LdifEntry();
            ldif.setChangeType( ChangeType.ModDn );
            ldif.setDn( opContext.getDn() );
            ldif.setNewSuperior( opContext.getParent().toString() );
           
            journal.log( getPrincipal(), opRevision, ldif );
        }
       
        try
View Full Code Here

        if( addEntry.get( REV_AT_OID ) != null )
        {
           return;
        }
       
        LdifEntry forward = new LdifEntry();
        forward.setChangeType( ChangeType.Add );
        forward.setDn( opContext.getDn() );

        Set<AttributeType> list = addEntry.getAttributeTypes();
       
        for ( AttributeType attributeType:list )
        {
            forward.addAttribute( ((ServerAttribute)addEntry.get( attributeType) ).toClientAttribute() );
        }
       
        LdifEntry reverse = LdifRevertor.reverseAdd( opContext.getDn() );
        opContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
    }
View Full Code Here

        if( serverEntry.get( REV_AT_OID ) != null )
        {
           return;
        }

        LdifEntry forward = new LdifEntry();
        forward.setChangeType( ChangeType.Delete );
        forward.setDn( opContext.getDn() );
       
        Entry reverseEntry = new DefaultClientEntry( serverEntry.getDn() );
       
        for ( EntryAttribute attribute:serverEntry )
        {
            reverseEntry.add( ((ServerAttribute)attribute).toClientAttribute() );
        }

        LdifEntry reverse = LdifRevertor.reverseDel( opContext.getDn(), reverseEntry );
        opContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.ldif.LdifEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.