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

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


    {

        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 )
            {
                try
                {
                    ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                        { new Attribute( result.getEntry(), property ) } );
                }
                catch ( ModelModificationException e )
                {
                    e.printStackTrace();
                    return false;
                }
            }

            // check schema modifyable
            boolean isOneModifyable = false;
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( SchemaUtils.isModifyable( attribute.getAttributeTypeDescription() ) )
                {
                    isOneModifyable = true;
                    break;
                }
            }
            if ( !isOneModifyable )
            {
                return false;
            }

            // check if property is valid for the entry
            boolean isOneValid = false;
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( attribute.isObjectClassAttribute() || attribute.isMustAttribute() || attribute.isMayAttribute() )
                {
                    isOneValid = true;
View Full Code Here


    {

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

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

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

        }

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            try
            {
                // switch operation:
                if ( ah == null && newRawValue != null )
                {
                    this.valueEditorManager.getCurrentValueEditor( result.getEntry(), property ).createValue(
                        result.getEntry(), property, newRawValue );
                }
                else if ( ah != null && newRawValue == null )
                {
                    this.valueEditorManager.getCurrentValueEditor( ah ).deleteAttribute( ah );
                }
                else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
                {
                    this.valueEditorManager.getCurrentValueEditor( ah ).modifyValue( ah.getAttribute().getValues()[0],
                        newRawValue );
                }
            }
            catch ( ModelModificationException mme )
            {
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

                for ( int i = 0; i < objects.length; i++ )
                {
                    Object object = objects[i];
                    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++ )
View Full Code Here

        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

        {
            return null;
        }
        else
        {
            AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, ( IAttribute[] ) attributeList
                .toArray( new IAttribute[attributeList.size()] ) );
            return ah;
        }
    }
View Full Code Here

                return null;
            }
            else
            {
                IAttribute[] attributes = ( IAttribute[] ) attributeList.toArray( new IAttribute[attributeList.size()] );
                AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, attributes );
                return ah;
            }
        }
    }
View Full Code Here

               
               
                for ( int r = 0; r < ras.length; r++ )
                {
                    // clear attributes requested from server, also include subtypes
                    AttributeHierarchy ah = entry.getAttributeWithSubtypes( ras[r] );
                    if ( ah != null )
                    {
                        for ( Iterator it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = ( IAttribute ) it.next();
                            try
                            {
                                entry.deleteAttribute( attribute );
View Full Code Here

     */
    public void activate()
    {
        if ( this.getValue() != null && this.getValue() instanceof AttributeHierarchy )
        {
            AttributeHierarchy ah = ( AttributeHierarchy ) this.getValue();
            if ( ah != null )
            {
                MultivaluedDialog dialog = new MultivaluedDialog( this.parent.getShell(), ah );
                dialog.open();
            }
View Full Code Here

TOP

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