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

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


            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


        selectedConnection = entry.getBrowserConnection();

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

                        SchemaConstants.MODIFY_TIMESTAMP_AT } );

                LdifEnumeration le = ExportLdifRunnable.search( browserConnection, sp, monitor );
                if ( le.hasNext() )
                {
                    LdifContentRecord schemaRecord = ( LdifContentRecord ) le.next();
                    schema = new Schema();
                    schema.loadFromRecord( schemaRecord );
                    browserConnection.setSchema( schema );
                }
                else
View Full Code Here

            // clone entry and remove non-modifiable attributes
            try
            {
                EventRegistry.suspendEventFiringInCurrentThread();

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

            {
                LdifContainer container = enumeration.next();

                if ( container instanceof LdifContentRecord )
                {
                    LdifContentRecord record = ( LdifContentRecord ) container;
                    recordToHSSFRow( browserConnection, record, sheet, headerRow, attributeNameMap, valueDelimiter,
                        binaryEncoding, exportDn );

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

            {
                LdifContainer container = enumeration.next();

                if ( container instanceof LdifContentRecord )
                {
                    LdifContentRecord record = ( LdifContentRecord ) container;
                    recordToOdfRow( browserConnection, record, contentDoc, table, headerRow, attributeNameMap,
                        valueDelimiter, binaryEncoding, exportDn );

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

    {
        try
        {
            EventRegistry.suspendEventFiringInCurrentThread();
            IBrowserConnection browserConnection = entry.getBrowserConnection();
            LdifContentRecord record = ModelConverter.entryToLdifContentRecord( entry );
            IEntry clonedEntry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
            return clonedEntry;
        }
        catch ( LdapInvalidDnException e )
        {
View Full Code Here

    }


    public static LdifContentRecord entryToLdifContentRecord( IEntry entry )
    {
        LdifContentRecord record = LdifContentRecord.create( entry.getDn().getName() );

        if ( entry.getAttributes() != null )
        {
            for ( IAttribute attribute : entry.getAttributes() )
            {
                String name = attribute.getDescription();
                for ( IValue value : attribute.getValues() )
                {
                    if ( !value.isEmpty() )
                    {
                        if ( value.getRawValue() instanceof LdifPart )
                        {
                            LdifPart part = ( LdifPart ) value.getRawValue();
                            if ( part instanceof LdifCommentLine )
                            {
                                record.addComment( ( LdifCommentLine ) part );
                            }
                        }
                        else if ( value.isString() )
                        {
                            record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
                        }
                        else
                        {
                            record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
                        }
                    }
                }
            }
        }

        record.finish( LdifSepLine.create() );

        return record;
    }
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

            // Record
            if ( element instanceof LdifContentRecord )
            {
                if ( isLinkedToLdapBrowser )
                {
                    LdifContentRecord record = ( LdifContentRecord ) element;

                    LdifDnLine dnLine = record.getDnLine();
                    if ( dnLine != null )
                    {
                        String dn = dnLine.getUnfoldedDn();
                        if ( dn != null && "".equals( dn ) ) //$NON-NLS-1$
                        {
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.