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

Examples of org.apache.directory.shared.ldap.entry.Modification


        List<Modification> mods = opContext.getModItems();
        boolean hasModification = SCHEMA_UNCHANGED;
       
        // Check if the entry has a m-disabled attribute
        EntryAttribute disabledInEntry = entry.get( disabledAT );
        Modification disabledModification = ServerEntryUtils.getModificationItem( mods, disabledAT );
       
        // The attribute might be present, but that does not mean we will change it.
        // If it's absent, and if we have it in the previous entry, that mean we want
        // to enable the schema
        if ( disabledModification != null )
        {
            // We are trying to modify the m-disabled attribute.
            ModificationOperation modification = disabledModification.getOperation();
            EntryAttribute attribute = disabledModification.getAttribute();
           
            hasModification = modifyDisable( opContext, modification, attribute, disabledInEntry );
        }
        else if ( disabledInEntry != null )
        {
View Full Code Here


        Schema schema = registries.getLoadedSchema( schemaObject.getSchemaName() );
        List<Modification> modifications = new ArrayList<Modification>();
       
        // The m-disabled AT
        EntryAttribute disabledAttr = new DefaultServerAttribute( disabledAT, "FALSE" );
        Modification disabledMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disabledAttr );
       
        modifications.add( disabledMod );
       
        // The modifiersName AT
        EntryAttribute modifiersNameAttr =
            new DefaultServerAttribute( modifiersNameAT, session.getEffectivePrincipal().getName() );
        Modification modifiersNameMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifiersNameAttr );
       
        modifications.add( modifiersNameMod );
       
        // The modifyTimestamp AT
        EntryAttribute modifyTimestampAttr =
            new DefaultServerAttribute( modifyTimestampAT, DateUtils.getGeneralizedTime() );
        Modification modifyTimestampMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifyTimestampAttr );
       
        modifications.add( modifyTimestampMod );
       
        // Call the modify operation
        DN dn = buildDn( schemaObject.getObjectType(), schemaObject.getName() );
View Full Code Here

                {
                    continue;
                }
               
                EntryAttribute disable = new DefaultServerAttribute( disabledAT, "TRUE"  );
                Modification modification =
                    new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disable );
               
                //session.modify( dn, mods, ignoreReferral, log )
            }
        }
View Full Code Here

        EntryAttribute attribute = new DefaultClientAttribute( "userPassword", "replaced" );

        List<Modification> mods = new ArrayList<Modification>();
       
        Modification mod = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
        mods.add( mod );
     
        DN userDn = new DN( "uid=akarasulu,ou=users,ou=system" );
        userDn.normalize( service.getSchemaManager().getAttributeTypeRegistry().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
View Full Code Here

        // Modifications
        List<Modification> modifications = request.getModifications();

        for ( int i = 0; i < modifications.size(); i++ )
        {
            Modification modificationItem = modifications.get( i );

            Element modElement = element.addElement( "modification" );
            if ( modificationItem.getAttribute() != null )
            {
                modElement.addAttribute( "name", modificationItem.getAttribute().getId() );

                Iterator<Value<?>> iterator = modificationItem.getAttribute().getAll();
                while ( iterator.hasNext() )
                {
                    Value<?> value = iterator.next();

                    if ( value.get() != null )
                    {
                        if ( ParserUtils.needsBase64Encoding( value.get() ) )
                        {
                            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.get() ) );
                            valueElement.addAttribute( new QName( "type", xsiNamespace ), "xsd:"
                                + ParserUtils.BASE64BINARY );
                        }
                        else
                        {
                            modElement.addElement( "value" ).setText( ( String ) value.get() );
                        }
                    }
                }
            }

            ModificationOperation operation = modificationItem.getOperation();
            if ( operation == ModificationOperation.ADD_ATTRIBUTE )
            {
                modElement.addAttribute( "operation", "add" );
            }
            else if ( operation == ModificationOperation.REPLACE_ATTRIBUTE )
View Full Code Here

        List<Modification> modifications = modifyRequest.getModifications();

        assertEquals( 1, modifications.size() );

        Modification modification = ( Modification ) modifications.get( 0 );

        EntryAttribute attribute = modification.getAttribute();

        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get( 0 ).get() );
    }
View Full Code Here

        List<Modification> modifications = modifyRequest.getModifications();

        assertEquals( 1, modifications.size() );

        Modification modification = ( Modification ) modifications.get( 0 );

        EntryAttribute attribute = modification.getAttribute();

        String expected = new String( new byte[]
            { 'c', 'n', '=', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', 'L', ( byte ) 0xc3, ( byte ) 0xa9, 'c', 'h',
                'a', 'r', 'n', 'y', ',', ' ', 'o', 'u', '=', 'p', 'e', 'o', 'p', 'l', 'e', ',', ' ', 'd', 'c', '=',
                'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', ' ', 'd', 'c', '=', 'c', 'o', 'm' }, "UTF-8" );
View Full Code Here

        List<Modification> modifications = modifyRequest.getModifications();

        assertEquals( 2, modifications.size() );

        Modification modification = ( Modification ) modifications.get( 1 );

        EntryAttribute attribute = modification.getAttribute();

        assertEquals( "CN=Steve Jobs, DC=apple, DC=com", attribute.get( 0 ).get() );
    }
View Full Code Here

        assertEquals( "directreport", modifyRequest.getCurrentAttributeType() );

        List<Modification> modifications = modifyRequest.getModifications();

        Modification modification = ( Modification ) modifications.get( 0 );

        EntryAttribute attribute = modification.getAttribute();

        assertEquals( 0, attribute.size() );
    }
View Full Code Here

        List<Modification> modifications = modifyRequest.getModifications();

        assertEquals( 1, modifications.size() );

        Modification modification = ( Modification ) modifications.get( 0 );

        EntryAttribute attribute = modification.getAttribute();

        assertEquals( 2, attribute.size() );
        assertEquals( "CN=John Smith, DC=microsoft, DC=com", attribute.get( 0 ).get() );
        assertEquals( "CN=Steve Jobs, DC=apple, DC=com", attribute.get( 1 ).get() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.Modification

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.