Package org.apache.directory.studio.ldifparser.model.container

Examples of org.apache.directory.studio.ldifparser.model.container.LdifContentRecord


            {
                LdifContainer container = enumeration.next();

                if ( container instanceof LdifContentRecord )
                {
                    LdifContentRecord record = ( LdifContentRecord ) container;
                    LdifDnLine dnLine = record.getDnLine();
                    LdifAttrValLine[] attrValLines = record.getAttrVals();
                    LdifSepLine sepLine = record.getSepLine();

                    // sort and format
                    DummyEntry entry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
                    AttributeComparator comparator = new AttributeComparator( entry );
                    Arrays.sort( attrValLines, comparator );
                    LdifContentRecord newRecord = new LdifContentRecord( dnLine );
                    for ( int i = 0; i < attrValLines.length; i++ )
                    {
                        newRecord.addAttrVal( attrValLines[i] );
                    }
                    newRecord.finish( sepLine );
                    String s = newRecord.toFormattedString( ldifFormatParameters );

                    // String s = record.toFormattedString();
                    bufferedWriter.write( s );

                    count++;
View Full Code Here


        public LdifContainer next() throws NamingException, LdapInvalidDnException
        {
            SearchResult sr = enumeration.next();
            Dn dn = JNDIUtils.getDn( sr );
            LdifContentRecord record = LdifContentRecord.create( dn.getName() );

            NamingEnumeration<? extends Attribute> attributeEnumeration = sr.getAttributes().getAll();
            while ( attributeEnumeration.hasMore() )
            {
                Attribute attribute = attributeEnumeration.next();
                String attributeName = attribute.getID();
                NamingEnumeration<?> valueEnumeration = attribute.getAll();
                while ( valueEnumeration.hasMore() )
                {
                    Object o = valueEnumeration.next();
                    if ( o instanceof String )
                    {
                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
                    }
                    if ( o instanceof byte[] )
                    {
                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
                    }
                }
            }

            record.finish( LdifSepLine.create() );

            return record;
        }
View Full Code Here

                LdifContainer container = enumeration.next();

                if ( container instanceof LdifContentRecord )
                {

                    LdifContentRecord record = ( LdifContentRecord ) container;
                    bufferedWriter.write( recordToCsv( browserConnection, record, attributes, attributeDelimiter,
                        valueDelimiter, quoteCharacter, lineSeparator, encoding, binaryEncoding, exportDn ) );

                    count++;
                    monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__export_progress,
View Full Code Here

        {
            LdifAttrValLine[] attrVals;
            IEntry dummyEntry;
            if ( record instanceof LdifContentRecord )
            {
                LdifContentRecord attrValRecord = ( LdifContentRecord ) record;
                attrVals = attrValRecord.getAttrVals();
                try
                {
                    dummyEntry = ModelConverter.ldifContentRecordToEntry( attrValRecord, browserConnection );
                }
                catch ( LdapInvalidDnException e )
View Full Code Here

        }

        // update shared working copy
        try
        {
            LdifContentRecord modifiedRecord = ( LdifContentRecord ) records[0];
            IBrowserConnection browserConnection = input.getSharedWorkingCopy( editor ).getBrowserConnection();
            DummyEntry modifiedEntry = ModelConverter.ldifContentRecordToEntry( modifiedRecord, browserConnection );
            ( ( DummyEntry ) input.getSharedWorkingCopy( editor ) ).setDn( modifiedEntry.getDn() );
            new CompoundModification().replaceAttributes( modifiedEntry, input.getSharedWorkingCopy( editor ), this );
        }
View Full Code Here

    }


    private void setDocumentInput( IDocument document, IEntry entry )
    {
        LdifContentRecord record = ModelConverter.entryToLdifContentRecord( entry );

        // sort attribute-value lines
        AttributeComparator comparator = new AttributeComparator( entry );
        LdifAttrValLine[] attrValLines = record.getAttrVals();
        Arrays.sort( attrValLines, comparator );
        LdifContentRecord newRecord = new LdifContentRecord( record.getDnLine() );
        for ( LdifAttrValLine attrValLine : attrValLines )
        {
            newRecord.addAttrVal( attrValLine );
        }
        newRecord.finish( record.getSepLine() );

        // format
        String newContent = newRecord.toFormattedString( Utils.getLdifFormatParameters() );

        // set content
        document.set( newContent );
    }
View Full Code Here

            // clone entry and remove non-modifyable attributes
            try
            {
                EventRegistry.suspendEventFireingInCurrentThread();

                LdifContentRecord record = ModelConverter.entryToLdifContentRecord( templateEntries[0] );
                DummyEntry prototypeEntry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
                IAttribute[] attributes = prototypeEntry.getAttributes();
                for ( int i = 0; i < attributes.length; i++ )
                {
                    if ( !SchemaUtils.isModifyable( attributes[i].getAttributeTypeDescription() ) )
View Full Code Here

            }

            // record --> Array of List of AttrValLine
            else if ( element instanceof LdifContentRecord )
            {
                LdifContentRecord record = ( LdifContentRecord ) element;
                return getUniqueAttrValLineArray( record.getAttrVals() );
            }
            else if ( element instanceof LdifChangeAddRecord )
            {
                LdifChangeAddRecord record = ( LdifChangeAddRecord ) element;
                return getUniqueAttrValLineArray( record.getAttrVals() );
            }
            else if ( element instanceof LdifChangeModifyRecord )
            {
                LdifChangeModifyRecord record = ( LdifChangeModifyRecord ) element;
                return record.getModSpecs();
            }
            else if ( element instanceof LdifChangeModDnRecord )
            {
                return new Object[0];
            }
View Full Code Here

            if ( studioSearchResult != null )
            {
                String dn = studioSearchResult.getNameInNamespace();
                Attributes attributes = studioSearchResult.getAttributes();

                LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( dn ) );
                NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
                while ( attributeEnumeration.hasMore() )
                {
                    Attribute attribute = attributeEnumeration.next();
                    String attributeName = attribute.getID();
                    NamingEnumeration<?> valueEnumeration = attribute.getAll();
                    while ( valueEnumeration.hasMore() )
                    {
                        Object o = valueEnumeration.next();
                        if ( o instanceof String )
                        {
                            record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
                        }
                        if ( o instanceof byte[] )
                        {
                            record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
                        }
                    }
                }
                record.finish( LdifSepLine.create() );
                formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT );
            }
            else
            {
                formattedString = LdifFormatParameters.DEFAULT.getLineSeparator();
            }
View Full Code Here

        }

        try
        {
            EventRegistry.suspendEventFireingInCurrentThread();
            LdifContentRecord record = ModelConverter.entryToLdifContentRecord( selectedEntry );
            prototypeEntry = ModelConverter.ldifContentRecordToEntry( record, selectedConnection );
        }
        catch ( Exception e )
        {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldifparser.model.container.LdifContentRecord

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.