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

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


        "ref: ldap://localhost:" + ldapServer.getPort() + "/c=usa,ou=system\n\n";

        LdifReader reader = new LdifReader( new StringReader( ldif ) );
        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            ldapServer.getDirectoryService().getAdminSession().add(
                new DefaultServerEntry( ldapServer.getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }
    }
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( 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().getNormName() );
            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().getNormName() );
            ldif.setDeleteOldRdn( opContext.getDelOldDn() );
            ldif.setNewSuperior( opContext.getNewDn().getNormName() );
           
            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().getNormName() );
           
            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( 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 )
        {
            // filter collective attributes, they can't be added by the revert operation
            AttributeType at = schemaService.getSchemaManager().getAttributeTypeRegistry().lookup( attribute.getId() );
            if ( !at.isCollective() )
            {
                reverseEntry.add( attribute.toClientAttribute() );
            }
        }

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

            }
           
            return;
        }

        LdifEntry forward = new LdifEntry();
        forward.setChangeType( ChangeType.Modify );
        forward.setDn( opContext.getDn() );
       
        List<Modification> mods = new ArrayList<Modification>( clonedMods.size() );
       
        for ( Modification modItem : clonedMods )
        {
            Modification mod = ((ServerModification)modItem).toClientModification();
           
            // TODO: handle correctly http://issues.apache.org/jira/browse/DIRSERVER-1198
            mod.getAttribute().setId( modItem.getAttribute().getId() );
            mods.add( mod );
           
            forward.addModificationItem( mod );
        }
       
        Entry clientEntry = new DefaultClientEntry( serverEntry.getDn() );
       
        for ( EntryAttribute attribute:serverEntry )
        {
            clientEntry.add( attribute.toClientAttribute() );
        }

        LdifEntry reverse = LdifRevertor.reverseModify(
            opContext.getDn(),
            mods,
            clientEntry );
       
        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.