org.opencms.notification
Class A_CmsNotification

java.lang.Object
  extended by org.apache.commons.mail.Email
      extended by org.apache.commons.mail.MultiPartEmail
          extended by org.apache.commons.mail.HtmlEmail
              extended by org.opencms.mail.CmsHtmlMail
                  extended by org.opencms.notification.A_CmsNotification
Direct Known Subclasses:
CmsContentNotification, CmsPublishNotification

public abstract class A_CmsNotification
extends CmsHtmlMail

Abstract class to create a notfication which will be send as a html mail to a user in OpenCms.

Since:
6.5.3
Version:
$Revision: 1.11 $
Author:
Peter Bonrad

Field Summary
 
Fields inherited from class org.apache.commons.mail.HtmlEmail
CID_LENGTH, html, inlineEmbeds, inlineImages, text
 
Fields inherited from class org.apache.commons.mail.Email
ATTACHMENTS, authenticator, bccList, bounceAddress, ccList, charset, content, CONTENT_TYPE, contentType, debug, EMAIL_BODY, EMAIL_SUBJECT, emailBody, FILE_SERVER, fromAddress, headers, hostName, ISO_8859_1, KOI8_R, MAIL_DEBUG, MAIL_HOST, MAIL_PORT, MAIL_SMTP_AUTH, MAIL_SMTP_CONNECTIONTIMEOUT, MAIL_SMTP_FROM, MAIL_SMTP_PASSWORD, MAIL_SMTP_SOCKET_FACTORY_CLASS, MAIL_SMTP_SOCKET_FACTORY_FALLBACK, MAIL_SMTP_SOCKET_FACTORY_PORT, MAIL_SMTP_TIMEOUT, MAIL_SMTP_USER, MAIL_TRANSPORT_PROTOCOL, MAIL_TRANSPORT_TLS, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, socketConnectionTimeout, socketTimeout, ssl, sslSmtpPort, subject, TEXT_HTML, TEXT_PLAIN, tls, toList, US_ASCII
 
Constructor Summary
A_CmsNotification(CmsObject cms, CmsUser receiver)
          Creates a new A_CmsNotification.
 
Method Summary
 void addMacro(java.lang.String key, java.lang.String value)
          Adds a new macro to the used macro resolver.
protected  void appendHtmlHeader(java.lang.StringBuffer buffer)
          Append the html-code to start a html mail message to the given buffer.
protected  void appenHtmlFooter(java.lang.StringBuffer buffer)
          Append the html-code to finish a html mail message to the given buffer.
protected abstract  java.lang.String generateHtmlMsg()
          Overwrite the method to generate the message body of the notification.
 CmsObject getCmsObject()
          Returns the CmsObject.
 java.util.Locale getLocale()
          Returns the locale.
protected abstract  java.lang.String getNotificationContent()
          Overwrite the method to return the path to the xmlcontent, where the subject, the header and the footer are defined.
 CmsUser getReceiver()
          Returns the receiver.
 java.lang.String send()
           
 
Methods inherited from class org.apache.commons.mail.HtmlEmail
buildMimeMessage, embed, embed, embed, embed, embed, embed, setHtmlMsg, setMsg, setTextMsg
 
Methods inherited from class org.apache.commons.mail.MultiPartEmail
addPart, addPart, addPart, attach, attach, attach, attach, attach, createBodyPart, createMimeMultipart, getContainer, getPrimaryBodyPart, getSubType, init, isBoolHasAttachments, isInitialized, setBoolHasAttachments, setInitialized, setSubType
 
Methods inherited from class org.apache.commons.mail.Email
addBcc, addBcc, addBcc, addCc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, createMimeMessage, getBccAddresses, getCcAddresses, getFromAddress, getHostName, getMailSession, getMimeMessage, getReplyToAddresses, getSentDate, getSmtpPort, getSocketConnectionTimeout, getSocketTimeout, getSslSmtpPort, getSubject, getToAddresses, isSSL, isTLS, sendMimeMessage, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setFrom, setHeaders, setHostName, setMailSession, setMailSessionFromJNDI, setPopBeforeSmtp, setReplyTo, setSentDate, setSmtpPort, setSocketConnectionTimeout, setSocketTimeout, setSSL, setSslSmtpPort, setSubject, setTLS, setTo, toInternetAddressArray, updateContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

A_CmsNotification

public A_CmsNotification(CmsObject cms,
                         CmsUser receiver)
Creates a new A_CmsNotification.

Parameters:
cms - the cms object to use
receiver - the receiver of the notification
Method Detail

addMacro

public void addMacro(java.lang.String key,
                     java.lang.String value)
Adds a new macro to the used macro resolver. Macros are used for the xml content file.

Parameters:
key - The key of the macro.
value - The value of the macro.

getCmsObject

public CmsObject getCmsObject()
Returns the CmsObject.

Returns:
the CmsObject

getLocale

public java.util.Locale getLocale()
Returns the locale.

Returns:
the locale

getReceiver

public CmsUser getReceiver()
Returns the receiver.

Returns:
the receiver

send

public java.lang.String send()
                      throws org.apache.commons.mail.EmailException
Overrides:
send in class org.apache.commons.mail.Email
Throws:
org.apache.commons.mail.EmailException
See Also:
Email.send()

appendHtmlHeader

protected void appendHtmlHeader(java.lang.StringBuffer buffer)
Append the html-code to start a html mail message to the given buffer.

Parameters:
buffer - The StringBuffer to add the html code to.

appenHtmlFooter

protected void appenHtmlFooter(java.lang.StringBuffer buffer)
Append the html-code to finish a html mail message to the given buffer.

Parameters:
buffer - The StringBuffer to add the html code to.

generateHtmlMsg

protected abstract java.lang.String generateHtmlMsg()
Overwrite the method to generate the message body of the notification. This text is placed between the header and the footer of the defined xmlcontent and the required html code is added.

Returns:
The text to be inserted in the notification.

getNotificationContent

protected abstract java.lang.String getNotificationContent()
Overwrite the method to return the path to the xmlcontent, where the subject, the header and the footer are defined.

Returns:
The path to the xmlcontent file.