001: /*
002: * File : $Source: /usr/local/cvs/alkacon/com.alkacon.opencms.newsletter/src/com/alkacon/opencms/newsletter/I_CmsNewsletterMailData.java,v $
003: * Date : $Date: 2007-11-30 11:57:27 $
004: * Version: $Revision: 1.6 $
005: *
006: * This file is part of the Alkacon OpenCms Add-On Module Package
007: *
008: * Copyright (c) 2007 Alkacon Software GmbH (http://www.alkacon.com)
009: *
010: * The Alkacon OpenCms Add-On Module Package is free software:
011: * you can redistribute it and/or modify
012: * it under the terms of the GNU General Public License as published by
013: * the Free Software Foundation, either version 3 of the License, or
014: * (at your option) any later version.
015: *
016: * The Alkacon OpenCms Add-On Module Package is distributed
017: * in the hope that it will be useful,
018: * but WITHOUT ANY WARRANTY; without even the implied warranty of
019: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
020: * GNU General Public License for more details.
021: *
022: * You should have received a copy of the GNU General Public License
023: * along with the Alkacon OpenCms Add-On Module Package.
024: * If not, see http://www.gnu.org/licenses/.
025: *
026: * For further information about Alkacon Software GmbH, please see the
027: * company website: http://www.alkacon.com.
028: *
029: * For further information about OpenCms, please see the
030: * project website: http://www.opencms.org.
031: */
032:
033: package com.alkacon.opencms.newsletter;
034:
035: import org.opencms.file.CmsGroup;
036: import org.opencms.jsp.CmsJspActionElement;
037: import org.opencms.main.CmsException;
038: import org.opencms.xml.content.CmsXmlContent;
039:
040: import java.util.List;
041:
042: import org.apache.commons.mail.Email;
043:
044: /**
045: * Provides methods to generate newsletter emails and the list of recipients in different ways,
046: * e.g. using a different structured content.<p>
047: *
048: * @author Andreas Zahner
049: *
050: * @version $Revision: 1.6 $
051: *
052: * @since 7.0.3
053: */
054: public interface I_CmsNewsletterMailData {
055:
056: /**
057: * Returns the newsletter xml content.<p>
058: *
059: * @return the newsletter xml content
060: */
061: CmsXmlContent getContent();
062:
063: /**
064: * Returns the mail to send as newsletter, with set subject, text and from address.<p>
065: *
066: * @return the mail to send as newsletter
067: * @throws CmsException if generating the email content fails
068: */
069: Email getEmail() throws CmsException;
070:
071: /**
072: * Returns the email content to be shown in a preview, generates a valid html page that can be used.<p>
073: *
074: * @return the email content to be shown in a preview as html page
075: * @throws CmsException if generating the email preview fails
076: */
077: String getEmailContentPreview() throws CmsException;
078:
079: /**
080: * Returns the recipients of the newsletter mail, items are of type {@link javax.mail.internet.InternetAddress}.<p>
081: *
082: * @return the recipients of the newsletter mail
083: * @throws CmsException if getting the recipients from a mailing list group fails
084: */
085: List getRecipients() throws CmsException;
086:
087: /**
088: * Returns the resource type name of the newsletter XML content to use.<p>
089: *
090: * @return the resource type name of the newsletter XML content to use
091: */
092: String getResourceTypeName();
093:
094: /**
095: * Initializes the necessary members to generate the email and the list of recipients.<p>
096: *
097: * @param jsp the current action element
098: * @param group the mailing list group to send the newsletter to
099: * @param fileName the fileName of a VFS file that can be used to generate the newsletter
100: * @throws CmsException if reading the VFS file fails
101: */
102: void initialize(CmsJspActionElement jsp, CmsGroup group,
103: String fileName) throws CmsException;
104:
105: /**
106: * Checks if the newsletter can be sent or not.<p>
107: *
108: * This method can also write some data like the timestamp when the newsletter has been sent
109: * or the mailing list which received it to e.g. VFS properties.<p>
110: *
111: * @return true if newsletter can be sent to subscribers, otherwise false
112: * @throws CmsException if something goes wrong
113: */
114: boolean isSendable() throws CmsException;
115: }
|