1 /**************************************************************** 2 * Licensed to the Apache Software Foundation (ASF) under one * 3 * or more contributor license agreements. See the NOTICE file * 4 * distributed with this work for additional information * 5 * regarding copyright ownership. The ASF licenses this file * 6 * to you under the Apache License, Version 2.0 (the * 7 * "License"); you may not use this file except in compliance * 8 * with the License. You may obtain a copy of the License at * 9 * * 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 ****************************************************************/ 19 20 package org.apache.mailet.base.mail; 21 22 import javax.activation.DataSource; 23 import javax.mail.MessagingException; 24 import javax.mail.internet.ContentType; 25 import javax.mail.internet.MimeMultipart; 26 27 /** 28 * Class <code>MimeMultipartReport</code> implements JavaMail support 29 * for a MIME type of MimeMultipart with a subtype of report. 30 */ 31 public class MimeMultipartReport extends MimeMultipart 32 { 33 34 /** 35 * Default constructor 36 */ 37 public MimeMultipartReport() 38 { 39 this("report"); 40 } 41 42 /** 43 * Constructs a MimeMultipartReport of the given subtype. 44 * @param subtype 45 */ 46 public MimeMultipartReport(String subtype) 47 { 48 super(subtype); 49 } 50 51 /** 52 * Constructs a MimeMultipartReport from the passed DataSource. 53 * @param aDataSource 54 * @throws javax.mail.MessagingException 55 */ 56 public MimeMultipartReport(DataSource aDataSource) throws MessagingException 57 { 58 super(aDataSource); 59 } 60 61 /** 62 * Sets the type of report. 63 * @param reportType 64 * @throws MessagingException 65 */ 66 public void setReportType(String reportType) throws MessagingException 67 { 68 ContentType contentType = new ContentType(getContentType()); 69 contentType.setParameter("report-type", reportType); 70 setContentType(contentType); 71 } 72 73 /** 74 * Sets the content type 75 * @param aContentType 76 */ 77 protected void setContentType(ContentType aContentType) 78 { 79 contentType = aContentType.toString(); 80 } 81 82 }