Package org.apache.directory.studio.ldapbrowser.core.model

Examples of org.apache.directory.studio.ldapbrowser.core.model.IAttribute


            }

            // attribute -> values
            else if ( element instanceof IAttribute )
            {
                IAttribute attribute = ( IAttribute ) element;
                return attribute.getValues();
            }

            else
            {
                return new Object[0];
View Full Code Here


            }

            // Attribute
            else if ( element instanceof IAttribute )
            {
                IAttribute attribute = ( IAttribute ) element;
                return attribute.getDescription() + " (" + attribute.getValueSize() + ")"; //$NON-NLS-1$  //$NON-NLS-2$
            }

            // Value
            else if ( element instanceof IValue )
            {
View Full Code Here

                EventRegistry.suspendEventFiringInCurrentThread();
                for ( IValue oldValue : oldValues )
                {
                    if ( !newAttributeDescription.equals( oldValue.getAttribute().getDescription() ) )
                    {
                        IAttribute oldAttribute = oldValue.getAttribute();
                        IEntry entry = oldAttribute.getEntry();
                        IValue newValue = null;

                        // delete old value
                        oldAttribute.deleteValue( oldValue );
                        if ( oldAttribute.getValueSize() == 0 )
                        {
                            entry.deleteAttribute( oldAttribute );
                        }

                        // add new value
                        IAttribute attribute = entry.getAttribute( newAttributeDescription );
                        if ( attribute == null )
                        {
                            attribute = new Attribute( entry, newAttributeDescription );
                            entry.addAttribute( attribute );
                        }
                        newValue = new Value( attribute, oldValue.getRawValue() );
                        attribute.addValue( newValue );

                        // prepare event
                        if ( event == null )
                        {
                            event = new ValueRenamedEvent( entry.getBrowserConnection(), entry, oldValue, newValue );
View Full Code Here

        try
        {
            EventRegistry.suspendEventFiringInCurrentThread();
            for ( IValue value : values )
            {
                IAttribute attribute = value.getAttribute();
                IEntry entry = attribute.getEntry();

                attribute.deleteValue( value );
                if ( event == null )
                {
                    event = new ValueDeletedEvent( entry.getBrowserConnection(), entry, attribute, value );
                }

                if ( attribute.getValueSize() == 0 )
                {
                    attribute.getEntry().deleteAttribute( attribute );
                }
            }
        }
        finally
        {
View Full Code Here

        if ( oldValue == null || newRawValue == null )
        {
            throw new IllegalArgumentException( "Expected non-null value." ); //$NON-NLS-1$
        }

        IAttribute attribute = oldValue.getAttribute();

        boolean modify = false;
        if ( oldValue != null && newRawValue != null && newRawValue instanceof byte[] )
        {
            byte[] newValue = ( byte[] ) newRawValue;
            if ( !Utils.equals( oldValue.getBinaryValue(), newValue ) )
            {
                modify = true;
            }
        }
        else if ( oldValue != null && newRawValue != null && newRawValue instanceof String )
        {

            String newValue = ( String ) newRawValue;
            if ( !oldValue.getStringValue().equals( newValue ) )
            {
                modify = true;
            }
        }

        if ( modify )
        {
            if ( oldValue.isEmpty() )
            {
                EventRegistry.suspendEventFiringInCurrentThread();
                attribute.deleteEmptyValue();
                EventRegistry.resumeEventFiringInCurrentThread();

                Value value = new Value( attribute, newRawValue );
                attribute.addValue( value );
            }
            else
            {
                IValue newValue = new Value( attribute, newRawValue );
                attribute.modifyValue( oldValue, newValue );
            }
        }
    }
View Full Code Here

        if ( newRawValue == null )
        {
            throw new IllegalArgumentException( "Expected non-null value." ); //$NON-NLS-1$
        }

        IAttribute attribute = entry.getAttribute( attributeDescription );
        if ( attribute == null )
        {
            EventRegistry.suspendEventFiringInCurrentThread();
            attribute = new Attribute( entry, attributeDescription );
            entry.addAttribute( attribute );
            EventRegistry.resumeEventFiringInCurrentThread();
        }

        Value value = new Value( attribute, newRawValue );
        attribute.addValue( value );
    }
View Full Code Here

        ValueAddedEvent event = null;
        EventRegistry.suspendEventFiringInCurrentThread();
        for ( IValue value : values )
        {
            String attributeDescription = value.getAttribute().getDescription();
            IAttribute attribute = entry.getAttribute( attributeDescription );
            if ( attribute == null )
            {
                attribute = new Attribute( entry, attributeDescription );
                entry.addAttribute( attribute );
            }
            Value newValue = new Value( attribute, value.getRawValue() );
            attribute.addValue( newValue );
            if ( event == null )
            {
                event = new ValueAddedEvent( entry.getBrowserConnection(), entry, attribute, newValue );
            }
        }
View Full Code Here

            IBrowserConnection connection = search.getBrowserConnection();
            Set<String> supportedConrolSet = new HashSet<String>();
            if ( connection.getRootDSE() != null
                && connection.getRootDSE().getAttribute( SchemaConstants.SUPPORTED_CONTROL_AT ) != null )
            {
                IAttribute scAttribute = connection.getRootDSE().getAttribute( SchemaConstants.SUPPORTED_CONTROL_AT );
                String[] supportedControls = scAttribute.getStringValues();
                for ( int i = 0; i < supportedControls.length; i++ )
                {
                    supportedConrolSet.add( supportedControls[i].toLowerCase() );
                }
            }
View Full Code Here

        }

        // create new attributes
        for ( IAttribute attribute : fromEntry.getAttributes() )
        {
            IAttribute newAttribute = new Attribute( toEntry, attribute.getDescription() );
            for ( IValue value : attribute.getValues() )
            {
                IValue newValue = new Value( newAttribute, value.getRawValue() );
                newAttribute.addValue( newValue );
            }
            toEntry.addAttribute( newAttribute );
        }
        EventRegistry.resumeEventFiringInCurrentThread();
View Full Code Here

                        {
                            entry.setReferral( true );
                            entry.setHasChildrenHint( false );
                        }

                        IAttribute ocAttribute = entry.getAttribute( attributeDescription );
                        Value ocValue = new Value( ocAttribute, value );
                        ocAttribute.addValue( ocValue );
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.IAttribute

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.