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

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


    {
        // check empty attributes and empty values
        Iterator attributeIterator = attributeMap.values().iterator();
        while ( attributeIterator.hasNext() )
        {
            IAttribute attribute = ( IAttribute ) attributeIterator.next();
            if ( !attribute.isConsistent() )
                return false;
        }

        // check objectclass attribute
        if ( !attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() ) )
        {
            return false;
        }
        IAttribute ocAttribute = ( IAttribute ) attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() );
        String[] ocValues = ocAttribute.getStringValues();
        boolean structuralObjectClassAvailable = false;
        for ( int i = 0; i < ocValues.length; i++ )
        {
            ObjectClassDescription ocd = this.getConnection().getSchema().getObjectClassDescription( ocValues[i] );
            if ( ocd.isStructural() )
View Full Code Here


            if ( parts[i] instanceof LdifAttrValLine )
            {
                LdifAttrValLine line = ( LdifAttrValLine ) parts[i];
                String attributeName = line.getUnfoldedAttributeDescription();
                Object value = line.getValueAsObject();
                IAttribute attribute = entry.getAttribute( attributeName );
                if ( attribute == null )
                {
                    attribute = new Attribute( entry, attributeName );
                    entry.addAttribute( attribute );
                }
                attribute.addValue( new Value( attribute, value ) );
            }
            else if ( !( parts[i] instanceof LdifDnLine ) && !( parts[i] instanceof LdifSepLine ) )
            {
                String name = parts[i].toRawString();
                name = name.replaceAll( "\n", "" );
                name = name.replaceAll( "\r", "" );
                IAttribute attribute = new Attribute( entry, name );
                attribute.addValue( new Value( attribute, parts[i] ) );
                entry.addAttribute( attribute );
                // IAttribute attribute = entry.getAttribute("");
                // if(attribute == null) {
                // attribute = new Attribute(entry, "");
                // entry.addAttribute(attribute, null);
View Full Code Here

    public static IValue ldifAttrValLineToValue( LdifAttrValLine line, IEntry entry )
    {
        try
        {
            IAttribute attribute = new Attribute( entry, line.getUnfoldedAttributeDescription() );
            IValue value = new Value( attribute, line.getValueAsObject() );
            return value;
        }
        catch ( Exception e )
        {
View Full Code Here

        // check argument
        if ( o == null || !( o instanceof IAttribute ) )
        {
            return false;
        }
        IAttribute a = ( IAttribute ) o;

        // compare entries
        if ( !getEntry().equals( a.getEntry() ) )
        {
            return false;
        }

        // compare attribute description
        return getDescription().equals( a.getDescription() );
    }
View Full Code Here

        // IAttribute attribute =
        // (IAttribute)ai.attributeMap.get(attributeToDelete.getDescription().toLowerCase());
        // ai.attributeMap.remove(attributeToDelete.getDescription().toLowerCase());
        if ( ai != null && ai.attributeMap != null && ai.attributeMap.containsKey( oidString.toLowerCase() ) )
        {
            IAttribute attribute = ( IAttribute ) ai.attributeMap.get( oidString.toLowerCase() );
            ai.attributeMap.remove( oidString.toLowerCase() );
            if ( ai.attributeMap.isEmpty() )
            {
                this.getJNDIConnection().setAttributeInfo( this, null );
            }
View Full Code Here

        // check empty attributes and empty values
        Iterator attributeIterator = ai.attributeMap.values().iterator();
        while ( attributeIterator.hasNext() )
        {
            IAttribute attribute = ( IAttribute ) attributeIterator.next();
            if ( !attribute.isConsistent() )
                return false;
        }

        if ( !this.isDirectoryEntry() )
        {
            // check objectclass attribute
            if ( !ai.attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() ) )
            {
                return false;
            }
            IAttribute ocAttribute = ( IAttribute ) ai.attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE_OID
                .toLowerCase() );
            String[] ocValues = ocAttribute.getStringValues();
            boolean structuralObjectClassAvailable = false;
            for ( int i = 0; i < ocValues.length; i++ )
            {
                ObjectClassDescription ocd = this.getConnection().getSchema().getObjectClassDescription( ocValues[i] );
                if ( ocd.isStructural() )
View Full Code Here

        }
        else
        {
            List attributeList = new ArrayList();

            IAttribute myAttribute = getAttribute( attributeDescription );
            if ( myAttribute != null )
            {
                attributeList.add( myAttribute );
            }

            AttributeDescription ad = new AttributeDescription( attributeDescription );
            Map clonedAttributeMap = new HashMap( ai.attributeMap );
            Iterator iterator = clonedAttributeMap.values().iterator();
            while ( iterator.hasNext() )
            {
                IAttribute attribute = ( IAttribute ) iterator.next();

                AttributeDescription other = attribute.getAttributeDescription();
                if ( other.isSubtypeOf( ad, getConnection().getSchema() ) )
                {
                    attributeList.add( attribute );
                }
            }
View Full Code Here

            Set suppportedConrolSet = new HashSet();
            if ( connection.getRootDSE() != null
                && connection.getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDCONTROL ) != null )
            {
                IAttribute scAttribute = connection.getRootDSE().getAttribute(
                    IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDCONTROL );
                String[] supportedControls = scAttribute.getStringValues();
                for ( int i = 0; i < supportedControls.length; i++ )
                {
                    suppportedConrolSet.add( supportedControls[i].toLowerCase() );
                }
            }
View Full Code Here

                    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 );
                            }
                            catch ( ModelModificationException e )
                            {
                            }
                        }
                    }
                }
            }
            else
            {
                // clear all
                IAttribute[] oldAttributes = entry.getAttributes();
                for ( int i = 0; oldAttributes != null && i < oldAttributes.length; i++ )
                {
                    try
                    {
                        entry.deleteAttribute( oldAttributes[i] );
                    }
                    catch ( ModelModificationException e )
                    {
                    }
                }
            }


            // additional clear old attributes if the record contains the
            // attribute
            for ( int i = 0; i < lines.length; i++ )
            {
                String attributeDesc = lines[i].getUnfoldedAttributeDescription();
                IAttribute oldAttribute = entry.getAttribute( attributeDesc );
                if ( oldAttribute != null )
                {
                    try
                    {
                        entry.deleteAttribute( oldAttribute );
                    }
                    catch ( ModelModificationException mme )
                    {
                    }
                }
            }

            // set new attributes and values
            for ( int i = 0; i < lines.length; i++ )
            {

                IAttribute attribute = null;
                String attributeName = lines[i].getUnfoldedAttributeDescription();
                // attributeName = attributeName.replaceAll(";binary", "");
                if ( entry.getAttribute( attributeName ) == null )
                {
                    attribute = new Attribute( entry, attributeName );
                    entry.addAttribute( attribute );
                }
                else
                {
                    attribute = entry.getAttribute( attributeName );
                }

                attribute.addValue( new Value( attribute, lines[i].getValueAsObject() ) );
            }
        }
    }
View Full Code Here

        monitor.worked( 1 );

        IValue[] newValues = new IValue[rawValues.length];
        for ( int i = 0; i < newValues.length; i++ )
        {
            IAttribute attribute = entry.getAttribute( attributeDescriptions[i] );
            if ( attribute == null )
            {
                // String[] possibleAttributeNames =
                // entry.getSubschema().getAllAttributeNames();
                // if(!Arrays.asList(possibleAttributeNames).contains(attributeNames[i]))
                // {
                // throw new ModelModificationException("Attribute
                // "+attributeNames[i]+" is not in subschema");
                // }
                attribute = new Attribute( entry, attributeDescriptions[i] );
                entry.addAttribute( attribute );
            }

            newValues[i] = new Value( attribute, rawValues[i] );
            attribute.addValue( newValues[i] );

            if ( this.event == null )
            {
                event = new ValueAddedEvent( entry.getConnection(), entry, attribute, newValues[i] );
            }
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.