Package org.apache.directory.server.core.entry

Examples of org.apache.directory.server.core.entry.ServerModification


    private void disableSchema( String schemaName ) throws Exception
    {
        LdapDN dn = new LdapDN( SchemaConstants.CN_AT + "=" + schemaName + "," + SchemaConstants.OU_AT + "=schema" );
        dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );

        Modification mod = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
            MetaSchemaConstants.M_DISABLED_AT, registries.getAttributeTypeRegistry().lookup(
                MetaSchemaConstants.M_DISABLED_AT ), "TRUE" ) );

        List<Modification> mods = new ArrayList<Modification>();
        mods.add( mod );
View Full Code Here


        ServerAttribute attribute = new DefaultServerAttribute(
            SchemaConstants.MODIFIERS_NAME_AT,
            modifiersNameAt,
            getPrincipal().getName());

        Modification modifiers = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
        //modifiers.setServerModified();
        modItemList.add( modifiers );
       
        AttributeType modifyTimeStampAt = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT );
        attribute = new DefaultServerAttribute(
            SchemaConstants.MODIFY_TIMESTAMP_AT,
            modifyTimeStampAt,
            DateUtils.getGeneralizedTime() );
       
        Modification timestamp = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
        //timestamp.setServerModified();
        modItemList.add( timestamp );

        // -------------------------------------------------------------------
        // Make the modify() call happen
View Full Code Here

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT,
            attributeRegistry.lookup( SchemaConstants.OU_AT_OID ) );
        attrib.add( "Engineering" );
       
        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
       
        mods.add( add );
       
        store.modify( dn, mods );
    }
View Full Code Here

            attributeRegistry.lookup( SchemaConstants.SURNAME_AT ) );
       
        String attribVal = "Walker";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );

        store.modify( dn, mods );
View Full Code Here

            attributeRegistry.lookup( SchemaConstants.SN_AT_OID ) );
       
        String attribVal = "Johnny";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
View Full Code Here

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT,
            attributeRegistry.lookup( SchemaConstants.SN_AT_OID ) );
       
        Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertNotNull( lookedup.get( "sn" ).get() );
View Full Code Here

            attributeRegistry.lookup( SchemaConstants.OU_AT_OID ) );
       
        String attribVal = "Marketing";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertNull( lookedup.get( "ou" ) ); // before replacing
View Full Code Here

        String modifiersName = opContext.getSession().getEffectivePrincipal().getJndiName().getNormName();
        String modifyTimestamp = DateUtils.getGeneralizedTime();
       
        List<Modification> mods = new ArrayList<Modification>( 2 );
       
        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE,
            new DefaultServerAttribute(
                ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT,
                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ),
                modifyTimestamp ) ) );
       
        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE,
            new DefaultServerAttribute(
                ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT,
                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ),
                modifiersName ) ) );
       
View Full Code Here

        AttributeTypeRegistry atRegistry = modContext.getSession()
            .getDirectoryService().getRegistries().getAttributeTypeRegistry();

        // Add our modification items.
        newModsList.add(
            new ServerModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultServerAttribute(
                    KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
                    atRegistry.lookup( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ),
                    principalName ) ) );
        newModsList.add(
            new ServerModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultServerAttribute(
                    KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT,
                    atRegistry.lookup( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
                    Integer.toString( kvno ) ) ) );
       
        ServerAttribute attribute = getKeyAttribute( modContext.getSession()
            .getDirectoryService().getRegistries(), keys );
        newModsList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );

        modContext.setModItems( newModsList );
    }
View Full Code Here

        {
            LOG.warn( "Does not make sense: you're trying to enable {} schema which is already enabled", schemaName );
            return;
        }

        mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
            MetaSchemaConstants.M_DISABLED_AT, attrRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT ) ) ) );

        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
            SchemaConstants.MODIFIERS_NAME_AT, attrRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
            ServerDNConstants.ADMIN_SYSTEM_DN ) ) );

        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
            SchemaConstants.MODIFY_TIMESTAMP_AT, attrRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
                .getGeneralizedTime() ) ) );

        partition.modify( new ModifyOperationContext( null, dn, mods ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.entry.ServerModification

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.