Examples of IAttribute


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

        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

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

            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

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

        }

        // 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

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

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

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

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

                    AttributeHierarchy ah = entry.getAttributeWithSubtypes( ras[r] );
                    if ( ah != null )
                    {
                        for ( Iterator<IAttribute> it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = it.next();
                            entry.deleteAttribute( attribute );
                        }
                    }
                }
            }
            else
            {
                // clear all
                IAttribute[] oldAttributes = entry.getAttributes();
                for ( int i = 0; oldAttributes != null && i < oldAttributes.length; i++ )
                {
                    entry.deleteAttribute( oldAttributes[i] );
                }
            }

            // additional clear old attributes if the record contains the attribute
            NamingEnumeration<? extends Attribute> attributeEnumeration = sr.getAttributes().getAll();
            while ( attributeEnumeration.hasMore() )
            {
                Attribute attribute = attributeEnumeration.next();
                String attributeDescription = attribute.getID();
                IAttribute oldAttribute = entry.getAttribute( attributeDescription );
                if ( oldAttribute != null )
                {
                    entry.deleteAttribute( oldAttribute );
                }
            }

            // set new attributes and values
            attributeEnumeration = sr.getAttributes().getAll();
            while ( attributeEnumeration.hasMore() )
            {
                Attribute attribute = attributeEnumeration.next();
                String attributeDescription = attribute.getID();

                if ( attribute.getAll().hasMore() )
                {
                    IAttribute studioAttribute = null;
                    if ( entry.getAttribute( attributeDescription ) == null )
                    {
                        studioAttribute = new org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute( entry,
                            attributeDescription );
                        entry.addAttribute( studioAttribute );
                    }
                    else
                    {
                        studioAttribute = entry.getAttribute( attributeDescription );
                    }

                    NamingEnumeration<?> valueEnumeration = attribute.getAll();
                    while ( valueEnumeration.hasMore() )
                    {
                        Object value = valueEnumeration.next();
                        studioAttribute.addValue( new Value( studioAttribute, value ) );
                    }
                }
            }
        }
    }
View Full Code Here

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

    /**
     * Opens the editor and adds the new value to the list.
     */
    private void addValue()
    {
        IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
        IValue value = new Value( attribute, "" ); //$NON-NLS-1$
        Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$

        CellEditor cellEditor = valueEditor.getCellEditor();
        cellEditor.setValue( oldRawValue );
View Full Code Here

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

    private void editValue()
    {
        String oldValue = getSelectedValue();
        if ( oldValue != null )
        {
            IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
            IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
            Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$

            CellEditor cellEditor = valueEditor.getCellEditor();
            cellEditor.setValue( oldRawValue );
View Full Code Here

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

            if ( dialog.open() == WizardDialog.OK )
            {
                String newAttributeDescription = wizard.getAttributeDescription();
                if ( newAttributeDescription != null && !"".equals( newAttributeDescription ) ) //$NON-NLS-1$
                {
                    IAttribute att = entry.getAttribute( newAttributeDescription );
                    if ( att == null )
                    {
                        att = new Attribute( entry, newAttributeDescription );
                        entry.addAttribute( att );
                    }

                    att.addEmptyValue();
                }
            }
        }
    }
View Full Code Here

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

            pageId = BrowserCommonConstants.PROP_ATTRIBUTE;
            title = getSelectedAttributes()[0].toString();
        }
        else if ( getSelectedAttributeHierarchies().length == 1 )
        {
            IAttribute att = getSelectedAttributeHierarchies()[0].getAttribute();
            element = att;
            pageId = BrowserCommonConstants.PROP_ATTRIBUTE;
            title = att.toString();
        }
        else if ( getSelectedSearches().length == 1 )
        {
            element = ( IAdaptable ) getSelectedSearches()[0];
            pageId = BrowserCommonConstants.PROP_SEARCH;
View Full Code Here

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

                // necessary when navigating back, modifying object classes
                // and DN and navigation forward again.
                Collection<AttributeTypeDescription> oldMusts = SchemaUtils.getMustAttributeTypeDescriptions( newEntry );
                for ( AttributeTypeDescription oldMust : oldMusts )
                {
                    IAttribute attribute = newEntry.getAttribute( oldMust.getNumericOid() );
                    if ( attribute != null )
                    {
                        IValue[] values = attribute.getValues();
                        for ( int v = 0; v < values.length; v++ )
                        {
                            if ( values[v].isEmpty() )
                            {
                                attribute.deleteValue( values[v] );
                            }
                        }
                        if ( attribute.getValueSize() == 0 )
                        {
                            newEntry.deleteAttribute( attribute );
                        }
                    }
                }

                // add must attributes
                Collection<AttributeTypeDescription> newMusts = SchemaUtils.getMustAttributeTypeDescriptions( newEntry );
                for ( AttributeTypeDescription newMust : newMusts )
                {
                    if ( newEntry.getAttributeWithSubtypes( newMust.getNumericOid() ) == null )
                    {
                        String friendlyIdentifier = SchemaUtils.getFriendlyIdentifier( newMust );
                        IAttribute att = new Attribute( newEntry, friendlyIdentifier );
                        newEntry.addAttribute( att );
                        att.addEmptyValue();
                    }
                }
            }
            finally
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.