KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > util > mail > MimeMultipartReport


1 /***********************************************************************
2  * Copyright (c) 2003-2004 The Apache Software Foundation. *
3  * All rights reserved. *
4  * ------------------------------------------------------------------- *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you *
6  * may not use this file except in compliance with the License. You *
7  * may obtain a copy of the License at: *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14  * implied. See the License for the specific language governing *
15  * permissions and limitations under the License. *
16  ***********************************************************************/

17 package org.apache.james.util.mail;
18
19 import javax.activation.DataSource JavaDoc;
20 import javax.mail.MessagingException JavaDoc;
21 import javax.mail.internet.ContentType JavaDoc;
22 import javax.mail.internet.MimeMultipart JavaDoc;
23
24 /**
25  * Class <code>MimeMultipartReport</code> implements JavaMail support
26  * for a MIME type of MimeMultipart with a subtype of report.
27  */

28 public class MimeMultipartReport extends MimeMultipart JavaDoc
29 {
30
31     /**
32      * Default constructor
33      */

34     public MimeMultipartReport()
35     {
36         this("report");
37     }
38
39     /**
40      * Constructs a MimeMultipartReport of the given subtype.
41      * @param subtype
42      */

43     public MimeMultipartReport(String JavaDoc subtype)
44     {
45         super(subtype);
46     }
47
48     /**
49      * Constructs a MimeMultipartReport from the passed DataSource.
50      * @param aDataSource
51      * @throws javax.mail.MessagingException
52      */

53     public MimeMultipartReport(DataSource JavaDoc aDataSource) throws MessagingException JavaDoc
54     {
55         super(aDataSource);
56     }
57     
58     /**
59      * Sets the type of report.
60      * @param reportType
61      * @throws MessagingException
62      */

63     public void setReportType(String JavaDoc reportType) throws MessagingException JavaDoc
64     {
65         ContentType JavaDoc contentType = new ContentType JavaDoc(getContentType());
66         contentType.setParameter("report-type", reportType);
67         setContentType(contentType);
68     }
69     
70     /**
71      * Sets the content type
72      * @param aContentType
73      */

74     protected void setContentType(ContentType JavaDoc aContentType)
75     {
76         contentType = aContentType.toString();
77     }
78
79 }
80
Popular Tags