Package org.apache.directory.shared.ldap.message

Examples of org.apache.directory.shared.ldap.message.ModificationItemImpl


        // Modifications
        List<ModificationItemImpl> modifications = request.getModifications();
       
        for ( int i = 0; i < modifications.size(); i++ )
        {
            ModificationItemImpl modificationItem = modifications.get( i );
           
            Element modElement = element.addElement( "modification" );
            if ( modificationItem.getAttribute() != null )
            {
                modElement.addAttribute( "name", modificationItem.getAttribute().getID() );
               
                try
                {
                    NamingEnumeration ne = modificationItem.getAttribute().getAll();
                    while ( ne.hasMoreElements() )
                    {
                        Object value = ( Object ) ne.nextElement();
                       
                        if ( value != null )
                        {
                            if ( ParserUtils.needsBase64Encoding( value ) )
                            {
                                Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
                                Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
                                element.getDocument().getRootElement().add( xsdNamespace );
                                element.getDocument().getRootElement().add( xsiNamespace );

                                Element valueElement = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
                                valueElement
                                    .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
                            }
                            else
                            {
                                modElement.addElement( "value" ).setText( (Stringvalue );
                            }
                        }
                    }
                }
                catch ( NamingException e )
                {
                }
            }
           
            int operation = modificationItem.getModificationOp();
            if ( operation == DirContext.ADD_ATTRIBUTE )
            {
                modElement.addAttribute( "operation", "add" );
            }
            else if ( operation == DirContext.REPLACE_ATTRIBUTE )
View Full Code Here


        // if krb5kdc is disabled then enable it
        if ( isKrb5KdcDisabled )
        {
            Attribute disabled = new AttributeImpl( "m-disabled" );
            ModificationItemImpl[] mods = new ModificationItemImpl[]
                { new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, disabled ) };
            schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
        }

        bot = new SWTEclipseBot();
        SWTBotUtils.openLdapPerspective( bot );
View Full Code Here

        // Modifications
        List<ModificationItemImpl> modifications = request.getModifications();
       
        for ( int i = 0; i < modifications.size(); i++ )
        {
            ModificationItemImpl modificationItem = modifications.get( i );
           
            Element modElement = element.addElement( "modification" );
            if ( modificationItem.getAttribute() != null )
            {
                modElement.addAttribute( "name", modificationItem.getAttribute().getID() );
               
                try
                {
                    NamingEnumeration ne = modificationItem.getAttribute().getAll();
                    while ( ne.hasMoreElements() )
                    {
                        Object value = ( Object ) ne.nextElement();
                       
                        if ( value != null )
                        {
                            if ( ParserUtils.needsBase64Encoding( value ) )
                            {
                                Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
                                Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
                                element.getDocument().getRootElement().add( xsdNamespace );
                                element.getDocument().getRootElement().add( xsiNamespace );

                                Element valueElement = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
                                valueElement
                                    .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
                            }
                            else
                            {
                                modElement.addElement( "value" ).setText( (Stringvalue );
                            }
                        }
                    }
                }
                catch ( NamingException e )
                {
                }
            }
           
            int operation = modificationItem.getModificationOp();
            if ( operation == DirContext.ADD_ATTRIBUTE )
            {
                modElement.addAttribute( "operation", "add" );
            }
            else if ( operation == DirContext.REPLACE_ATTRIBUTE )
View Full Code Here

        // Modifications
        List<ModificationItemImpl> modifications = request.getModifications();
       
        for ( int i = 0; i < modifications.size(); i++ )
        {
            ModificationItemImpl modificationItem = modifications.get( i );
           
            Element modElement = element.addElement( "modification" );
            if ( modificationItem.getAttribute() != null )
            {
                modElement.addAttribute( "name", modificationItem.getAttribute().getID() );
               
                try
                {
                    NamingEnumeration ne = modificationItem.getAttribute().getAll();
                    while ( ne.hasMoreElements() )
                    {
                        Object value = ( Object ) ne.nextElement();
                       
                        if ( value != null )
                        {
                            if ( ParserUtils.needsBase64Encoding( value ) )
                            {
                                Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
                                Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
                                element.getDocument().getRootElement().add( xsdNamespace );
                                element.getDocument().getRootElement().add( xsiNamespace );

                                Element valueElement = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
                                valueElement
                                    .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
                            }
                            else
                            {
                                modElement.addElement( "value" ).setText( (Stringvalue );
                            }
                        }
                    }
                }
                catch ( NamingException e )
                {
                }
            }
           
            int operation = modificationItem.getModificationOp();
            if ( operation == DirContext.ADD_ATTRIBUTE )
            {
                modElement.addAttribute( "operation", "add" );
            }
            else if ( operation == DirContext.REPLACE_ATTRIBUTE )
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.message.ModificationItemImpl

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.