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

Examples of org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute


                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


            // set new objectClass values
            IAttribute ocAttribute = newEntry.getAttribute( IAttribute.OBJECTCLASS_ATTRIBUTE );
            if ( ocAttribute == null )
            {
                ocAttribute = new Attribute( newEntry, IAttribute.OBJECTCLASS_ATTRIBUTE );
                newEntry.addAttribute( ocAttribute );
            }
            IValue[] values = ocAttribute.getValues();
            for ( int i = 0; i < values.length; i++ )
            {
View Full Code Here

                String[] newMust = newEntry.getSubschema().getMustAttributeNames();
                for ( int i = 0; i < newMust.length; i++ )
                {
                    if ( newEntry.getAttribute( newMust[i] ) == null )
                    {
                        IAttribute att = new Attribute( newEntry, newMust[i] );
                        newEntry.addAttribute( att );
                        att.addEmptyValue();

                        if ( editValue == null )
                        {
                            editValue = att.getValues()[0];
                        }
                    }
                }
            }
            catch ( ModelModificationException e )
View Full Code Here

                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

                }
            }
            else
            {
                EventRegistry.suspendEventFireingInCurrentThread();
                IAttribute attribute = new Attribute( entry, attributeDescription );
                entry.addAttribute( attribute );
                EventRegistry.resumeEventFireingInCurrentThread();

                Object newValue;
                if ( entry.getBrowserConnection().getSchema().getAttributeTypeDescription( attributeDescription )
View Full Code Here

                    try
                    {
                        IAttribute att = entry.getAttribute( newAttributeDescription );
                        if ( att == null )
                        {
                            att = new Attribute( entry, newAttributeDescription );
                            entry.addAttribute( att ) ;
                        }

                        att.addEmptyValue();
                    }
View Full Code Here

        if ( value != null )
        {
            try
            {
                DummyEntry dummyEntry = new DummyEntry( new DN( dn ), connection );
                Attribute dummyAttribute = new Attribute( dummyEntry, description );
                Value dummyValue = new Value( dummyAttribute, value );

                rawValue = valueEditor.getRawValue( dummyValue );
            }
            catch ( NameException e )
View Full Code Here

            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

                    IAttribute attributeToCopy = attributesToCopy[i];

                    if ( SchemaUtils.isModifyable( attributeToCopy.getAttributeTypeDescription() )
                        || IAttribute.REFERRAL_ATTRIBUTE.equalsIgnoreCase( attributeToCopy.getDescription() ) )
                    {
                        IAttribute newAttribute = new Attribute( newEntry, attributeToCopy.getDescription() );
                        newEntry.addAttribute( newAttribute );
                        IValue[] valuesToCopy = attributeToCopy.getValues();
                        for ( int j = 0; j < valuesToCopy.length; j++ )
                        {
                            IValue valueToCopy = valuesToCopy[j];
                            IValue newValue = new Value( newAttribute, valueToCopy.getRawValue() );
                            newAttribute.addValue( newValue );
                        }
                    }
                }

                // check if RDN attributes ar present
                RDN newRdn = newEntry.getRdn();
                RDNPart[] oldRdnParts = rdn.getParts();
                for ( int i = 0; i < oldRdnParts.length; i++ )
                {
                    RDNPart part = oldRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute != null )
                    {
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getRawValue() ) )
                            {
                                rdnAttribute.deleteValue( values[ii] );
                            }
                            if ( rdnAttribute.getValueSize() == 0 )
                            {
                                newEntry.deleteAttribute( rdnAttribute );
                            }
                        }
                    }
                }
                RDNPart[] newRdnParts = newRdn.getParts();
                for ( int i = 0; i < newRdnParts.length; i++ )
                {
                    RDNPart part = newRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute == null )
                    {
                        rdnAttribute = new Attribute( newEntry, part.getType() );
                        newEntry.addAttribute( rdnAttribute );
                        rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                    }
                    else
                    {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute

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.