Package org.apache.directory.shared.ldap.entry.client

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry


        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


            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,
View Full Code Here


    public Entry toClientEntry() throws LdapException
    {
        // Copy the DN
        Entry clientEntry = new DefaultClientEntry( clonedEntry.getDn() );
       
        // Convert each attribute
        for ( EntryAttribute clonedEntry:this )
        {
            EntryAttribute clientAttribute = clonedEntry.toClientAttribute();
            clientEntry.add( clientAttribute );
        }
       
        return clientEntry;
    }
View Full Code Here

       
       
        public Entry toClientEntry() throws LdapException
        {
            // Copy the DN
            Entry clientEntry = new DefaultClientEntry( dn );
           
            // Convert each attribute
            for ( EntryAttribute serverAttribute:this )
            {
                EntryAttribute clientAttribute = serverAttribute.toClientAttribute();
                clientEntry.add( clientAttribute );
            }
           
            return clientEntry;
        }
View Full Code Here

    {
        StringReader strIn = new StringReader( text );
        BufferedReader in = new BufferedReader( strIn );

        String line = null;
        Entry entry = new DefaultClientEntry();

        try
        {
            while ( ( line = in.readLine() ) != null )
            {
                if ( line.length() == 0 )
                {
                    continue;
                }

                String addedLine = line.trim();

                if ( StringTools.isEmpty( addedLine ) )
                {
                    continue;
                }

                EntryAttribute attribute = AttributeUtils.toClientAttribute( LdifReader.parseAttributeValue( addedLine ) );
                EntryAttribute oldAttribute = entry.get( attribute.getId() );

                if ( oldAttribute != null )
                {
                    try
                    {
                        oldAttribute.add( attribute.get() );
                        entry.put( oldAttribute );
                    }
                    catch (NamingException ne)
                    {
                        // Do nothing
                    }
                }
                else
                {
                    try
                    {
                        entry.put( attribute );
                    }
                    catch ( NamingException ne )
                    {
                        // Do nothing...
                    }
View Full Code Here

    {
        StringReader strIn = new StringReader( text );
        BufferedReader in = new BufferedReader( strIn );

        String line = null;
        Entry entry = new DefaultClientEntry();

        try
        {
            while ( ( line = in.readLine() ) != null )
            {
                if ( line.length() == 0 )
                {
                    continue;
                }

                String addedLine = line.trim();

                if ( StringTools.isEmpty( addedLine ) )
                {
                    continue;
                }

                EntryAttribute attribute = AttributeUtils.toClientAttribute(
                    LdifReader.parseAttributeValue( addedLine ) );
                EntryAttribute oldAttribute = entry.get( attribute.getId() );

                if ( oldAttribute != null )
                {
                    try
                    {
                        oldAttribute.add( attribute.get() );
                        entry.put( oldAttribute );
                    }
                    catch ( NamingException ne )
                    {
                        // Do nothing
                    }
                }
                else
                {
                    try
                    {
                        entry.put( attribute );
                    }
                    catch ( NamingException ne )
                    {
                        // TODO do nothing ...
                    }
View Full Code Here

     * @return An instance of ClientEntry
     */
    public Entry toClientEntry() throws NamingException
    {
        // Copy the DN
        Entry clientEntry = new DefaultClientEntry( dn );
       
        // Convert each attribute
        for ( EntryAttribute serverAttribute:this )
        {
            EntryAttribute clientAttribute = ((ServerAttribute)serverAttribute).toClientAttribute();
            clientEntry.add( clientAttribute );
        }
       
        return clientEntry;
    }
View Full Code Here


    public Entry toClientEntry() throws NamingException
    {
        // Copy the DN
        Entry clientEntry = new DefaultClientEntry( clonedEntry.getDn() );
       
        // Convert each attribute
        for ( EntryAttribute clonedEntry:this )
        {
            EntryAttribute clientAttribute = ((ServerAttribute)clonedEntry).toClientAttribute();
            clientEntry.add( clientAttribute );
        }
       
        return clientEntry;
    }
View Full Code Here

       
       
        public Entry toClientEntry() throws NamingException
        {
            // Copy the DN
            Entry clientEntry = new DefaultClientEntry( dn );
           
            // Convert each attribute
            for ( EntryAttribute serverAttribute:this )
            {
                EntryAttribute clientAttribute = ((ServerAttribute)serverAttribute).toClientAttribute();
                clientEntry.add( clientAttribute );
            }
           
            return clientEntry;
        }
View Full Code Here

     * Test the copy constructor of a ClientEntry
     */
    @Test
    public void testCopyConstructorClientEntry() throws NamingException
    {
        Entry clientEntry = new DefaultClientEntry();
        clientEntry.setDn( new LdapDN( "ou=system" ) );
        clientEntry.add( "cn", "test1", "test2" );
        clientEntry.add( "objectClass", "top", "person" );
       
        Entry copyEntry = new DefaultServerEntry( registries, clientEntry );
       
        assertTrue( copyEntry instanceof ServerEntry );
        assertTrue( copyEntry.contains( "objectClass", "top", "person" ) );
        assertTrue( copyEntry.contains( "cn", "test1", "test2" ) );
       
        clientEntry.removeAttributes( "cn" );

        assertTrue( copyEntry.contains( "objectClass", "top", "person" ) );
        assertTrue( copyEntry.contains( "cn", "test1", "test2" ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

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.