01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
10: * http://www.apache.org/licenses/LICENSE-2.0 *
11: * *
12: * Unless required by applicable law or agreed to in writing, *
13: * software distributed under the License is distributed on an *
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15: * KIND, either express or implied. See the License for the *
16: * specific language governing permissions and limitations *
17: * under the License. *
18: ****************************************************************/package org.apache.james.util.mail;
19:
20: import javax.activation.DataSource;
21: import javax.mail.MessagingException;
22: import javax.mail.internet.ContentType;
23: import javax.mail.internet.MimeMultipart;
24:
25: /**
26: * Class <code>MimeMultipartReport</code> implements JavaMail support
27: * for a MIME type of MimeMultipart with a subtype of report.
28: */
29: public class MimeMultipartReport extends MimeMultipart {
30:
31: /**
32: * Default constructor
33: */
34: public MimeMultipartReport() {
35: this ("report");
36: }
37:
38: /**
39: * Constructs a MimeMultipartReport of the given subtype.
40: * @param subtype
41: */
42: public MimeMultipartReport(String subtype) {
43: super (subtype);
44: }
45:
46: /**
47: * Constructs a MimeMultipartReport from the passed DataSource.
48: * @param aDataSource
49: * @throws javax.mail.MessagingException
50: */
51: public MimeMultipartReport(DataSource aDataSource)
52: throws MessagingException {
53: super (aDataSource);
54: }
55:
56: /**
57: * Sets the type of report.
58: * @param reportType
59: * @throws MessagingException
60: */
61: public void setReportType(String reportType)
62: throws MessagingException {
63: ContentType contentType = new ContentType(getContentType());
64: contentType.setParameter("report-type", reportType);
65: setContentType(contentType);
66: }
67:
68: /**
69: * Sets the content type
70: * @param aContentType
71: */
72: protected void setContentType(ContentType aContentType) {
73: contentType = aContentType.toString();
74: }
75:
76: }
|