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

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


    }


    private void enableKerberosSchema() throws LdapException
    {
        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
            "m-disabled", "FALSE" );
        conn.modify( "cn=Krb5kdc,ou=schema", mod );
    }
View Full Code Here


        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

        Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );
        attrib.add( "Engineering" );

        Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );

        partition.modify( dn, add );
    }
View Full Code Here

            .lookupAttributeTypeRegistry( SchemaConstants.SURNAME_AT ) );

        String attribVal = "Walker";
        attrib.add( attribVal );

        Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );

        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );

        partition.modify( dn, add );
        assertTrue( lookedup.get( "sn" ).contains( attribVal ) );

        partition.modify( dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
            schemaManager.getAttributeType( "telephoneNumber" ), "+1974045779" ) );
        lookedup = partition.lookup( partition.getEntryId( dn ) );
        assertTrue( lookedup.get( "telephoneNumber" ).contains( "+1974045779" ) );
    }
View Full Code Here

            .lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );

        String attribVal = "Johnny";
        attrib.add( attribVal );

        Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );

        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );

        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing

        lookedup = partition.modify( dn, add );
        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );

        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SN_AT, "JWalker" ) );
        assertEquals( "JWalker", lookedup.get( "sn" ).get().getString() );
    }
View Full Code Here

        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

        Attribute attrib = new DefaultAttribute( SchemaConstants.SN_AT, schemaManager
            .lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );

        Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );

        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );

        assertNotNull( lookedup.get( "sn" ).get() );

        lookedup = partition.modify( dn, add );
        assertNull( lookedup.get( "sn" ) );

        // add an entry for the sake of testing the remove operation
        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, SN_AT, "JWalker" ) );
        assertNotNull( lookedup.get( "sn" ) );

        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, SN_AT ) );
        assertNull( lookedup.get( "sn" ) );
    }
View Full Code Here

        Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );

        String attribVal = "Marketing";
        attrib.add( attribVal );

        Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );

        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );

        assertNull( lookedup.get( "ou" ) ); // before replacing
View Full Code Here

        boolean isNisDisabled = nisEntry.contains( "m-disabled", "TRUE" );

        // if nis is disabled then enable it
        if ( isNisDisabled )
        {
            connection.modify( "cn=nis,ou=schema", new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, "m-disabled", "TRUE" ) );
        }

        nisEntry = connection.lookup( "cn=nis,ou=schema" );
        isNisDisabled = nisEntry.contains( "m-disabled", "TRUE" );
View Full Code Here

        CoreSession session = getService().getAdminSession();
       
        try
        {
            Attribute attr = new DefaultAttribute( "Description", "this is a test" );
            Modification mod = new DefaultModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
           
            session.modify( new Dn( "cn=Emmanuel Lecharny,ou=Roles,c=MNN,o=WW,ou=system" ), mod );
            fail();
        }
View Full Code Here

        CoreSession session = getService().getAdminSession();
       
        try
        {
            Attribute attr = new DefaultAttribute( "Description", "this is a test" );
            Modification mod = new DefaultModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

        CoreSession session = getService().getAdminSession();
       
        try
        {
            Attribute attr = new DefaultAttribute( "Description", "this is a test" );
            Modification mod = new DefaultModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
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.