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

Examples of org.apache.directory.shared.ldap.model.entry.DefaultModification


    public void testSerializationModificationADD() throws ClassNotFoundException, IOException
    {
        EntryAttribute attribute = new DefaultEntryAttribute( "cn" );
        attribute.add( "test1", "test2" );
       
        DefaultModification mod = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
       
        Modification modSer = deserializeValue( serializeValue( mod ) );
       
        assertEquals( mod, modSer );
    }
View Full Code Here


    public void testSerializationModificationREPLACE() throws ClassNotFoundException, IOException
    {
        EntryAttribute attribute = new DefaultEntryAttribute( "cn" );
        attribute.add( "test1", "test2" );
       
        DefaultModification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
       
        Modification modSer = deserializeValue( serializeValue( mod ) );
       
        assertEquals( mod, modSer );
    }
View Full Code Here

    public void testSerializationModificationREMOVE() throws ClassNotFoundException, IOException
    {
        EntryAttribute attribute = new DefaultEntryAttribute( "cn" );
        attribute.add( "test1", "test2" );
       
        DefaultModification mod = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attribute );
       
        Modification modSer = deserializeValue( serializeValue( mod ) );
       
        assertEquals( mod, modSer );
    }
View Full Code Here

   
   
    @Test
    public void testSerializationModificationNoAttribute() throws ClassNotFoundException, IOException
    {
        DefaultModification mod = new DefaultModification();
       
        mod.setOperation( ModificationOperation.ADD_ATTRIBUTE );
       
        Modification modSer = deserializeValue( serializeValue( mod ) );
       
        assertEquals( mod, modSer );
    }
View Full Code Here

    }


    public void addModification( EntryAttribute attr, ModificationOperation modOp )
    {
        mods.add( new DefaultModification( modOp, attr ) );
    }
View Full Code Here

        {

            for ( int i = 0; i < mods.size(); i++ )
            {

                DefaultModification modification = ( DefaultModification ) mods.get( i );

                sb.append( "            Modification[" ).append( i ).append( "]\n" );
                sb.append( "                Operation : " );

                switch ( modification.getOperation() )
                {
                    case ADD_ATTRIBUTE:
                        sb.append( " add\n" );
                        break;

                    case REPLACE_ATTRIBUTE:
                        sb.append( " replace\n" );
                        break;

                    case REMOVE_ATTRIBUTE:
                        sb.append( " delete\n" );
                        break;
                }

                sb.append( "                Modification\n" );
                sb.append( modification.getAttribute() );
            }
        }

        // The controls
        sb.append( super.toString() );
View Full Code Here

     */
    public void addAttributeTypeAndValues( String type )
    {
        currentAttribute = new DefaultEntryAttribute( type );

        Modification modification = new DefaultModification( currentOperation, currentAttribute );
        getDecorated().addModification( modification );
    }
View Full Code Here

                operation = ModificationOperation.ADD_ATTRIBUTE;
                break;
               
        }
       
        Modification modification = new DefaultModification(
            operation,
            ServerEntryUtils.toServerAttribute( modificationImpl.getAttribute(), attributeType ) );
       
        return modification;
       
View Full Code Here

     * @return a instance of a ServerModification object
     */
    private static Modification toServerModification( Modification modification, AttributeType attributeType )
        throws LdapException
    {
        Modification serverModification = new DefaultModification(
            modification.getOperation(),
            new DefaultAttribute( attributeType, modification.getAttribute() ) );
       
        return serverModification;
       
View Full Code Here

        String modifiersName = opContext.getSession().getEffectivePrincipal().getName();
        String modifyTimestamp = DateUtils.getGeneralizedTime();

        List<Modification> mods = new ArrayList<Modification>( 2 );

        mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultAttribute(
            ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, schemaManager
                .lookupAttributeTypeRegistry( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ), modifyTimestamp ) ) );

        mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultAttribute(
            ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, schemaManager
                .lookupAttributeTypeRegistry( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ), modifiersName ) ) );

        opContext.modify( SCHEMA_MODIFICATION_DN, mods, ByPassConstants.SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.DefaultModification

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.