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

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


        while ( itr.hasNext() )
        {
            EntryAttribute localAttr = itr.next();
            String attrId = localAttr.getId();
            Modification mod;
            EntryAttribute remoteAttr = remoteEntry.get( attrId );

            if ( remoteAttr != null ) // would be better if we compare the values also? or will it consume more time?
            {
                mod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, remoteAttr );
View Full Code Here


        ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );

        ServerEntry oldEntry = ( ServerEntry ) entry.clone();
        EntryAttribute objectClasses = entry.get( objectClassType );
        boolean isSubtreeSpecificationModification = false;
        Modification subtreeMod = null;

        for ( Modification mod : mods )
        {
            if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getId() ) )
            {
                isSubtreeSpecificationModification = true;
                subtreeMod = mod;
            }
        }

        if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) && isSubtreeSpecificationModification )
        {
            SubtreeSpecification ssOld = subentryCache.removeSubentry( name.getNormName() ).getSubtreeSpecification();
            SubtreeSpecification ssNew;

            try
            {
                ssNew = ssParser.parse( ( ( ServerAttribute ) subtreeMod.getAttribute() ).getString() );
            }
            catch ( Exception e )
            {
                String msg = I18n.err( I18n.ERR_71 );
                LOG.error( msg, e );
View Full Code Here

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

        if ( modification instanceof ServerModification )
        {
            return modification;
        }
       
        Modification serverModification = new ServerModification(
            modification.getOperation(),
            new DefaultServerAttribute( attributeType, modification.getAttribute() ) );
       
        return serverModification;
       
View Full Code Here

     * @param type the attributeType spec of the Attribute to extract
     * @return the extract Attribute or null if no such attribute exists
     */
    public static ServerAttribute getAttribute( List<Modification> mods, AttributeType type )
    {
        Modification mod = getModificationItem( mods, type );
       
        if ( mod != null )
        {
            return (ServerAttribute)mod.getAttribute();
        }
       
        return null;
    }
View Full Code Here

     */
    public Modification toClientModification()
    {
        ModificationOperation newOperation = operation;
        EntryAttribute newAttribute = ((ServerAttribute)attribute).toClientAttribute();
        Modification newModification = new ClientModification( newOperation, newAttribute );
       
        return newModification;
    }
View Full Code Here

        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();
            ServerAttribute attribute = (ServerAttribute)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

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
            .lookupAttributeTypeRegistry( 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

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.