Nitido Inc.

com.nitido.nim
Class NotificationMessage

java.lang.Object
  extended by javax.mail.Multipart
      extended by javax.mail.internet.MimeMultipart
          extended by com.nitido.nim.NotificationMessage

public class NotificationMessage
extends javax.mail.internet.MimeMultipart

An object that contains all of the information about the message that the application wants to send. To set the content of the message the setPlainTextMessage() (for simple string messages) or add MimeBodyPart objects using addBodyPart() for other types of content (for example html and attachments)


Field Summary
protected  Entity _from
          The sender of this message.
protected  java.util.List<Member> _members
           
protected  java.lang.String _nonMember
           
protected  java.lang.String _subject
           
 
Fields inherited from class javax.mail.internet.MimeMultipart
ds, parsed
 
Fields inherited from class javax.mail.Multipart
contentType, parent, parts
 
Constructor Summary
NotificationMessage(Entity sender, java.util.List<Member> recipients, java.lang.String subject)
          Construct a new message with a list of Member objects as recipients.
NotificationMessage(Entity sender, java.lang.String recipient, java.lang.String subject)
          Construct a new message with a single recipient.
 
Method Summary
 void addBodyPart(javax.mail.BodyPart part)
          Deprecated.  
 void addBodyPart(javax.mail.BodyPart part, int index)
          Deprecated.  
 void addNotificationBodyPart(NotificationBodyPart part)
          This method is a recommended replacement for the generic addBodyPart(BodyPart part) method.
 void addNotificationBodyPart(NotificationBodyPart part, int index)
          This method is a recommended replacement for the generic addBodyPart(BodyPart part, int index) method.
 void addTextMessage(java.lang.String text, java.lang.String charset, java.lang.String subtype)
          Add a text message as a body part of this object with the specified charset encoding and declared subtype.
 java.util.List<Member> getMemberRecipients()
           
 Entity getSender()
           
 java.lang.String getStringRecipient()
           
 java.lang.String getSubject()
           
 void removeAllBodyParts()
          This method will remove all the existing body parts of the message.
 void setMemberRecipients(java.util.List<Member> members)
           
 void setPlainTextMessage(java.lang.String text)
          Set a plain text message as a body part to this object.
 void setSender(Entity sender)
           
 void setStringRecipient(java.lang.String recipient)
           
 void setSubject(java.lang.String subject)
           
 void setTextMessage(java.lang.String text, java.lang.String charset, java.lang.String subtype)
          Set a text message as a body part of this object with the specified charset encoding and declared subtype.
 
Methods inherited from class javax.mail.internet.MimeMultipart
createInternetHeaders, createMimeBodyPart, createMimeBodyPart, getBodyPart, getBodyPart, getCount, getPreamble, isComplete, parse, removeBodyPart, removeBodyPart, setPreamble, setSubType, updateHeaders, writeTo
 
Methods inherited from class javax.mail.Multipart
getContentType, getParent, setMultipartDataSource, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_from

protected Entity _from
The sender of this message. In cases where the notification service is not being invoked by a logged-in user this will need to be a special system entity.


_nonMember

protected java.lang.String _nonMember

_members

protected java.util.List<Member> _members

_subject

protected java.lang.String _subject
Constructor Detail

NotificationMessage

public NotificationMessage(Entity sender,
                           java.util.List<Member> recipients,
                           java.lang.String subject)
Construct a new message with a list of Member objects as recipients.

Parameters:
sender - the sender of this message
recipients - the list of Member objects to whom this message is to be sent
subject - the message's subject (will be used if it supported by the delivery channel)

NotificationMessage

public NotificationMessage(Entity sender,
                           java.lang.String recipient,
                           java.lang.String subject)
Construct a new message with a single recipient.

Parameters:
sender - the sender of this message
recipient - a single recipient properly encoded with the protocol string (for example "mailto://") followed by the address
subject - the message's subject (will be used if it supported by the delivery channel)
Method Detail

getSender

public Entity getSender()

setSender

public void setSender(Entity sender)

getMemberRecipients

public java.util.List<Member> getMemberRecipients()

setMemberRecipients

public void setMemberRecipients(java.util.List<Member> members)

getStringRecipient

public java.lang.String getStringRecipient()

setStringRecipient

public void setStringRecipient(java.lang.String recipient)

getSubject

public java.lang.String getSubject()

setSubject

public void setSubject(java.lang.String subject)

addBodyPart

public void addBodyPart(javax.mail.BodyPart part)
                 throws javax.mail.MessagingException
Deprecated. 

This method is just a redirection to the super class's method. It is declared here because of the following warning:

SPECIAL WARNING: The BodyPart object passed to this method must be extended from the NotificationBodyPart object. If you use the regular MimeBodyPart, you will LOST ALL CHARSET/ENCODING information. All email content will be sent as the ASCII encoding (or whatever encoding you defined in the JVM system property for mail.mime.charset or file.encoding).

We are keeping this method just for backward compatability

Overrides:
addBodyPart in class javax.mail.internet.MimeMultipart
Throws:
javax.mail.MessagingException

addBodyPart

public void addBodyPart(javax.mail.BodyPart part,
                        int index)
                 throws javax.mail.MessagingException
Deprecated. 

This method is just a redirection to the super class's method. It is declared here because of the following warning:

SPECIAL WARNING: The BodyPart object passed to this method must be extended from the NotificationBodyPart object. If you use the regular MimeBodyPart, you will LOST ALL CHARSET/ENCODING information. All email content will be sent as the ASCII encoding (or whatever encoding you defined in the JVM system property for mail.mime.charset or file.encoding).

We are keeping this method just for backward compatability

Overrides:
addBodyPart in class javax.mail.internet.MimeMultipart
Throws:
javax.mail.MessagingException

addNotificationBodyPart

public void addNotificationBodyPart(NotificationBodyPart part)
                             throws javax.mail.MessagingException
This method is a recommended replacement for the generic addBodyPart(BodyPart part) method. It will accept a NotificationBodyPart object that will actually remembers the charset portion of the ContentType string of the body part.

It will append the specified body part to the end of the message.

Parameters:
part - The new body part object
Throws:
javax.mail.MessagingException

addNotificationBodyPart

public void addNotificationBodyPart(NotificationBodyPart part,
                                    int index)
                             throws javax.mail.MessagingException
This method is a recommended replacement for the generic addBodyPart(BodyPart part, int index) method. It will accept a NotificationBodyPart object that will actually remembers the charset portion of the ContentType string of the body part.

It will insert the new body part to the specified index. All existing body part with an index greater or equal to the specified index is shifted upward to have an index one larger than its original value.

Parameters:
part - The new body part object
index - The index to inser the new body part to. It must be larger or equal to 0. It cannot be larger than the current count of the body parts in this message.
Throws:
javax.mail.MessagingException

setPlainTextMessage

public void setPlainTextMessage(java.lang.String text)
                         throws javax.mail.MessagingException
Set a plain text message as a body part to this object. This method will remove all existing body parts and use the specified text as the only body part of the message.

The content type of this plain text message is "text/plain". It will utilizes the JavaMail's default encoding.

Parameters:
text - the text that becomes the body of the message
Throws:
javax.mail.MessagingException

setTextMessage

public void setTextMessage(java.lang.String text,
                           java.lang.String charset,
                           java.lang.String subtype)
                    throws javax.mail.MessagingException
Set a text message as a body part of this object with the specified charset encoding and declared subtype. This method will remove all existing body parts and use the specified text as the only body part of the message.

The content type will be in the format of "text/<subtype>; charset=<charset>".

This mehtod takes the parameters in the order of text, charset, subtype (which is the same order as the MimeBodyPart.setText() method.

Parameters:
text - the text that becomes the body of the message
charset - the character set for the text encoding (e.g. utf-8)
subtype - the subtype of the text's content type (e.g. "plain", "html", "xhtml+xml", "wml").
Throws:
javax.mail.MessagingException

removeAllBodyParts

public void removeAllBodyParts()
                        throws javax.mail.MessagingException
This method will remove all the existing body parts of the message.

Throws:
javax.mail.MessagingException

addTextMessage

public void addTextMessage(java.lang.String text,
                           java.lang.String charset,
                           java.lang.String subtype)
                    throws javax.mail.MessagingException
Add a text message as a body part of this object with the specified charset encoding and declared subtype. This method will append the new text to the message as the last body part.

The content type will be in the format of "text/<subtype>; charset=<charset>".

This mehtod takes the parameters in the order of text, charset, subtype (which is the same order as the MimeBodyPart.setText() method.

Parameters:
text - the text that becomes the body of the message
charset - the character set for the text encoding (e.g. utf-8)
subtype - the subtype of the text's content type (e.g. "plain", "html", "xhtml+xml", "wml").
Throws:
javax.mail.MessagingException

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.