Package org.apache.directory.ldapstudio.browser.core.model

Examples of org.apache.directory.ldapstudio.browser.core.model.IAttribute


    {

        List<IValue> valueList = new ArrayList<IValue>();
        for ( Iterator it = attributeHierarchy.iterator(); it.hasNext(); )
        {
            IAttribute attribute = ( IAttribute ) it.next();
            valueList.addAll( Arrays.asList( attribute.getValues() ) );
        }

        StringBuffer sb = new StringBuffer();
        if ( valueList.size() > 1 )
            sb.append( valueList.size() + " values: " );
View Full Code Here


                        else
                        {
                            return null;
                        }

                        IAttribute attribute = null;
                        if ( readIn.available() > 1 && entry != null )
                        {
                            int size = readIn.readInt();
                            byte[] attributeName = new byte[size];
                            readIn.read( attributeName );
                            attribute = entry.getAttribute( new String( attributeName ) );
                        }
                        else
                        {
                            return null;
                        }

                        IValue value = null;
                        if ( readIn.available() > 1 && attribute != null )
                        {
                            boolean isString = readIn.readBoolean();
                            int size = readIn.readInt();
                            byte[] val = new byte[size];
                            readIn.read( val );
                            String test = new String( val );

                            IValue[] values = attribute.getValues();
                            for ( int i = 0; i < values.length; i++ )
                            {
                                if ( isString && values[i].isString() && test.equals( values[i].getStringValue() ) )
                                {
                                    value = values[i];
View Full Code Here

        }

        List<IValue> valueList = new ArrayList<IValue>();
        for ( Iterator it = attributeHierarchy.iterator(); it.hasNext(); )
        {
            IAttribute attribute = ( IAttribute ) it.next();
            valueList.addAll( Arrays.asList( attribute.getValues() ) );
        }

        StringBuffer sb = new StringBuffer();
        for ( Iterator<IValue> it = valueList.iterator(); it.hasNext(); )
        {
View Full Code Here

            this.selectedObjectClasses = new ArrayList();
        }

        if ( entry != null )
        {
            IAttribute oca = entry.getAttribute( IAttribute.OBJECTCLASS_ATTRIBUTE );
            if ( oca != null )
            {
                selectedObjectClasses.addAll( Arrays.asList( oca.getStringValues() ) );
            }
        }
    }
View Full Code Here

            // remove old RDN
            RDNPart[] oldRdnParts = newEntry.getRdn().getParts();
            for ( int i = 0; i < oldRdnParts.length; i++ )
            {
                IAttribute attribute = newEntry.getAttribute( oldRdnParts[i].getType() );
                if ( attribute != null )
                {
                    IValue[] values = attribute.getValues();
                    for ( int v = 0; v < values.length; v++ )
                    {
                        if ( values[v].getStringValue().equals( oldRdnParts[i].getUnencodedValue() ) )
                        {
                            attribute.deleteValue( values[v] );
                        }
                    }
                }
            }

            // set new DN
            DN dn = new DN( this.dnBuilderWidget.getRdn(), this.dnBuilderWidget.getParentDn() );
            newEntry.setDn( dn );

            // add new RDN
            RDNPart[] newRdnParts = dn.getRdn().getParts();
            for ( int i = 0; i < newRdnParts.length; i++ )
            {
                IAttribute rdnAttribute = newEntry.getAttribute( newRdnParts[i].getType() );
                if ( rdnAttribute == null )
                {
                    rdnAttribute = new Attribute( newEntry, newRdnParts[i].getType() );
                    newEntry.addAttribute( rdnAttribute );
                }
                String rdnValue = newRdnParts[i].getUnencodedValue();
                String[] stringValues = rdnAttribute.getStringValues();
                if ( !Arrays.asList( stringValues ).contains( rdnValue ) )
                {
                    rdnAttribute.addValue( new Value( rdnAttribute, rdnValue ) );
                }
            }

        }
        catch ( ModelModificationException e )
View Full Code Here

                        IEntry entry = value.getAttribute().getEntry();
                        select( entry );
                    }
                    else if ( obj instanceof IAttribute )
                    {
                        IAttribute attribute = ( IAttribute ) obj;
                        IEntry entry = attribute.getEntry();
                        select( entry );

                    }
                    else if ( obj instanceof ISearchResult )
                    {
View Full Code Here

                    if ( object instanceof AttributeHierarchy )
                    {
                        AttributeHierarchy ah = ( AttributeHierarchy ) object;
                        for ( Iterator it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = ( IAttribute ) it.next();
                            entry = attribute.getEntry();
                            IValue[] values = attribute.getValues();
                            for ( int v = 0; v < values.length; v++ )
                            {
                                filterSet.add( LdapFilterUtils.getFilter( values[v] ) );
                            }
                        }
                    }
                    else if ( object instanceof IAttribute )
                    {
                        IAttribute attribute = ( IAttribute ) object;
                        entry = attribute.getEntry();
                        IValue[] values = attribute.getValues();
                        for ( int v = 0; v < values.length; v++ )
                        {
                            filterSet.add( LdapFilterUtils.getFilter( values[v] ) );
                        }
                    }
View Full Code Here

                    return "";
            }
        }
        else if ( obj != null && obj instanceof IAttribute )
        {
            IAttribute attribute = ( IAttribute ) obj;
            if ( index == EntryEditorWidgetTableMetadata.KEY_COLUMN_INDEX )
            {
                return attribute.getDescription() + " (" + attribute.getValueSize() + " values)";
            }
            else
            {
                return "";
            }
View Full Code Here


    public Font getFont( Object element )
    {

        IAttribute attribute = null;
        IValue value = null;
        if ( element instanceof IAttribute )
        {
            attribute = ( IAttribute ) element;
        }
        else if ( element instanceof IValue )
        {
            value = ( IValue ) element;
            attribute = value.getAttribute();
        }

        // inconsistent attributes and values
        if ( value != null )
        {
            if ( value.isEmpty() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_ERROR_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
        }
        if ( attribute != null && value == null )
        {
            if ( !attribute.isConsistent() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_ERROR_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
        }

        // attribute type
        if ( attribute != null )
        {
            if ( attribute.isObjectClassAttribute() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_OBJECTCLASS_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
            else if ( attribute.isMustAttribute() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_MUSTATTRIBUTE_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
            else if ( attribute.isOperationalAttribute() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
View Full Code Here

    {

        if ( event instanceof EmptyValueAddedEvent && !this.editor.getActionGroup().isEditorActive() )
        {
            EmptyValueAddedEvent evae = ( EmptyValueAddedEvent ) event;
            IAttribute att = evae.getAddedValue().getAttribute();
            AttributeHierarchy ah = cursor.getSelectedAttributeHierarchie();
            if ( ah != null && ah.contains( att ) )
            {
                viewer.setSelection( null, true );
                viewer.getTable().setSelection( new TableItem[0] );
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.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.