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

Examples of org.apache.directory.ldapstudio.browser.core.internal.model.Value


                ocAttribute.deleteValue( values[i] );
            }
            for ( Iterator<ObjectClassDescription> it = selectedObjectClasses.iterator(); it.hasNext(); )
            {
                ObjectClassDescription ocd = it.next();
                ocAttribute.addValue( new Value( ocAttribute, ocd.getNames()[0] ) );
            }
        }
        catch ( ModelModificationException e )
        {
            e.printStackTrace();
View Full Code Here


       
        Object oldRawValue;
        try
        {
            IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
            IValue value = new Value( attribute, "" ); //$NON-NLS-1$
            oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
        }
        catch ( ModelModificationException e )
        {
            oldRawValue = valueEditor.getRawValue( context.getConnection(), "" ); //$NON-NLS-1$
View Full Code Here

        {
            Object oldRawValue;
            try
            {
                IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
                IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
                oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
            }
            catch ( ModelModificationException e )
            {
                oldRawValue = valueEditor.getRawValue( context.getConnection(), oldValue );
View Full Code Here

                        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
                    {
                        boolean mustAdd = true;
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getStringValue() ) )
                            {
                                mustAdd = false;
                                break;
                            }
                        }
                        if ( mustAdd )
                        {
                            rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                        }
                    }
                }

                newEntry.getConnection().create( newEntry, monitor );
View Full Code Here

                }
                String rdnValue = newRdnParts[i].getUnencodedValue();
                String[] stringValues = rdnAttribute.getStringValues();
                if ( !Arrays.asList( stringValues ).contains( rdnValue ) )
                {
                    rdnAttribute.addValue( new Value( rdnAttribute, rdnValue ) );
                }
            }

        }
        catch ( ModelModificationException e )
View Full Code Here

            {
                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

                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 )
        {
            return null;
View Full Code Here

        monitor.beginTask( BrowserCoreMessages.jobs__modify_value_task, 2 );
        monitor.reportProgress( " " ); //$NON-NLS-1$
        monitor.worked( 1 );

        IValue newValue = new Value( attribute, newRawValue );
        attribute.modifyValue( oldValue, newValue );
        attribute.getEntry().getConnection().modify( oldValue, newValue, monitor );

        this.event = new ValueModifiedEvent( attribute.getEntry().getConnection(), attribute.getEntry(), attribute,
            oldValue, newValue );
View Full Code Here

                // }
                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.internal.model.Value

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.