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

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


            if ( attributeHierarchie == null )
            {
                EventRegistry.suspendEventFireingInCurrentThread();
                try
                {
                    IAttribute attribute = new Attribute( entry, attributeDescription );
                    entry.addAttribute( attribute );
                    attribute.addEmptyValue();
                }
                catch ( ModelModificationException e )
                {
                }
                EventRegistry.resumeEventFireingInCurrentThread();
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

                    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

                    List valueList = new ArrayList( Arrays.asList( values ) );

                    // filter empty attributes and values
                    for ( Iterator it = attributeList.iterator(); it.hasNext(); )
                    {
                        IAttribute att = ( IAttribute ) it.next();
                        IValue[] vals = att.getValues();
                        for ( int i = 0; i < vals.length; i++ )
                        {
                            if ( vals[i].isEmpty() )
                            {
                                att.deleteEmptyValue();
                            }
                        }
                        if ( att.getValueSize() == 0 )
                        {
                            try
                            {
                                att.getEntry().deleteAttribute( att );
                            }
                            catch ( ModelModificationException e )
                            {
                            }
                            it.remove();
View Full Code Here

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

        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 );
                }
            }
        }

        // check if ALL values of an attribute are selected -> delete whole
        // attribute
        Map attributeNameToSelectedValuesCountMap = new HashMap();
        for ( int i = 0; i < getSelectedValues().length; i++ )
        {
            if ( !attributeNameToSelectedValuesCountMap.containsKey( getSelectedValues()[i].getAttribute()
                .getDescription() ) )
            {
                attributeNameToSelectedValuesCountMap.put( getSelectedValues()[i].getAttribute().getDescription(),
                    new Integer( 0 ) );
            }
            int count = ( ( Integer ) attributeNameToSelectedValuesCountMap.get( getSelectedValues()[i].getAttribute()
                .getDescription() ) ).intValue() + 1;
            attributeNameToSelectedValuesCountMap.put( getSelectedValues()[i].getAttribute().getDescription(),
                new Integer( count ) );
            if ( count >= getSelectedValues()[i].getAttribute().getValueSize() )
            {
                IAttribute attribute = getSelectedValues()[i].getAttribute();
                if ( attribute != null && !attributeList.contains( attribute ) )
                {
                    attributeList.add( attribute );
                }
            }
View Full Code Here

            }
            // check against attributes
            IAttribute[] attributes = entry.getAttributes();
            for ( int i = 0; i < attributes.length; i++ )
            {
                IAttribute attribute = attributes[i];
                if ( attribute.isMayAttribute() || attribute.isMustAttribute() )
                {
                    if ( !remainingAttributeSet.contains( attribute.getType() ) )
                    {
                        throw new Exception();
                    }
                }
            }
View Full Code Here

        }
        else
        {
            // get naming contexts
            Set<String> namingContextSet = new HashSet<String>();
            IAttribute attribute = rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_NAMINGCONTEXTS );
            if ( attribute != null )
            {
                String[] values = attribute.getStringValues();
                for ( int i = 0; i < values.length; i++ )
                {
                    namingContextSet.add( values[i] );
                }
            }
View Full Code Here

    private DirectoryMetadataEntry[] getDirectoryMetadataEntries( String metadataAttributeName )
        throws ModelModificationException
    {
        List metadataEntryList = new ArrayList();
        IAttribute attribute = this.rootDSE.getAttribute( metadataAttributeName );
        if ( attribute != null )
        {
            String[] values = attribute.getStringValues();
            for ( int i = 0; i < values.length; i++ )
            {
                try
                {
                    metadataEntryList.add( new DN( values[i] ) );
View Full Code Here

        IValue[] newValues = new IValue[oldValues.length];
        for ( int i = 0; i < oldValues.length; i++ )
        {

            IAttribute newAttribute = entry.getAttribute( newAttributeName );
            if ( newAttribute == null )
            {
                newAttribute = new Attribute( entry, newAttributeName );
                entry.addAttribute( newAttribute );
            }

            newValues[i] = new Value( newAttribute, oldValues[i].getRawValue() );
            newAttribute.addValue( newValues[i] );

            oldValues[i].getAttribute().deleteValue( oldValues[i] );

            if ( this.event == null )
            {
View Full Code Here

        List attributeList = new ArrayList();
        Iterator iterator = attributeMap.values().iterator();
        while ( iterator.hasNext() )
        {
            IAttribute attribute = ( IAttribute ) iterator.next();

            AttributeDescription other = new AttributeDescription( attributeDescription );
            if ( other.isSubtypeOf( ad, getConnection().getSchema() ) )
            {
                attributeList.add( attribute );
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.