Package org.apache.james.mailbox.store.mail.model

Examples of org.apache.james.mailbox.store.mail.model.PropertyBuilder


        List<Header> originalHeaders = original.getHeaders();
        for (int i = 0; i < originalHeaders.size(); i++) {
            headers.add(new JPAHeader(originalHeaders.get(i)));
        }

        PropertyBuilder pBuilder = new PropertyBuilder(original.getProperties());
        this.textualLineCount = original.getTextualLineCount();
        this.mediaType = original.getMediaType();
        this.subType = original.getSubType();
        final List<Property> properties = pBuilder.toProperties();
        this.properties = new ArrayList<JPAProperty>(properties.size());
        int order = 0;
        for (final Property property:properties) {
            this.properties.add(new JPAProperty(property, order++));
        }
View Full Code Here


                    headers.add(header);
                }
                next = parser.next();
            }
            final MaximalBodyDescriptor descriptor = (MaximalBodyDescriptor) parser.getBodyDescriptor();
            final PropertyBuilder propertyBuilder = new PropertyBuilder();
            final String mediaType;
            final String mediaTypeFromHeader = descriptor.getMediaType();
            final String subType;
            if (mediaTypeFromHeader == null) {
                mediaType = "text";
                subType = "plain";
            } else {
                mediaType = mediaTypeFromHeader;
                subType = descriptor.getSubType();
            }
            propertyBuilder.setMediaType(mediaType);
            propertyBuilder.setSubType(subType);
            propertyBuilder.setContentID(descriptor.getContentId());
            propertyBuilder.setContentDescription(descriptor.getContentDescription());
            propertyBuilder.setContentLocation(descriptor.getContentLocation());
            propertyBuilder.setContentMD5(descriptor.getContentMD5Raw());
            propertyBuilder.setContentTransferEncoding(descriptor.getTransferEncoding());
            propertyBuilder.setContentLanguage(descriptor.getContentLanguage());
            propertyBuilder.setContentDispositionType(descriptor.getContentDispositionType());
            propertyBuilder.setContentDispositionParameters(descriptor.getContentDispositionParameters());
            propertyBuilder.setContentTypeParameters(descriptor.getContentTypeParameters());
            // Add missing types
            final String codeset = descriptor.getCharset();
            if (codeset == null) {
                if ("TEXT".equalsIgnoreCase(mediaType)) {
                    propertyBuilder.setCharset("us-ascii");
                }
            } else {
                propertyBuilder.setCharset(codeset);
            }
           
            final String boundary = descriptor.getBoundary();
            if (boundary != null) {
                propertyBuilder.setBoundary(boundary);
            }  
            if ("text".equalsIgnoreCase(mediaType)) {
                final CountingInputStream bodyStream = new CountingInputStream(parser.getInputStream());
                bodyStream.readAll();
                long lines = bodyStream.getLineCount();
               
                next = parser.next();
                if (next == MimeTokenStream.T_EPILOGUE)  {
                    final CountingInputStream epilogueStream = new CountingInputStream(parser.getInputStream());
                    epilogueStream.readAll();
                    lines+=epilogueStream.getLineCount();
                }
                propertyBuilder.setTextualLineCount(lines);
            }
           
            final Flags flags;
            if (flagsToBeSet == null) {
                flags = new Flags();
View Full Code Here

        List<Header> originalHeaders = message.getHeaders();
        for (int i = 0; i < originalHeaders.size(); i++) {
            headers.add(new MaildirHeader(originalHeaders.get(i)));
        }

        PropertyBuilder pBuilder = new PropertyBuilder(message.getProperties());
        this.textualLineCount = message.getTextualLineCount();
        this.mediaType = message.getMediaType();
        this.subType = message.getSubType();
        final List<Property> properties = pBuilder.toProperties();
        this.properties = new ArrayList<MaildirProperty>(properties.size());
        int order = 0;
        for (final Property property:properties) {
            this.properties.add(new MaildirProperty(property, order++));
        }
View Full Code Here

        if (isComposite(mediaType)) {
            result = build(ResultUtils.toInput(document));
        } else {
            final List<MessageResult.Header> headers = ResultUtils.createHeaders(document);
            final List<Property> properties = document.getProperties();
            final PropertyBuilder builder = new PropertyBuilder(properties);
            final Long textualLineCount = document.getTextualLineCount();
            result = new MimeDescriptorImpl(
                    document.getBodyOctets(),
                    builder.getContentDescription(),
                    builder.getContentID(),
                    textualLineCount == null? -1: textualLineCount.longValue(),
                    document.getSubType(),
                    mediaType,
                    builder.getContentTransferEncoding(),
                    headers,
                    builder.getContentTypeParameters(),
                    builder.getContentLanguage(),
                    builder.getContentDispositionType(),
                    builder.getContentDispositionParameters(),
                    null,
                    new ArrayList<MimeDescriptor>(),
                    builder.getContentLocation(),
                    builder.getContentMD5());
        }
        return result;
    }
View Full Code Here

        List<Header> originalHeaders = message.getHeaders();
        for (int i = 0; i < originalHeaders.size(); i++) {
            headers.add(new JCRHeader(originalHeaders.get(i),logger));
        }

        PropertyBuilder pBuilder = new PropertyBuilder(message.getProperties());
        this.textualLineCount = message.getTextualLineCount();
        this.mediaType = message.getMediaType();
        this.subType = message.getSubType();
        final List<Property> properties = pBuilder.toProperties();
        this.properties = new ArrayList<JCRProperty>(properties.size());
        int order = 0;
        for (final Property property:properties) {
            this.properties.add(new JCRProperty(property, order++, logger));
        }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.store.mail.model.PropertyBuilder

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.