001    /*
002     * Copyright 2010 the original author or authors.
003     * 
004     *  Licensed under the Apache License, Version 2.0 (the "License");
005     *  you may not use this file except in compliance with the License.
006     *  You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     *  Unless required by applicable law or agreed to in writing, software
011     *  distributed under the License is distributed on an "AS IS" BASIS,
012     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     *  See the License for the specific language governing permissions and
014     *  limitations under the License.
015     */
016    package com.hs.mail.imap.processor.fetch;
017    
018    import java.util.List;
019    
020    /**
021     * This class represents a BODYSTRUCTURE.
022     * 
023     * @author Won Chul Doh
024     * @since Mar 8, 2010
025     * 
026     */
027    public class MimeDescriptor {
028    
029            private long bodyOctets;        // Size in bytes
030            private long lines;     // Size in lines
031            private String type;    // Type
032            private String subType; // Subtype
033            private String Id;      // Content-ID
034            private String description;     // Content-Description
035            private String encoding;        // Encoding
036            private List<String> parameters;  // Body parameters
037            private String disposition;     // Disposition
038            private List<String> dispositionParams;   // Disposition parameters
039            private List<String> languages;   // Language
040            private String location;        // Location
041            private String md5;     // MD-5 checksum
042            private List<MimeDescriptor> parts;       // For multipart & message/rfc822
043            private MimeDescriptor embeddedMessageDescriptor;       // For message/rfc822
044            private Envelope envelope;      // For message/rfc822
045    
046            public MimeDescriptor(long bodyOctets, long lines, String type,
047                            String subType, String Id, String description, String encoding,
048                            List<String> parameters, String disposition,
049                            List<String> dispositionParams, List<String> languages,
050                            String location, String md5, List<MimeDescriptor> parts,
051                            MimeDescriptor embeddedMessageDescriptor, Envelope envelope) {
052                    super();
053                    this.bodyOctets = bodyOctets;
054                    this.lines = lines;
055                    this.type = type;
056                    this.subType = subType;
057                    this.Id = Id;
058                    this.description = description;
059                    this.encoding = encoding;
060                    this.parameters = parameters;
061                    this.disposition = disposition;
062                    this.dispositionParams = dispositionParams;
063                    this.languages = languages;
064                    this.location = location;
065                    this.md5 = md5;
066                    this.parts = parts;
067                    setEmbeddedMessageDescriptor(embeddedMessageDescriptor);
068                    setEnvelope(envelope);
069            }
070    
071            public long getBodyOctets() {
072                    return bodyOctets;
073            }
074    
075            public long getLines() {
076                    return lines;
077            }
078    
079            public String getType() {
080                    return type;
081            }
082    
083            public String getSubType() {
084                    return subType;
085            }
086    
087            public String getId() {
088                    return Id;
089            }
090    
091            public String getDescription() {
092                    return description;
093            }
094    
095            public String getEncoding() {
096                    return encoding;
097            }
098            
099            public List<String> getParameters() {
100                    return parameters;
101            }
102    
103            public String getDisposition() {
104                    return disposition;
105            }
106    
107            public List<String> getDispositionParams() {
108                    return dispositionParams;
109            }
110    
111            public List<String> getLanguages() {
112                    return languages;
113            }
114    
115            public String getLocation() {
116                    return location;
117            }
118    
119            public String getMd5() {
120                    return md5;
121            }
122    
123            public List<MimeDescriptor> getParts() {
124                    return parts;
125            }
126    
127            public void addPart(MimeDescriptor part) {
128                    parts.add(part);
129            }
130            
131            public MimeDescriptor getEmbeddedMessageDescriptor() {
132                    return embeddedMessageDescriptor;
133            }
134    
135            public void setEmbeddedMessageDescriptor(
136                            MimeDescriptor embeddedMessageDescriptor) {
137                    this.embeddedMessageDescriptor = embeddedMessageDescriptor;
138            }
139    
140            public Envelope getEnvelope() {
141                    return envelope;
142            }
143    
144            public void setEnvelope(Envelope envelope) {
145                    this.envelope = envelope;
146            }
147            
148    }