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

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


        for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
        {
            // check if a non-modifyable, must or objectClass attribute is
            // selected
            AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( !SchemaUtils.isModifyable( attribute.getAttributeTypeDescription() )
                    || attribute.isMustAttribute() || attribute.isObjectClassAttribute() )
                {
                    throw new Exception();
                }
            }
        }

        List attributeList = new ArrayList();

        // add selected attributes
        for ( int i = 0; i < getSelectedAttributes().length; i++ )
        {
            IAttribute attribute = getSelectedAttributes()[i];
            if ( attribute != null && attribute.getValueSize() > 0 )
            {
                attributeList.add( attribute );
            }
        }

        // add selected hierarchies
        for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
        {
            // check if a operational, must or objectClass attribute is
            // selected
            AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( attribute != null && attribute.getValueSize() > 0 )
                {
                    attributeList.add( attribute );
View Full Code Here


            }
            for ( int a = 0; returningAttributes != null && a < returningAttributes.length; a++ )
            {

                AttributeComparator comparator = new AttributeComparator( entries[e] );
                AttributeHierarchy ah = entries[e].getAttributeWithSubtypes( returningAttributes[a] );
                if ( ah != null )
                {

                    StringBuffer valueSB = new StringBuffer();

                    for ( Iterator it = ah.iterator(); it.hasNext(); )
                    {
                        IAttribute attribute = ( IAttribute ) it.next();
                        if ( attribute != null )
                        {
View Full Code Here

            Object o = this.getRow().getData();
            String property = ( String ) this.viewer.getColumnProperties()[this.getColumn()];
            if ( o instanceof ISearchResult && !BrowserUIConstants.DN.equals( property ) )
            {
                ISearchResult sr = ( ISearchResult ) o;
                AttributeHierarchy ah = sr.getAttributeWithSubtypes( property );

                if ( ah == null )
                {
                    try
                    {
                        ah = new AttributeHierarchy( sr.getEntry(), property, new IAttribute[]
                            { new Attribute( sr.getEntry(), property ) } );
                    }
                    catch ( ModelModificationException e )
                    {
                        e.printStackTrace();
View Full Code Here


    public ISelection getSelection()
    {
        ISearchResult searchResult = this.getSelectedSearchResult();
        AttributeHierarchy ah = this.getSelectedAttributeHierarchie();
        String property = this.getSelectedProperty();
        // String attributeName = this.getSelectedAttributeName();

        // System.out.println(attributes.length);
View Full Code Here

        {
            return compare( entry1.getDn().toString(), entry2.getDn().toString() );
        }
        else
        {
            AttributeHierarchy ah1 = entry1.getAttributeWithSubtypes( attributeName );
            AttributeHierarchy ah2 = entry2.getAttributeWithSubtypes( attributeName );
            if ( ah1 == null && ah2 == null )
            {
                return this.equal();
            }
            else if ( ah1 == null && ah2 != null )
            {
                return this.lessThan();
            }
            else if ( ah1 != null && ah2 == null )
            {
                return this.greaterThan();
            }
            else
            {
                IAttribute attribute1 = ah1.getAttribute();
                IAttribute attribute2 = ah2.getAttribute();

                String value1 = getValue( attribute1 );
                String value2 = getValue( attribute2 );
                return compare( value1, value2 );
            }
View Full Code Here

                // compare normalized names
                return compare( entry1.getDn().getNormName(), entry2.getDn().getNormName() );
            }
            else
            {
                AttributeHierarchy ah1 = entry1.getAttributeWithSubtypes( attributeName );
                AttributeHierarchy ah2 = entry2.getAttributeWithSubtypes( attributeName );
                if ( ah1 == null && ah2 == null )
                {
                    return equal();
                }
                else if ( ah1 == null && ah2 != null )
                {
                    return lessThan();
                }
                else if ( ah1 != null && ah2 == null )
                {
                    return greaterThan();
                }
                else
                {
                    IAttribute attribute1 = ah1.getAttribute();
                    IAttribute attribute2 = ah2.getAttribute();

                    String value1 = getValue( attribute1 );
                    String value2 = getValue( attribute2 );
                    return compare( value1, value2 );
                }
View Full Code Here

    public boolean canModify( Object element, String property )
    {
        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            // check DN
            if ( BrowserUIConstants.DN.equals( property ) )
            {
                return false;
            }

            // attribute dummy
            if ( ah == null )
            {
                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                    { new Attribute( result.getEntry(), property ) } );
            }

            // call value editor
            return valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah ) != null;
View Full Code Here

    {
        if ( element != null && element instanceof ISearchResult && property != null )
        {
            // perform modifications on the clone
            ISearchResult result = cursor.getSelectedSearchResult();
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            if ( !canModify( element, property ) )
            {
                return null;
            }

            if ( ah == null )
            {
                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                    { new Attribute( result.getEntry(), property ) } );
            }

            return valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah );
        }
View Full Code Here

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            // perform modifications on the clone
            ISearchResult result = cursor.getSelectedSearchResult();
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            // switch operation:
            if ( ah == null && newRawValue != null )
            {
                new CompoundModification().createValue( result.getEntry(), property, newRawValue );
            }
            else if ( ah != null && newRawValue == null )
            {
                List<IValue> values = new ArrayList<IValue>();
                for ( IAttribute attribute : ah.getAttributes() )
                {
                    for ( IValue value : attribute.getValues() )
                    {
                        values.add( value );
                    }
                }
                new CompoundModification().deleteValues( values );
            }
            else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
            {
                new CompoundModification().modifyValue( ah.getAttribute().getValues()[0], newRawValue );
            }
        }
    }
View Full Code Here

        {
            ISearchResult sr = getSelectedSearchResult();
            String property = ( String ) viewer.getColumnProperties()[getColumn()];
            if ( sr != null && !BrowserUIConstants.DN.equals( property ) )
            {
                AttributeHierarchy ah = sr.getAttributeWithSubtypes( property );

                if ( ah == null )
                {
                    ah = new AttributeHierarchy( sr.getEntry(), property, new IAttribute[]
                        { new Attribute( sr.getEntry(), property ) } );
                }

                return ah;
            }
View Full Code Here

TOP

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

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.