001 /****************************************************************
002 * Licensed to the Apache Software Foundation (ASF) under one *
003 * or more contributor license agreements. See the NOTICE file *
004 * distributed with this work for additional information *
005 * regarding copyright ownership. The ASF licenses this file *
006 * to you under the Apache License, Version 2.0 (the *
007 * "License"); you may not use this file except in compliance *
008 * with the License. You may obtain a copy of the License at *
009 * *
010 * http://www.apache.org/licenses/LICENSE-2.0 *
011 * *
012 * Unless required by applicable law or agreed to in writing, *
013 * software distributed under the License is distributed on an *
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
015 * KIND, either express or implied. See the License for the *
016 * specific language governing permissions and limitations *
017 * under the License. *
018 ****************************************************************/
019
020 package org.apache.mailet.base.mail;
021
022 import javax.activation.DataSource;
023 import javax.mail.MessagingException;
024 import javax.mail.internet.ContentType;
025 import javax.mail.internet.MimeMultipart;
026
027 /**
028 * Class <code>MimeMultipartReport</code> implements JavaMail support
029 * for a MIME type of MimeMultipart with a subtype of report.
030 */
031 public class MimeMultipartReport extends MimeMultipart
032 {
033
034 /**
035 * Default constructor
036 */
037 public MimeMultipartReport()
038 {
039 this("report");
040 }
041
042 /**
043 * Constructs a MimeMultipartReport of the given subtype.
044 * @param subtype
045 */
046 public MimeMultipartReport(String subtype)
047 {
048 super(subtype);
049 }
050
051 /**
052 * Constructs a MimeMultipartReport from the passed DataSource.
053 * @param aDataSource
054 * @throws javax.mail.MessagingException
055 */
056 public MimeMultipartReport(DataSource aDataSource) throws MessagingException
057 {
058 super(aDataSource);
059 }
060
061 /**
062 * Sets the type of report.
063 * @param reportType
064 * @throws MessagingException
065 */
066 public void setReportType(String reportType) throws MessagingException
067 {
068 ContentType contentType = new ContentType(getContentType());
069 contentType.setParameter("report-type", reportType);
070 setContentType(contentType);
071 }
072
073 /**
074 * Sets the content type
075 * @param aContentType
076 */
077 protected void setContentType(ContentType aContentType)
078 {
079 contentType = aContentType.toString();
080 }
081
082 }